diff --git openjdk-orig/README-LSB.txt openjdk/README-LSB.txt
new file mode 100644
index 0000000..d92fc7b
--- /dev/null
+++ openjdk/README-LSB.txt
@@ -0,0 +1,15 @@
+
+Limitations of LSB version of OpenJDK.
+
+Debugging may not work correctly.  You should have non-lsb library libthread_db for it to work, but even then it's not guaranteed to behave in usual way.
+
+Setting up thread priority may not work.
+
+Some statistics is reported for pids instead of LWP's.  Sometimes result of pthread_self() call is shown instead of LWP.  They're distinguished simply: if it looks like a pid, it's a LWP.  If it looks like a pointer value, it's a pthread_self() result.
+
+Sound is not guaranteed to work.  That depends of whether alsa library presents on your machine.
+
+Getting statistics of swap memory is not guaranteed to work.
+
+Getting info about whether memory pages are in RAM may not work.
+
diff --git openjdk-orig/control/make/Makefile openjdk/control/make/Makefile
index d569e4a..f3b9473 100644
--- openjdk-orig/control/make/Makefile
+++ openjdk/control/make/Makefile
@@ -63,6 +63,7 @@ endif
 include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
 
 include ./make/Defs-internal.gmk
+include ./make/Defs-lsb.gmk
 
 all::
 	@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'`
diff --git openjdk-orig/control/make/make/Defs-lsb.gmk openjdk/control/make/make/Defs-lsb.gmk
new file mode 100644
index 0000000..a027e41
--- /dev/null
+++ openjdk/control/make/make/Defs-lsb.gmk
@@ -0,0 +1,51 @@
+# Generic make definitions for LSB build
+
+ifdef OPENJDK_LSB_VERSION
+
+# For trial-use ALSA.  We should get rid of it.
+export LSB_MODULES=Multimedia
+
+# Shared libraries shipped by OpenJDK 7.  We should add them to the list
+# for them to be linked dynamically
+LIBLIST=_image \
+    awt \
+    dt_socket \
+    fontmanager \
+    hpi \
+    hprof \
+    instrument \
+    j2gss \
+    j2pcsc \
+    j2pkcs11 \
+    jaas_unix \
+    java \
+    java_crw_demo \
+    jawt \
+    jdwp \
+    jli \
+    jpeg \
+    jsdt \
+    jsig \
+    jsound \
+    jsoundalsa \
+    jvm \
+    lcms \
+    management \
+    mawt \
+    net \
+    nio \
+    npt \
+    rmi \
+    sctp \
+    splashscreen \
+    unpack \
+    verify \
+    zip \
+    lsb_helper_hotspot7 \
+    lsb_helper_openjdk7 
+
+# Convert the list above to format of LSBCC_SHAREDLIBS variable
+export LSBCC_SHAREDLIBS := $(shell echo $(LIBLIST) | sed 's/\s/:/g')
+
+endif
+
diff --git openjdk-orig/hotspot/agent/src/os/linux/libproc_impl.h openjdk/hotspot/agent/src/os/linux/libproc_impl.h
index 43fbb59..49b8d1f 100644
--- openjdk-orig/hotspot/agent/src/os/linux/libproc_impl.h
+++ openjdk/hotspot/agent/src/os/linux/libproc_impl.h
@@ -30,9 +30,12 @@
 #include "libproc.h"
 #include "symtab.h"
 
+// for NAME_MAN
+#include <lsb_flags.h>
+
 // data structures in this file mimic those of Solaris 8.0 - libproc's Pcontrol.h
 
-#define BUF_SIZE     (PATH_MAX + NAME_MAX + 1)
+#define BUF_SIZE     (PATH_MAX + NAME_MAX_FORBIDDEN + 1)
 
 // list of shared objects
 typedef struct lib_info {
diff --git openjdk-orig/hotspot/lsb/README openjdk/hotspot/lsb/README
new file mode 100644
index 0000000..a112dfc
--- /dev/null
+++ openjdk/hotspot/lsb/README
@@ -0,0 +1,4 @@
+LSB compatibility wrapper
+
+
+
diff --git openjdk-orig/hotspot/lsb/include/alloca.h openjdk/hotspot/lsb/include/alloca.h
new file mode 100644
index 0000000..cd54afe
--- /dev/null
+++ openjdk/hotspot/lsb/include/alloca.h
@@ -0,0 +1,26 @@
+
+/* LSB helper for alloca function.
+
+The function is just a compiler's hint.  It's not available on every
+architecture, but it is inline funciton and even if it does cause harm,
+it's out of the scope of LSB.
+*/
+
+#ifndef	_ALLOCA_H
+#define	_ALLOCA_H	1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Remove any previous definitions.  */
+#undef	alloca
+
+#define alloca(size)	__builtin_alloca (size)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* alloca.h */
+
diff --git openjdk-orig/hotspot/lsb/include/elf.h openjdk/hotspot/lsb/include/elf.h
new file mode 100644
index 0000000..96363e8
--- /dev/null
+++ openjdk/hotspot/lsb/include/elf.h
@@ -0,0 +1,2684 @@
+/* This file defines standard ELF types, structures, and macros.
+   Copyright (C) 1995-2003,2004,2005,2006,2007,2008
+	Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _ELF_H
+#define	_ELF_H 1
+
+#include <features.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Standard ELF types.  */
+
+#include <stdint.h>
+
+/* Type for a 16-bit quantity.  */
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
+
+/* Types for signed and unsigned 32-bit quantities.  */
+typedef uint32_t Elf32_Word;
+typedef	int32_t  Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedef	int32_t  Elf64_Sword;
+
+/* Types for signed and unsigned 64-bit quantities.  */
+typedef uint64_t Elf32_Xword;
+typedef	int64_t  Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef	int64_t  Elf64_Sxword;
+
+/* Type of addresses.  */
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
+
+/* Type of file offsets.  */
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
+
+/* Type for section indices, which are 16-bit quantities.  */
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+
+/* Type for version symbol information.  */
+typedef Elf32_Half Elf32_Versym;
+typedef Elf64_Half Elf64_Versym;
+
+
+/* The ELF file header.  This appears at the start of every ELF file.  */
+
+#define EI_NIDENT (16)
+
+typedef struct
+{
+  unsigned char	e_ident[EI_NIDENT];	/* Magic number and other info */
+  Elf32_Half	e_type;			/* Object file type */
+  Elf32_Half	e_machine;		/* Architecture */
+  Elf32_Word	e_version;		/* Object file version */
+  Elf32_Addr	e_entry;		/* Entry point virtual address */
+  Elf32_Off	e_phoff;		/* Program header table file offset */
+  Elf32_Off	e_shoff;		/* Section header table file offset */
+  Elf32_Word	e_flags;		/* Processor-specific flags */
+  Elf32_Half	e_ehsize;		/* ELF header size in bytes */
+  Elf32_Half	e_phentsize;		/* Program header table entry size */
+  Elf32_Half	e_phnum;		/* Program header table entry count */
+  Elf32_Half	e_shentsize;		/* Section header table entry size */
+  Elf32_Half	e_shnum;		/* Section header table entry count */
+  Elf32_Half	e_shstrndx;		/* Section header string table index */
+} Elf32_Ehdr;
+
+typedef struct
+{
+  unsigned char	e_ident[EI_NIDENT];	/* Magic number and other info */
+  Elf64_Half	e_type;			/* Object file type */
+  Elf64_Half	e_machine;		/* Architecture */
+  Elf64_Word	e_version;		/* Object file version */
+  Elf64_Addr	e_entry;		/* Entry point virtual address */
+  Elf64_Off	e_phoff;		/* Program header table file offset */
+  Elf64_Off	e_shoff;		/* Section header table file offset */
+  Elf64_Word	e_flags;		/* Processor-specific flags */
+  Elf64_Half	e_ehsize;		/* ELF header size in bytes */
+  Elf64_Half	e_phentsize;		/* Program header table entry size */
+  Elf64_Half	e_phnum;		/* Program header table entry count */
+  Elf64_Half	e_shentsize;		/* Section header table entry size */
+  Elf64_Half	e_shnum;		/* Section header table entry count */
+  Elf64_Half	e_shstrndx;		/* Section header string table index */
+} Elf64_Ehdr;
+
+/* Fields in the e_ident array.  The EI_* macros are indices into the
+   array.  The macros under each EI_* macro are the values the byte
+   may have.  */
+
+#define EI_MAG0		0		/* File identification byte 0 index */
+#define ELFMAG0		0x7f		/* Magic number byte 0 */
+
+#define EI_MAG1		1		/* File identification byte 1 index */
+#define ELFMAG1		'E'		/* Magic number byte 1 */
+
+#define EI_MAG2		2		/* File identification byte 2 index */
+#define ELFMAG2		'L'		/* Magic number byte 2 */
+
+#define EI_MAG3		3		/* File identification byte 3 index */
+#define ELFMAG3		'F'		/* Magic number byte 3 */
+
+/* Conglomeration of the identification bytes, for easy testing as a word.  */
+#define	ELFMAG		"\177ELF"
+#define	SELFMAG		4
+
+#define EI_CLASS	4		/* File class byte index */
+#define ELFCLASSNONE	0		/* Invalid class */
+#define ELFCLASS32	1		/* 32-bit objects */
+#define ELFCLASS64	2		/* 64-bit objects */
+#define ELFCLASSNUM	3
+
+#define EI_DATA		5		/* Data encoding byte index */
+#define ELFDATANONE	0		/* Invalid data encoding */
+#define ELFDATA2LSB	1		/* 2's complement, little endian */
+#define ELFDATA2MSB	2		/* 2's complement, big endian */
+#define ELFDATANUM	3
+
+#define EI_VERSION	6		/* File version byte index */
+					/* Value must be EV_CURRENT */
+
+#define EI_OSABI	7		/* OS ABI identification */
+#define ELFOSABI_NONE		0	/* UNIX System V ABI */
+#define ELFOSABI_SYSV		0	/* Alias.  */
+#define ELFOSABI_HPUX		1	/* HP-UX */
+#define ELFOSABI_NETBSD		2	/* NetBSD.  */
+#define ELFOSABI_LINUX		3	/* Linux.  */
+#define ELFOSABI_SOLARIS	6	/* Sun Solaris.  */
+#define ELFOSABI_AIX		7	/* IBM AIX.  */
+#define ELFOSABI_IRIX		8	/* SGI Irix.  */
+#define ELFOSABI_FREEBSD	9	/* FreeBSD.  */
+#define ELFOSABI_TRU64		10	/* Compaq TRU64 UNIX.  */
+#define ELFOSABI_MODESTO	11	/* Novell Modesto.  */
+#define ELFOSABI_OPENBSD	12	/* OpenBSD.  */
+#define ELFOSABI_ARM		97	/* ARM */
+#define ELFOSABI_STANDALONE	255	/* Standalone (embedded) application */
+
+#define EI_ABIVERSION	8		/* ABI version */
+
+#define EI_PAD		9		/* Byte index of padding bytes */
+
+/* Legal values for e_type (object file type).  */
+
+#define ET_NONE		0		/* No file type */
+#define ET_REL		1		/* Relocatable file */
+#define ET_EXEC		2		/* Executable file */
+#define ET_DYN		3		/* Shared object file */
+#define ET_CORE		4		/* Core file */
+#define	ET_NUM		5		/* Number of defined types */
+#define ET_LOOS		0xfe00		/* OS-specific range start */
+#define ET_HIOS		0xfeff		/* OS-specific range end */
+#define ET_LOPROC	0xff00		/* Processor-specific range start */
+#define ET_HIPROC	0xffff		/* Processor-specific range end */
+
+/* Legal values for e_machine (architecture).  */
+
+#define EM_NONE		 0		/* No machine */
+#define EM_M32		 1		/* AT&T WE 32100 */
+#define EM_SPARC	 2		/* SUN SPARC */
+#define EM_386		 3		/* Intel 80386 */
+#define EM_68K		 4		/* Motorola m68k family */
+#define EM_88K		 5		/* Motorola m88k family */
+#define EM_860		 7		/* Intel 80860 */
+#define EM_MIPS		 8		/* MIPS R3000 big-endian */
+#define EM_S370		 9		/* IBM System/370 */
+#define EM_MIPS_RS3_LE	10		/* MIPS R3000 little-endian */
+
+#define EM_PARISC	15		/* HPPA */
+#define EM_VPP500	17		/* Fujitsu VPP500 */
+#define EM_SPARC32PLUS	18		/* Sun's "v8plus" */
+#define EM_960		19		/* Intel 80960 */
+#define EM_PPC		20		/* PowerPC */
+#define EM_PPC64	21		/* PowerPC 64-bit */
+#define EM_S390		22		/* IBM S390 */
+
+#define EM_V800		36		/* NEC V800 series */
+#define EM_FR20		37		/* Fujitsu FR20 */
+#define EM_RH32		38		/* TRW RH-32 */
+#define EM_RCE		39		/* Motorola RCE */
+#define EM_ARM		40		/* ARM */
+#define EM_FAKE_ALPHA	41		/* Digital Alpha */
+#define EM_SH		42		/* Hitachi SH */
+#define EM_SPARCV9	43		/* SPARC v9 64-bit */
+#define EM_TRICORE	44		/* Siemens Tricore */
+#define EM_ARC		45		/* Argonaut RISC Core */
+#define EM_H8_300	46		/* Hitachi H8/300 */
+#define EM_H8_300H	47		/* Hitachi H8/300H */
+#define EM_H8S		48		/* Hitachi H8S */
+#define EM_H8_500	49		/* Hitachi H8/500 */
+#define EM_IA_64	50		/* Intel Merced */
+#define EM_MIPS_X	51		/* Stanford MIPS-X */
+#define EM_COLDFIRE	52		/* Motorola Coldfire */
+#define EM_68HC12	53		/* Motorola M68HC12 */
+#define EM_MMA		54		/* Fujitsu MMA Multimedia Accelerator*/
+#define EM_PCP		55		/* Siemens PCP */
+#define EM_NCPU		56		/* Sony nCPU embeeded RISC */
+#define EM_NDR1		57		/* Denso NDR1 microprocessor */
+#define EM_STARCORE	58		/* Motorola Start*Core processor */
+#define EM_ME16		59		/* Toyota ME16 processor */
+#define EM_ST100	60		/* STMicroelectronic ST100 processor */
+#define EM_TINYJ	61		/* Advanced Logic Corp. Tinyj emb.fam*/
+#define EM_X86_64	62		/* AMD x86-64 architecture */
+#define EM_PDSP		63		/* Sony DSP Processor */
+
+#define EM_FX66		66		/* Siemens FX66 microcontroller */
+#define EM_ST9PLUS	67		/* STMicroelectronics ST9+ 8/16 mc */
+#define EM_ST7		68		/* STmicroelectronics ST7 8 bit mc */
+#define EM_68HC16	69		/* Motorola MC68HC16 microcontroller */
+#define EM_68HC11	70		/* Motorola MC68HC11 microcontroller */
+#define EM_68HC08	71		/* Motorola MC68HC08 microcontroller */
+#define EM_68HC05	72		/* Motorola MC68HC05 microcontroller */
+#define EM_SVX		73		/* Silicon Graphics SVx */
+#define EM_ST19		74		/* STMicroelectronics ST19 8 bit mc */
+#define EM_VAX		75		/* Digital VAX */
+#define EM_CRIS		76		/* Axis Communications 32-bit embedded processor */
+#define EM_JAVELIN	77		/* Infineon Technologies 32-bit embedded processor */
+#define EM_FIREPATH	78		/* Element 14 64-bit DSP Processor */
+#define EM_ZSP		79		/* LSI Logic 16-bit DSP Processor */
+#define EM_MMIX		80		/* Donald Knuth's educational 64-bit processor */
+#define EM_HUANY	81		/* Harvard University machine-independent object files */
+#define EM_PRISM	82		/* SiTera Prism */
+#define EM_AVR		83		/* Atmel AVR 8-bit microcontroller */
+#define EM_FR30		84		/* Fujitsu FR30 */
+#define EM_D10V		85		/* Mitsubishi D10V */
+#define EM_D30V		86		/* Mitsubishi D30V */
+#define EM_V850		87		/* NEC v850 */
+#define EM_M32R		88		/* Mitsubishi M32R */
+#define EM_MN10300	89		/* Matsushita MN10300 */
+#define EM_MN10200	90		/* Matsushita MN10200 */
+#define EM_PJ		91		/* picoJava */
+#define EM_OPENRISC	92		/* OpenRISC 32-bit embedded processor */
+#define EM_ARC_A5	93		/* ARC Cores Tangent-A5 */
+#define EM_XTENSA	94		/* Tensilica Xtensa Architecture */
+#define EM_NUM		95
+
+/* If it is necessary to assign new unofficial EM_* values, please
+   pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
+   chances of collision with official or non-GNU unofficial values.  */
+
+#define EM_ALPHA	0x9026
+
+/* Legal values for e_version (version).  */
+
+#define EV_NONE		0		/* Invalid ELF version */
+#define EV_CURRENT	1		/* Current version */
+#define EV_NUM		2
+
+/* Section header.  */
+
+typedef struct
+{
+  Elf32_Word	sh_name;		/* Section name (string tbl index) */
+  Elf32_Word	sh_type;		/* Section type */
+  Elf32_Word	sh_flags;		/* Section flags */
+  Elf32_Addr	sh_addr;		/* Section virtual addr at execution */
+  Elf32_Off	sh_offset;		/* Section file offset */
+  Elf32_Word	sh_size;		/* Section size in bytes */
+  Elf32_Word	sh_link;		/* Link to another section */
+  Elf32_Word	sh_info;		/* Additional section information */
+  Elf32_Word	sh_addralign;		/* Section alignment */
+  Elf32_Word	sh_entsize;		/* Entry size if section holds table */
+} Elf32_Shdr;
+
+typedef struct
+{
+  Elf64_Word	sh_name;		/* Section name (string tbl index) */
+  Elf64_Word	sh_type;		/* Section type */
+  Elf64_Xword	sh_flags;		/* Section flags */
+  Elf64_Addr	sh_addr;		/* Section virtual addr at execution */
+  Elf64_Off	sh_offset;		/* Section file offset */
+  Elf64_Xword	sh_size;		/* Section size in bytes */
+  Elf64_Word	sh_link;		/* Link to another section */
+  Elf64_Word	sh_info;		/* Additional section information */
+  Elf64_Xword	sh_addralign;		/* Section alignment */
+  Elf64_Xword	sh_entsize;		/* Entry size if section holds table */
+} Elf64_Shdr;
+
+/* Special section indices.  */
+
+#define SHN_UNDEF	0		/* Undefined section */
+#define SHN_LORESERVE	0xff00		/* Start of reserved indices */
+#define SHN_LOPROC	0xff00		/* Start of processor-specific */
+#define SHN_BEFORE	0xff00		/* Order section before all others
+					   (Solaris).  */
+#define SHN_AFTER	0xff01		/* Order section after all others
+					   (Solaris).  */
+#define SHN_HIPROC	0xff1f		/* End of processor-specific */
+#define SHN_LOOS	0xff20		/* Start of OS-specific */
+#define SHN_HIOS	0xff3f		/* End of OS-specific */
+#define SHN_ABS		0xfff1		/* Associated symbol is absolute */
+#define SHN_COMMON	0xfff2		/* Associated symbol is common */
+#define SHN_XINDEX	0xffff		/* Index is in extra table.  */
+#define SHN_HIRESERVE	0xffff		/* End of reserved indices */
+
+/* Legal values for sh_type (section type).  */
+
+#define SHT_NULL	  0		/* Section header table entry unused */
+#define SHT_PROGBITS	  1		/* Program data */
+#define SHT_SYMTAB	  2		/* Symbol table */
+#define SHT_STRTAB	  3		/* String table */
+#define SHT_RELA	  4		/* Relocation entries with addends */
+#define SHT_HASH	  5		/* Symbol hash table */
+#define SHT_DYNAMIC	  6		/* Dynamic linking information */
+#define SHT_NOTE	  7		/* Notes */
+#define SHT_NOBITS	  8		/* Program space with no data (bss) */
+#define SHT_REL		  9		/* Relocation entries, no addends */
+#define SHT_SHLIB	  10		/* Reserved */
+#define SHT_DYNSYM	  11		/* Dynamic linker symbol table */
+#define SHT_INIT_ARRAY	  14		/* Array of constructors */
+#define SHT_FINI_ARRAY	  15		/* Array of destructors */
+#define SHT_PREINIT_ARRAY 16		/* Array of pre-constructors */
+#define SHT_GROUP	  17		/* Section group */
+#define SHT_SYMTAB_SHNDX  18		/* Extended section indeces */
+#define	SHT_NUM		  19		/* Number of defined types.  */
+#define SHT_LOOS	  0x60000000	/* Start OS-specific.  */
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5	/* Object attributes.  */
+#define SHT_GNU_HASH	  0x6ffffff6	/* GNU-style hash table.  */
+#define SHT_GNU_LIBLIST	  0x6ffffff7	/* Prelink library list */
+#define SHT_CHECKSUM	  0x6ffffff8	/* Checksum for DSO content.  */
+#define SHT_LOSUNW	  0x6ffffffa	/* Sun-specific low bound.  */
+#define SHT_SUNW_move	  0x6ffffffa
+#define SHT_SUNW_COMDAT   0x6ffffffb
+#define SHT_SUNW_syminfo  0x6ffffffc
+#define SHT_GNU_verdef	  0x6ffffffd	/* Version definition section.  */
+#define SHT_GNU_verneed	  0x6ffffffe	/* Version needs section.  */
+#define SHT_GNU_versym	  0x6fffffff	/* Version symbol table.  */
+#define SHT_HISUNW	  0x6fffffff	/* Sun-specific high bound.  */
+#define SHT_HIOS	  0x6fffffff	/* End OS-specific type */
+#define SHT_LOPROC	  0x70000000	/* Start of processor-specific */
+#define SHT_HIPROC	  0x7fffffff	/* End of processor-specific */
+#define SHT_LOUSER	  0x80000000	/* Start of application-specific */
+#define SHT_HIUSER	  0x8fffffff	/* End of application-specific */
+
+/* Legal values for sh_flags (section flags).  */
+
+#define SHF_WRITE	     (1 << 0)	/* Writable */
+#define SHF_ALLOC	     (1 << 1)	/* Occupies memory during execution */
+#define SHF_EXECINSTR	     (1 << 2)	/* Executable */
+#define SHF_MERGE	     (1 << 4)	/* Might be merged */
+#define SHF_STRINGS	     (1 << 5)	/* Contains nul-terminated strings */
+#define SHF_INFO_LINK	     (1 << 6)	/* `sh_info' contains SHT index */
+#define SHF_LINK_ORDER	     (1 << 7)	/* Preserve order after combining */
+#define SHF_OS_NONCONFORMING (1 << 8)	/* Non-standard OS specific handling
+					   required */
+#define SHF_GROUP	     (1 << 9)	/* Section is member of a group.  */
+#define SHF_TLS		     (1 << 10)	/* Section hold thread-local data.  */
+#define SHF_MASKOS	     0x0ff00000	/* OS-specific.  */
+#define SHF_MASKPROC	     0xf0000000	/* Processor-specific */
+#define SHF_ORDERED	     (1 << 30)	/* Special ordering requirement
+					   (Solaris).  */
+#define SHF_EXCLUDE	     (1 << 31)	/* Section is excluded unless
+					   referenced or allocated (Solaris).*/
+
+/* Section group handling.  */
+#define GRP_COMDAT	0x1		/* Mark group as COMDAT.  */
+
+/* Symbol table entry.  */
+
+typedef struct
+{
+  Elf32_Word	st_name;		/* Symbol name (string tbl index) */
+  Elf32_Addr	st_value;		/* Symbol value */
+  Elf32_Word	st_size;		/* Symbol size */
+  unsigned char	st_info;		/* Symbol type and binding */
+  unsigned char	st_other;		/* Symbol visibility */
+  Elf32_Section	st_shndx;		/* Section index */
+} Elf32_Sym;
+
+typedef struct
+{
+  Elf64_Word	st_name;		/* Symbol name (string tbl index) */
+  unsigned char	st_info;		/* Symbol type and binding */
+  unsigned char st_other;		/* Symbol visibility */
+  Elf64_Section	st_shndx;		/* Section index */
+  Elf64_Addr	st_value;		/* Symbol value */
+  Elf64_Xword	st_size;		/* Symbol size */
+} Elf64_Sym;
+
+/* The syminfo section if available contains additional information about
+   every dynamic symbol.  */
+
+typedef struct
+{
+  Elf32_Half si_boundto;		/* Direct bindings, symbol bound to */
+  Elf32_Half si_flags;			/* Per symbol flags */
+} Elf32_Syminfo;
+
+typedef struct
+{
+  Elf64_Half si_boundto;		/* Direct bindings, symbol bound to */
+  Elf64_Half si_flags;			/* Per symbol flags */
+} Elf64_Syminfo;
+
+/* Possible values for si_boundto.  */
+#define SYMINFO_BT_SELF		0xffff	/* Symbol bound to self */
+#define SYMINFO_BT_PARENT	0xfffe	/* Symbol bound to parent */
+#define SYMINFO_BT_LOWRESERVE	0xff00	/* Beginning of reserved entries */
+
+/* Possible bitmasks for si_flags.  */
+#define SYMINFO_FLG_DIRECT	0x0001	/* Direct bound symbol */
+#define SYMINFO_FLG_PASSTHRU	0x0002	/* Pass-thru symbol for translator */
+#define SYMINFO_FLG_COPY	0x0004	/* Symbol is a copy-reloc */
+#define SYMINFO_FLG_LAZYLOAD	0x0008	/* Symbol bound to object to be lazy
+					   loaded */
+/* Syminfo version values.  */
+#define SYMINFO_NONE		0
+#define SYMINFO_CURRENT		1
+#define SYMINFO_NUM		2
+
+
+/* How to extract and insert information held in the st_info field.  */
+
+#define ELF32_ST_BIND(val)		(((unsigned char) (val)) >> 4)
+#define ELF32_ST_TYPE(val)		((val) & 0xf)
+#define ELF32_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+
+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field.  */
+#define ELF64_ST_BIND(val)		ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val)		ELF32_ST_TYPE (val)
+#define ELF64_ST_INFO(bind, type)	ELF32_ST_INFO ((bind), (type))
+
+/* Legal values for ST_BIND subfield of st_info (symbol binding).  */
+
+#define STB_LOCAL	0		/* Local symbol */
+#define STB_GLOBAL	1		/* Global symbol */
+#define STB_WEAK	2		/* Weak symbol */
+#define	STB_NUM		3		/* Number of defined types.  */
+#define STB_LOOS	10		/* Start of OS-specific */
+#define STB_HIOS	12		/* End of OS-specific */
+#define STB_LOPROC	13		/* Start of processor-specific */
+#define STB_HIPROC	15		/* End of processor-specific */
+
+/* Legal values for ST_TYPE subfield of st_info (symbol type).  */
+
+#define STT_NOTYPE	0		/* Symbol type is unspecified */
+#define STT_OBJECT	1		/* Symbol is a data object */
+#define STT_FUNC	2		/* Symbol is a code object */
+#define STT_SECTION	3		/* Symbol associated with a section */
+#define STT_FILE	4		/* Symbol's name is file name */
+#define STT_COMMON	5		/* Symbol is a common data object */
+#define STT_TLS		6		/* Symbol is thread-local data object*/
+#define	STT_NUM		7		/* Number of defined types.  */
+#define STT_LOOS	10		/* Start of OS-specific */
+#define STT_HIOS	12		/* End of OS-specific */
+#define STT_LOPROC	13		/* Start of processor-specific */
+#define STT_HIPROC	15		/* End of processor-specific */
+
+
+/* Symbol table indices are found in the hash buckets and chain table
+   of a symbol hash table section.  This special index value indicates
+   the end of a chain, meaning no further symbols are found in that bucket.  */
+
+#define STN_UNDEF	0		/* End of a chain.  */
+
+
+/* How to extract and insert information held in the st_other field.  */
+
+#define ELF32_ST_VISIBILITY(o)	((o) & 0x03)
+
+/* For ELF64 the definitions are the same.  */
+#define ELF64_ST_VISIBILITY(o)	ELF32_ST_VISIBILITY (o)
+
+/* Symbol visibility specification encoded in the st_other field.  */
+#define STV_DEFAULT	0		/* Default symbol visibility rules */
+#define STV_INTERNAL	1		/* Processor specific hidden class */
+#define STV_HIDDEN	2		/* Sym unavailable in other modules */
+#define STV_PROTECTED	3		/* Not preemptible, not exported */
+
+
+/* Relocation table entry without addend (in section of type SHT_REL).  */
+
+typedef struct
+{
+  Elf32_Addr	r_offset;		/* Address */
+  Elf32_Word	r_info;			/* Relocation type and symbol index */
+} Elf32_Rel;
+
+/* I have seen two different definitions of the Elf64_Rel and
+   Elf64_Rela structures, so we'll leave them out until Novell (or
+   whoever) gets their act together.  */
+/* The following, at least, is used on Sparc v9, MIPS, and Alpha.  */
+
+typedef struct
+{
+  Elf64_Addr	r_offset;		/* Address */
+  Elf64_Xword	r_info;			/* Relocation type and symbol index */
+} Elf64_Rel;
+
+/* Relocation table entry with addend (in section of type SHT_RELA).  */
+
+typedef struct
+{
+  Elf32_Addr	r_offset;		/* Address */
+  Elf32_Word	r_info;			/* Relocation type and symbol index */
+  Elf32_Sword	r_addend;		/* Addend */
+} Elf32_Rela;
+
+typedef struct
+{
+  Elf64_Addr	r_offset;		/* Address */
+  Elf64_Xword	r_info;			/* Relocation type and symbol index */
+  Elf64_Sxword	r_addend;		/* Addend */
+} Elf64_Rela;
+
+/* How to extract and insert information held in the r_info field.  */
+
+#define ELF32_R_SYM(val)		((val) >> 8)
+#define ELF32_R_TYPE(val)		((val) & 0xff)
+#define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff))
+
+#define ELF64_R_SYM(i)			((i) >> 32)
+#define ELF64_R_TYPE(i)			((i) & 0xffffffff)
+#define ELF64_R_INFO(sym,type)		((((Elf64_Xword) (sym)) << 32) + (type))
+
+/* Program segment header.  */
+
+typedef struct
+{
+  Elf32_Word	p_type;			/* Segment type */
+  Elf32_Off	p_offset;		/* Segment file offset */
+  Elf32_Addr	p_vaddr;		/* Segment virtual address */
+  Elf32_Addr	p_paddr;		/* Segment physical address */
+  Elf32_Word	p_filesz;		/* Segment size in file */
+  Elf32_Word	p_memsz;		/* Segment size in memory */
+  Elf32_Word	p_flags;		/* Segment flags */
+  Elf32_Word	p_align;		/* Segment alignment */
+} Elf32_Phdr;
+
+typedef struct
+{
+  Elf64_Word	p_type;			/* Segment type */
+  Elf64_Word	p_flags;		/* Segment flags */
+  Elf64_Off	p_offset;		/* Segment file offset */
+  Elf64_Addr	p_vaddr;		/* Segment virtual address */
+  Elf64_Addr	p_paddr;		/* Segment physical address */
+  Elf64_Xword	p_filesz;		/* Segment size in file */
+  Elf64_Xword	p_memsz;		/* Segment size in memory */
+  Elf64_Xword	p_align;		/* Segment alignment */
+} Elf64_Phdr;
+
+/* Legal values for p_type (segment type).  */
+
+#define	PT_NULL		0		/* Program header table entry unused */
+#define PT_LOAD		1		/* Loadable program segment */
+#define PT_DYNAMIC	2		/* Dynamic linking information */
+#define PT_INTERP	3		/* Program interpreter */
+#define PT_NOTE		4		/* Auxiliary information */
+#define PT_SHLIB	5		/* Reserved */
+#define PT_PHDR		6		/* Entry for header table itself */
+#define PT_TLS		7		/* Thread-local storage segment */
+#define	PT_NUM		8		/* Number of defined types */
+#define PT_LOOS		0x60000000	/* Start of OS-specific */
+#define PT_GNU_EH_FRAME	0x6474e550	/* GCC .eh_frame_hdr segment */
+#define PT_GNU_STACK	0x6474e551	/* Indicates stack executability */
+#define PT_GNU_RELRO	0x6474e552	/* Read-only after relocation */
+#define PT_LOSUNW	0x6ffffffa
+#define PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
+#define PT_SUNWSTACK	0x6ffffffb	/* Stack segment */
+#define PT_HISUNW	0x6fffffff
+#define PT_HIOS		0x6fffffff	/* End of OS-specific */
+#define PT_LOPROC	0x70000000	/* Start of processor-specific */
+#define PT_HIPROC	0x7fffffff	/* End of processor-specific */
+
+/* Legal values for p_flags (segment flags).  */
+
+#define PF_X		(1 << 0)	/* Segment is executable */
+#define PF_W		(1 << 1)	/* Segment is writable */
+#define PF_R		(1 << 2)	/* Segment is readable */
+#define PF_MASKOS	0x0ff00000	/* OS-specific */
+#define PF_MASKPROC	0xf0000000	/* Processor-specific */
+
+/* Legal values for note segment descriptor types for core files. */
+
+#define NT_PRSTATUS	1		/* Contains copy of prstatus struct */
+#define NT_FPREGSET	2		/* Contains copy of fpregset struct */
+#define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
+#define NT_PRXREG	4		/* Contains copy of prxregset struct */
+#define NT_TASKSTRUCT	4		/* Contains copy of task structure */
+#define NT_PLATFORM	5		/* String from sysinfo(SI_PLATFORM) */
+#define NT_AUXV		6		/* Contains copy of auxv array */
+#define NT_GWINDOWS	7		/* Contains copy of gwindows struct */
+#define NT_ASRS		8		/* Contains copy of asrset struct */
+#define NT_PSTATUS	10		/* Contains copy of pstatus struct */
+#define NT_PSINFO	13		/* Contains copy of psinfo struct */
+#define NT_PRCRED	14		/* Contains copy of prcred struct */
+#define NT_UTSNAME	15		/* Contains copy of utsname struct */
+#define NT_LWPSTATUS	16		/* Contains copy of lwpstatus struct */
+#define NT_LWPSINFO	17		/* Contains copy of lwpinfo struct */
+#define NT_PRFPXREG	20		/* Contains copy of fprxregset struct */
+#define NT_PRXFPREG	0x46e62b7f	/* Contains copy of user_fxsr_struct */
+#define NT_PPC_VMX	0x100		/* PowerPC Altivec/VMX registers */
+#define NT_PPC_SPE	0x101		/* PowerPC SPE/EVR registers */
+#define NT_386_TLS	0x200		/* i386 TLS slots (struct user_desc) */
+
+/* Legal values for the note segment descriptor types for object files.  */
+
+#define NT_VERSION	1		/* Contains a version string.  */
+
+
+/* Dynamic section entry.  */
+
+typedef struct
+{
+  Elf32_Sword	d_tag;			/* Dynamic entry type */
+  union
+    {
+      Elf32_Word d_val;			/* Integer value */
+      Elf32_Addr d_ptr;			/* Address value */
+    } d_un;
+} Elf32_Dyn;
+
+typedef struct
+{
+  Elf64_Sxword	d_tag;			/* Dynamic entry type */
+  union
+    {
+      Elf64_Xword d_val;		/* Integer value */
+      Elf64_Addr d_ptr;			/* Address value */
+    } d_un;
+} Elf64_Dyn;
+
+/* Legal values for d_tag (dynamic entry type).  */
+
+#define DT_NULL		0		/* Marks end of dynamic section */
+#define DT_NEEDED	1		/* Name of needed library */
+#define DT_PLTRELSZ	2		/* Size in bytes of PLT relocs */
+#define DT_PLTGOT	3		/* Processor defined value */
+#define DT_HASH		4		/* Address of symbol hash table */
+#define DT_STRTAB	5		/* Address of string table */
+#define DT_SYMTAB	6		/* Address of symbol table */
+#define DT_RELA		7		/* Address of Rela relocs */
+#define DT_RELASZ	8		/* Total size of Rela relocs */
+#define DT_RELAENT	9		/* Size of one Rela reloc */
+#define DT_STRSZ	10		/* Size of string table */
+#define DT_SYMENT	11		/* Size of one symbol table entry */
+#define DT_INIT		12		/* Address of init function */
+#define DT_FINI		13		/* Address of termination function */
+#define DT_SONAME	14		/* Name of shared object */
+#define DT_RPATH	15		/* Library search path (deprecated) */
+#define DT_SYMBOLIC	16		/* Start symbol search here */
+#define DT_REL		17		/* Address of Rel relocs */
+#define DT_RELSZ	18		/* Total size of Rel relocs */
+#define DT_RELENT	19		/* Size of one Rel reloc */
+#define DT_PLTREL	20		/* Type of reloc in PLT */
+#define DT_DEBUG	21		/* For debugging; unspecified */
+#define DT_TEXTREL	22		/* Reloc might modify .text */
+#define DT_JMPREL	23		/* Address of PLT relocs */
+#define	DT_BIND_NOW	24		/* Process relocations of object */
+#define	DT_INIT_ARRAY	25		/* Array with addresses of init fct */
+#define	DT_FINI_ARRAY	26		/* Array with addresses of fini fct */
+#define	DT_INIT_ARRAYSZ	27		/* Size in bytes of DT_INIT_ARRAY */
+#define	DT_FINI_ARRAYSZ	28		/* Size in bytes of DT_FINI_ARRAY */
+#define DT_RUNPATH	29		/* Library search path */
+#define DT_FLAGS	30		/* Flags for the object being loaded */
+#define DT_ENCODING	32		/* Start of encoded range */
+#define DT_PREINIT_ARRAY 32		/* Array with addresses of preinit fct*/
+#define DT_PREINIT_ARRAYSZ 33		/* size in bytes of DT_PREINIT_ARRAY */
+#define	DT_NUM		34		/* Number used */
+#define DT_LOOS		0x6000000d	/* Start of OS-specific */
+#define DT_HIOS		0x6ffff000	/* End of OS-specific */
+#define DT_LOPROC	0x70000000	/* Start of processor-specific */
+#define DT_HIPROC	0x7fffffff	/* End of processor-specific */
+#define	DT_PROCNUM	DT_MIPS_NUM	/* Most used by any processor */
+
+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+   Dyn.d_un.d_val field of the Elf*_Dyn structure.  This follows Sun's
+   approach.  */
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5	/* Prelinking timestamp */
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6	/* Size of conflict section */
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7	/* Size of library list */
+#define DT_CHECKSUM	0x6ffffdf8
+#define DT_PLTPADSZ	0x6ffffdf9
+#define DT_MOVEENT	0x6ffffdfa
+#define DT_MOVESZ	0x6ffffdfb
+#define DT_FEATURE_1	0x6ffffdfc	/* Feature selection (DTF_*).  */
+#define DT_POSFLAG_1	0x6ffffdfd	/* Flags for DT_* entries, effecting
+					   the following DT_* entry.  */
+#define DT_SYMINSZ	0x6ffffdfe	/* Size of syminfo table (in bytes) */
+#define DT_SYMINENT	0x6ffffdff	/* Entry size of syminfo */
+#define DT_VALRNGHI	0x6ffffdff
+#define DT_VALTAGIDX(tag)	(DT_VALRNGHI - (tag))	/* Reverse order! */
+#define DT_VALNUM 12
+
+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+   Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+
+   If any adjustment is made to the ELF object after it has been
+   built these entries will need to be adjusted.  */
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_GNU_HASH	0x6ffffef5	/* GNU-style hash table.  */
+#define DT_TLSDESC_PLT	0x6ffffef6
+#define DT_TLSDESC_GOT	0x6ffffef7
+#define DT_GNU_CONFLICT	0x6ffffef8	/* Start of conflict section */
+#define DT_GNU_LIBLIST	0x6ffffef9	/* Library list */
+#define DT_CONFIG	0x6ffffefa	/* Configuration information.  */
+#define DT_DEPAUDIT	0x6ffffefb	/* Dependency auditing.  */
+#define DT_AUDIT	0x6ffffefc	/* Object auditing.  */
+#define	DT_PLTPAD	0x6ffffefd	/* PLT padding.  */
+#define	DT_MOVETAB	0x6ffffefe	/* Move table.  */
+#define DT_SYMINFO	0x6ffffeff	/* Syminfo table.  */
+#define DT_ADDRRNGHI	0x6ffffeff
+#define DT_ADDRTAGIDX(tag)	(DT_ADDRRNGHI - (tag))	/* Reverse order! */
+#define DT_ADDRNUM 11
+
+/* The versioning entry types.  The next are defined as part of the
+   GNU extension.  */
+#define DT_VERSYM	0x6ffffff0
+
+#define DT_RELACOUNT	0x6ffffff9
+#define DT_RELCOUNT	0x6ffffffa
+
+/* These were chosen by Sun.  */
+#define DT_FLAGS_1	0x6ffffffb	/* State flags, see DF_1_* below.  */
+#define	DT_VERDEF	0x6ffffffc	/* Address of version definition
+					   table */
+#define	DT_VERDEFNUM	0x6ffffffd	/* Number of version definitions */
+#define	DT_VERNEED	0x6ffffffe	/* Address of table with needed
+					   versions */
+#define	DT_VERNEEDNUM	0x6fffffff	/* Number of needed versions */
+#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))	/* Reverse order! */
+#define DT_VERSIONTAGNUM 16
+
+/* Sun added these machine-independent extensions in the "processor-specific"
+   range.  Be compatible.  */
+#define DT_AUXILIARY    0x7ffffffd      /* Shared object to load before self */
+#define DT_FILTER       0x7fffffff      /* Shared object to get values from */
+#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
+#define DT_EXTRANUM	3
+
+/* Values of `d_un.d_val' in the DT_FLAGS entry.  */
+#define DF_ORIGIN	0x00000001	/* Object may use DF_ORIGIN */
+#define DF_SYMBOLIC	0x00000002	/* Symbol resolutions starts here */
+#define DF_TEXTREL	0x00000004	/* Object contains text relocations */
+#define DF_BIND_NOW	0x00000008	/* No lazy binding for this object */
+#define DF_STATIC_TLS	0x00000010	/* Module uses the static TLS model */
+
+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
+   entry in the dynamic section.  */
+#define DF_1_NOW	0x00000001	/* Set RTLD_NOW for this object.  */
+#define DF_1_GLOBAL	0x00000002	/* Set RTLD_GLOBAL for this object.  */
+#define DF_1_GROUP	0x00000004	/* Set RTLD_GROUP for this object.  */
+#define DF_1_NODELETE	0x00000008	/* Set RTLD_NODELETE for this object.*/
+#define DF_1_LOADFLTR	0x00000010	/* Trigger filtee loading at runtime.*/
+#define DF_1_INITFIRST	0x00000020	/* Set RTLD_INITFIRST for this object*/
+#define DF_1_NOOPEN	0x00000040	/* Set RTLD_NOOPEN for this object.  */
+#define DF_1_ORIGIN	0x00000080	/* $ORIGIN must be handled.  */
+#define DF_1_DIRECT	0x00000100	/* Direct binding enabled.  */
+#define DF_1_TRANS	0x00000200
+#define DF_1_INTERPOSE	0x00000400	/* Object is used to interpose.  */
+#define DF_1_NODEFLIB	0x00000800	/* Ignore default lib search path.  */
+#define DF_1_NODUMP	0x00001000	/* Object can't be dldump'ed.  */
+#define DF_1_CONFALT	0x00002000	/* Configuration alternative created.*/
+#define DF_1_ENDFILTEE	0x00004000	/* Filtee terminates filters search. */
+#define	DF_1_DISPRELDNE	0x00008000	/* Disp reloc applied at build time. */
+#define	DF_1_DISPRELPND	0x00010000	/* Disp reloc applied at run-time.  */
+
+/* Flags for the feature selection in DT_FEATURE_1.  */
+#define DTF_1_PARINIT	0x00000001
+#define DTF_1_CONFEXP	0x00000002
+
+/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry.  */
+#define DF_P1_LAZYLOAD	0x00000001	/* Lazyload following object.  */
+#define DF_P1_GROUPPERM	0x00000002	/* Symbols from next object are not
+					   generally available.  */
+
+/* Version definition sections.  */
+
+typedef struct
+{
+  Elf32_Half	vd_version;		/* Version revision */
+  Elf32_Half	vd_flags;		/* Version information */
+  Elf32_Half	vd_ndx;			/* Version Index */
+  Elf32_Half	vd_cnt;			/* Number of associated aux entries */
+  Elf32_Word	vd_hash;		/* Version name hash value */
+  Elf32_Word	vd_aux;			/* Offset in bytes to verdaux array */
+  Elf32_Word	vd_next;		/* Offset in bytes to next verdef
+					   entry */
+} Elf32_Verdef;
+
+typedef struct
+{
+  Elf64_Half	vd_version;		/* Version revision */
+  Elf64_Half	vd_flags;		/* Version information */
+  Elf64_Half	vd_ndx;			/* Version Index */
+  Elf64_Half	vd_cnt;			/* Number of associated aux entries */
+  Elf64_Word	vd_hash;		/* Version name hash value */
+  Elf64_Word	vd_aux;			/* Offset in bytes to verdaux array */
+  Elf64_Word	vd_next;		/* Offset in bytes to next verdef
+					   entry */
+} Elf64_Verdef;
+
+
+/* Legal values for vd_version (version revision).  */
+#define VER_DEF_NONE	0		/* No version */
+#define VER_DEF_CURRENT	1		/* Current version */
+#define VER_DEF_NUM	2		/* Given version number */
+
+/* Legal values for vd_flags (version information flags).  */
+#define VER_FLG_BASE	0x1		/* Version definition of file itself */
+#define VER_FLG_WEAK	0x2		/* Weak version identifier */
+
+/* Versym symbol index values.  */
+#define	VER_NDX_LOCAL		0	/* Symbol is local.  */
+#define	VER_NDX_GLOBAL		1	/* Symbol is global.  */
+#define	VER_NDX_LORESERVE	0xff00	/* Beginning of reserved entries.  */
+#define	VER_NDX_ELIMINATE	0xff01	/* Symbol is to be eliminated.  */
+
+/* Auxialiary version information.  */
+
+typedef struct
+{
+  Elf32_Word	vda_name;		/* Version or dependency names */
+  Elf32_Word	vda_next;		/* Offset in bytes to next verdaux
+					   entry */
+} Elf32_Verdaux;
+
+typedef struct
+{
+  Elf64_Word	vda_name;		/* Version or dependency names */
+  Elf64_Word	vda_next;		/* Offset in bytes to next verdaux
+					   entry */
+} Elf64_Verdaux;
+
+
+/* Version dependency section.  */
+
+typedef struct
+{
+  Elf32_Half	vn_version;		/* Version of structure */
+  Elf32_Half	vn_cnt;			/* Number of associated aux entries */
+  Elf32_Word	vn_file;		/* Offset of filename for this
+					   dependency */
+  Elf32_Word	vn_aux;			/* Offset in bytes to vernaux array */
+  Elf32_Word	vn_next;		/* Offset in bytes to next verneed
+					   entry */
+} Elf32_Verneed;
+
+typedef struct
+{
+  Elf64_Half	vn_version;		/* Version of structure */
+  Elf64_Half	vn_cnt;			/* Number of associated aux entries */
+  Elf64_Word	vn_file;		/* Offset of filename for this
+					   dependency */
+  Elf64_Word	vn_aux;			/* Offset in bytes to vernaux array */
+  Elf64_Word	vn_next;		/* Offset in bytes to next verneed
+					   entry */
+} Elf64_Verneed;
+
+
+/* Legal values for vn_version (version revision).  */
+#define VER_NEED_NONE	 0		/* No version */
+#define VER_NEED_CURRENT 1		/* Current version */
+#define VER_NEED_NUM	 2		/* Given version number */
+
+/* Auxiliary needed version information.  */
+
+typedef struct
+{
+  Elf32_Word	vna_hash;		/* Hash value of dependency name */
+  Elf32_Half	vna_flags;		/* Dependency specific information */
+  Elf32_Half	vna_other;		/* Unused */
+  Elf32_Word	vna_name;		/* Dependency name string offset */
+  Elf32_Word	vna_next;		/* Offset in bytes to next vernaux
+					   entry */
+} Elf32_Vernaux;
+
+typedef struct
+{
+  Elf64_Word	vna_hash;		/* Hash value of dependency name */
+  Elf64_Half	vna_flags;		/* Dependency specific information */
+  Elf64_Half	vna_other;		/* Unused */
+  Elf64_Word	vna_name;		/* Dependency name string offset */
+  Elf64_Word	vna_next;		/* Offset in bytes to next vernaux
+					   entry */
+} Elf64_Vernaux;
+
+
+/* Legal values for vna_flags.  */
+#define VER_FLG_WEAK	0x2		/* Weak version identifier */
+
+
+/* Auxiliary vector.  */
+
+/* This vector is normally only used by the program interpreter.  The
+   usual definition in an ABI supplement uses the name auxv_t.  The
+   vector is not usually defined in a standard <elf.h> file, but it
+   can't hurt.  We rename it to avoid conflicts.  The sizes of these
+   types are an arrangement between the exec server and the program
+   interpreter, so we don't fully specify them here.  */
+
+typedef struct
+{
+  uint32_t a_type;		/* Entry type */
+  union
+    {
+      uint32_t a_val;		/* Integer value */
+      /* We use to have pointer elements added here.  We cannot do that,
+	 though, since it does not work when using 32-bit definitions
+	 on 64-bit platforms and vice versa.  */
+    } a_un;
+} Elf32_auxv_t;
+
+typedef struct
+{
+  uint64_t a_type;		/* Entry type */
+  union
+    {
+      uint64_t a_val;		/* Integer value */
+      /* We use to have pointer elements added here.  We cannot do that,
+	 though, since it does not work when using 32-bit definitions
+	 on 64-bit platforms and vice versa.  */
+    } a_un;
+} Elf64_auxv_t;
+
+/* Legal values for a_type (entry type).  */
+
+#define AT_NULL		0		/* End of vector */
+#define AT_IGNORE	1		/* Entry should be ignored */
+#define AT_EXECFD	2		/* File descriptor of program */
+#define AT_PHDR		3		/* Program headers for program */
+#define AT_PHENT	4		/* Size of program header entry */
+#define AT_PHNUM	5		/* Number of program headers */
+#define AT_PAGESZ	6		/* System page size */
+#define AT_BASE		7		/* Base address of interpreter */
+#define AT_FLAGS	8		/* Flags */
+#define AT_ENTRY	9		/* Entry point of program */
+#define AT_NOTELF	10		/* Program is not ELF */
+#define AT_UID		11		/* Real uid */
+#define AT_EUID		12		/* Effective uid */
+#define AT_GID		13		/* Real gid */
+#define AT_EGID		14		/* Effective gid */
+#define AT_CLKTCK	17		/* Frequency of times() */
+
+/* Some more special a_type values describing the hardware.  */
+#define AT_PLATFORM	15		/* String identifying platform.  */
+#define AT_HWCAP	16		/* Machine dependent hints about
+					   processor capabilities.  */
+
+/* This entry gives some information about the FPU initialization
+   performed by the kernel.  */
+#define AT_FPUCW	18		/* Used FPU control word.  */
+
+/* Cache block sizes.  */
+#define AT_DCACHEBSIZE	19		/* Data cache block size.  */
+#define AT_ICACHEBSIZE	20		/* Instruction cache block size.  */
+#define AT_UCACHEBSIZE	21		/* Unified cache block size.  */
+
+/* A special ignored value for PPC, used by the kernel to control the
+   interpretation of the AUXV. Must be > 16.  */
+#define AT_IGNOREPPC	22		/* Entry should be ignored.  */
+
+#define	AT_SECURE	23		/* Boolean, was exec setuid-like?  */
+
+#define AT_EXECFN	31		/* Filename of executable.  */
+
+/* Pointer to the global system page used for system calls and other
+   nice things.  */
+#define AT_SYSINFO	32
+#define AT_SYSINFO_EHDR	33
+
+/* Shapes of the caches.  Bits 0-3 contains associativity; bits 4-7 contains
+   log2 of line size; mask those to get cache size.  */
+#define AT_L1I_CACHESHAPE	34
+#define AT_L1D_CACHESHAPE	35
+#define AT_L2_CACHESHAPE	36
+#define AT_L3_CACHESHAPE	37
+
+/* Note section contents.  Each entry in the note section begins with
+   a header of a fixed form.  */
+
+typedef struct
+{
+  Elf32_Word n_namesz;			/* Length of the note's name.  */
+  Elf32_Word n_descsz;			/* Length of the note's descriptor.  */
+  Elf32_Word n_type;			/* Type of the note.  */
+} Elf32_Nhdr;
+
+typedef struct
+{
+  Elf64_Word n_namesz;			/* Length of the note's name.  */
+  Elf64_Word n_descsz;			/* Length of the note's descriptor.  */
+  Elf64_Word n_type;			/* Type of the note.  */
+} Elf64_Nhdr;
+
+/* Known names of notes.  */
+
+/* Solaris entries in the note section have this name.  */
+#define ELF_NOTE_SOLARIS	"SUNW Solaris"
+
+/* Note entries for GNU systems have this name.  */
+#define ELF_NOTE_GNU		"GNU"
+
+
+/* Defined types of notes for Solaris.  */
+
+/* Value of descriptor (one word) is desired pagesize for the binary.  */
+#define ELF_NOTE_PAGESIZE_HINT	1
+
+
+/* Defined note types for GNU systems.  */
+
+/* ABI information.  The descriptor consists of words:
+   word 0: OS descriptor
+   word 1: major version of the ABI
+   word 2: minor version of the ABI
+   word 3: subminor version of the ABI
+*/
+#define NT_GNU_ABI_TAG	1
+#define ELF_NOTE_ABI	NT_GNU_ABI_TAG /* Old name.  */
+
+/* Known OSes.  These values can appear in word 0 of an
+   NT_GNU_ABI_TAG note section entry.  */
+#define ELF_NOTE_OS_LINUX	0
+#define ELF_NOTE_OS_GNU		1
+#define ELF_NOTE_OS_SOLARIS2	2
+#define ELF_NOTE_OS_FREEBSD	3
+
+/* Synthetic hwcap information.  The descriptor begins with two words:
+   word 0: number of entries
+   word 1: bitmask of enabled entries
+   Then follow variable-length entries, one byte followed by a
+   '\0'-terminated hwcap name string.  The byte gives the bit
+   number to test if enabled, (1U << bit) & bitmask.  */
+#define NT_GNU_HWCAP	2
+
+/* Build ID bits as generated by ld --build-id.
+   The descriptor consists of any nonzero number of bytes.  */
+#define NT_GNU_BUILD_ID	3
+
+
+/* Move records.  */
+typedef struct
+{
+  Elf32_Xword m_value;		/* Symbol value.  */
+  Elf32_Word m_info;		/* Size and index.  */
+  Elf32_Word m_poffset;		/* Symbol offset.  */
+  Elf32_Half m_repeat;		/* Repeat count.  */
+  Elf32_Half m_stride;		/* Stride info.  */
+} Elf32_Move;
+
+typedef struct
+{
+  Elf64_Xword m_value;		/* Symbol value.  */
+  Elf64_Xword m_info;		/* Size and index.  */
+  Elf64_Xword m_poffset;	/* Symbol offset.  */
+  Elf64_Half m_repeat;		/* Repeat count.  */
+  Elf64_Half m_stride;		/* Stride info.  */
+} Elf64_Move;
+
+/* Macro to construct move records.  */
+#define ELF32_M_SYM(info)	((info) >> 8)
+#define ELF32_M_SIZE(info)	((unsigned char) (info))
+#define ELF32_M_INFO(sym, size)	(((sym) << 8) + (unsigned char) (size))
+
+#define ELF64_M_SYM(info)	ELF32_M_SYM (info)
+#define ELF64_M_SIZE(info)	ELF32_M_SIZE (info)
+#define ELF64_M_INFO(sym, size)	ELF32_M_INFO (sym, size)
+
+
+/* Motorola 68k specific definitions.  */
+
+/* Values for Elf32_Ehdr.e_flags.  */
+#define EF_CPU32	0x00810000
+
+/* m68k relocs.  */
+
+#define R_68K_NONE	0		/* No reloc */
+#define R_68K_32	1		/* Direct 32 bit  */
+#define R_68K_16	2		/* Direct 16 bit  */
+#define R_68K_8		3		/* Direct 8 bit  */
+#define R_68K_PC32	4		/* PC relative 32 bit */
+#define R_68K_PC16	5		/* PC relative 16 bit */
+#define R_68K_PC8	6		/* PC relative 8 bit */
+#define R_68K_GOT32	7		/* 32 bit PC relative GOT entry */
+#define R_68K_GOT16	8		/* 16 bit PC relative GOT entry */
+#define R_68K_GOT8	9		/* 8 bit PC relative GOT entry */
+#define R_68K_GOT32O	10		/* 32 bit GOT offset */
+#define R_68K_GOT16O	11		/* 16 bit GOT offset */
+#define R_68K_GOT8O	12		/* 8 bit GOT offset */
+#define R_68K_PLT32	13		/* 32 bit PC relative PLT address */
+#define R_68K_PLT16	14		/* 16 bit PC relative PLT address */
+#define R_68K_PLT8	15		/* 8 bit PC relative PLT address */
+#define R_68K_PLT32O	16		/* 32 bit PLT offset */
+#define R_68K_PLT16O	17		/* 16 bit PLT offset */
+#define R_68K_PLT8O	18		/* 8 bit PLT offset */
+#define R_68K_COPY	19		/* Copy symbol at runtime */
+#define R_68K_GLOB_DAT	20		/* Create GOT entry */
+#define R_68K_JMP_SLOT	21		/* Create PLT entry */
+#define R_68K_RELATIVE	22		/* Adjust by program base */
+/* Keep this the last entry.  */
+#define R_68K_NUM	23
+
+/* Intel 80386 specific definitions.  */
+
+/* i386 relocs.  */
+
+#define R_386_NONE	   0		/* No reloc */
+#define R_386_32	   1		/* Direct 32 bit  */
+#define R_386_PC32	   2		/* PC relative 32 bit */
+#define R_386_GOT32	   3		/* 32 bit GOT entry */
+#define R_386_PLT32	   4		/* 32 bit PLT address */
+#define R_386_COPY	   5		/* Copy symbol at runtime */
+#define R_386_GLOB_DAT	   6		/* Create GOT entry */
+#define R_386_JMP_SLOT	   7		/* Create PLT entry */
+#define R_386_RELATIVE	   8		/* Adjust by program base */
+#define R_386_GOTOFF	   9		/* 32 bit offset to GOT */
+#define R_386_GOTPC	   10		/* 32 bit PC relative offset to GOT */
+#define R_386_32PLT	   11
+#define R_386_TLS_TPOFF	   14		/* Offset in static TLS block */
+#define R_386_TLS_IE	   15		/* Address of GOT entry for static TLS
+					   block offset */
+#define R_386_TLS_GOTIE	   16		/* GOT entry for static TLS block
+					   offset */
+#define R_386_TLS_LE	   17		/* Offset relative to static TLS
+					   block */
+#define R_386_TLS_GD	   18		/* Direct 32 bit for GNU version of
+					   general dynamic thread local data */
+#define R_386_TLS_LDM	   19		/* Direct 32 bit for GNU version of
+					   local dynamic thread local data
+					   in LE code */
+#define R_386_16	   20
+#define R_386_PC16	   21
+#define R_386_8		   22
+#define R_386_PC8	   23
+#define R_386_TLS_GD_32	   24		/* Direct 32 bit for general dynamic
+					   thread local data */
+#define R_386_TLS_GD_PUSH  25		/* Tag for pushl in GD TLS code */
+#define R_386_TLS_GD_CALL  26		/* Relocation for call to
+					   __tls_get_addr() */
+#define R_386_TLS_GD_POP   27		/* Tag for popl in GD TLS code */
+#define R_386_TLS_LDM_32   28		/* Direct 32 bit for local dynamic
+					   thread local data in LE code */
+#define R_386_TLS_LDM_PUSH 29		/* Tag for pushl in LDM TLS code */
+#define R_386_TLS_LDM_CALL 30		/* Relocation for call to
+					   __tls_get_addr() in LDM code */
+#define R_386_TLS_LDM_POP  31		/* Tag for popl in LDM TLS code */
+#define R_386_TLS_LDO_32   32		/* Offset relative to TLS block */
+#define R_386_TLS_IE_32	   33		/* GOT entry for negated static TLS
+					   block offset */
+#define R_386_TLS_LE_32	   34		/* Negated offset relative to static
+					   TLS block */
+#define R_386_TLS_DTPMOD32 35		/* ID of module containing symbol */
+#define R_386_TLS_DTPOFF32 36		/* Offset in TLS block */
+#define R_386_TLS_TPOFF32  37		/* Negated offset in static TLS block */
+/* 38? */
+#define R_386_TLS_GOTDESC  39		/* GOT offset for TLS descriptor.  */
+#define R_386_TLS_DESC_CALL 40		/* Marker of call through TLS
+					   descriptor for
+					   relaxation.  */
+#define R_386_TLS_DESC     41		/* TLS descriptor containing
+					   pointer to code and to
+					   argument, returning the TLS
+					   offset for the symbol.  */
+/* Keep this the last entry.  */
+#define R_386_NUM	   42
+
+/* SUN SPARC specific definitions.  */
+
+/* Legal values for ST_TYPE subfield of st_info (symbol type).  */
+
+#define STT_SPARC_REGISTER	13	/* Global register reserved to app. */
+
+/* Values for Elf64_Ehdr.e_flags.  */
+
+#define EF_SPARCV9_MM		3
+#define EF_SPARCV9_TSO		0
+#define EF_SPARCV9_PSO		1
+#define EF_SPARCV9_RMO		2
+#define EF_SPARC_LEDATA		0x800000 /* little endian data */
+#define EF_SPARC_EXT_MASK	0xFFFF00
+#define EF_SPARC_32PLUS		0x000100 /* generic V8+ features */
+#define EF_SPARC_SUN_US1	0x000200 /* Sun UltraSPARC1 extensions */
+#define EF_SPARC_HAL_R1		0x000400 /* HAL R1 extensions */
+#define EF_SPARC_SUN_US3	0x000800 /* Sun UltraSPARCIII extensions */
+
+/* SPARC relocs.  */
+
+#define R_SPARC_NONE		0	/* No reloc */
+#define R_SPARC_8		1	/* Direct 8 bit */
+#define R_SPARC_16		2	/* Direct 16 bit */
+#define R_SPARC_32		3	/* Direct 32 bit */
+#define R_SPARC_DISP8		4	/* PC relative 8 bit */
+#define R_SPARC_DISP16		5	/* PC relative 16 bit */
+#define R_SPARC_DISP32		6	/* PC relative 32 bit */
+#define R_SPARC_WDISP30		7	/* PC relative 30 bit shifted */
+#define R_SPARC_WDISP22		8	/* PC relative 22 bit shifted */
+#define R_SPARC_HI22		9	/* High 22 bit */
+#define R_SPARC_22		10	/* Direct 22 bit */
+#define R_SPARC_13		11	/* Direct 13 bit */
+#define R_SPARC_LO10		12	/* Truncated 10 bit */
+#define R_SPARC_GOT10		13	/* Truncated 10 bit GOT entry */
+#define R_SPARC_GOT13		14	/* 13 bit GOT entry */
+#define R_SPARC_GOT22		15	/* 22 bit GOT entry shifted */
+#define R_SPARC_PC10		16	/* PC relative 10 bit truncated */
+#define R_SPARC_PC22		17	/* PC relative 22 bit shifted */
+#define R_SPARC_WPLT30		18	/* 30 bit PC relative PLT address */
+#define R_SPARC_COPY		19	/* Copy symbol at runtime */
+#define R_SPARC_GLOB_DAT	20	/* Create GOT entry */
+#define R_SPARC_JMP_SLOT	21	/* Create PLT entry */
+#define R_SPARC_RELATIVE	22	/* Adjust by program base */
+#define R_SPARC_UA32		23	/* Direct 32 bit unaligned */
+
+/* Additional Sparc64 relocs.  */
+
+#define R_SPARC_PLT32		24	/* Direct 32 bit ref to PLT entry */
+#define R_SPARC_HIPLT22		25	/* High 22 bit PLT entry */
+#define R_SPARC_LOPLT10		26	/* Truncated 10 bit PLT entry */
+#define R_SPARC_PCPLT32		27	/* PC rel 32 bit ref to PLT entry */
+#define R_SPARC_PCPLT22		28	/* PC rel high 22 bit PLT entry */
+#define R_SPARC_PCPLT10		29	/* PC rel trunc 10 bit PLT entry */
+#define R_SPARC_10		30	/* Direct 10 bit */
+#define R_SPARC_11		31	/* Direct 11 bit */
+#define R_SPARC_64		32	/* Direct 64 bit */
+#define R_SPARC_OLO10		33	/* 10bit with secondary 13bit addend */
+#define R_SPARC_HH22		34	/* Top 22 bits of direct 64 bit */
+#define R_SPARC_HM10		35	/* High middle 10 bits of ... */
+#define R_SPARC_LM22		36	/* Low middle 22 bits of ... */
+#define R_SPARC_PC_HH22		37	/* Top 22 bits of pc rel 64 bit */
+#define R_SPARC_PC_HM10		38	/* High middle 10 bit of ... */
+#define R_SPARC_PC_LM22		39	/* Low miggle 22 bits of ... */
+#define R_SPARC_WDISP16		40	/* PC relative 16 bit shifted */
+#define R_SPARC_WDISP19		41	/* PC relative 19 bit shifted */
+#define R_SPARC_7		43	/* Direct 7 bit */
+#define R_SPARC_5		44	/* Direct 5 bit */
+#define R_SPARC_6		45	/* Direct 6 bit */
+#define R_SPARC_DISP64		46	/* PC relative 64 bit */
+#define R_SPARC_PLT64		47	/* Direct 64 bit ref to PLT entry */
+#define R_SPARC_HIX22		48	/* High 22 bit complemented */
+#define R_SPARC_LOX10		49	/* Truncated 11 bit complemented */
+#define R_SPARC_H44		50	/* Direct high 12 of 44 bit */
+#define R_SPARC_M44		51	/* Direct mid 22 of 44 bit */
+#define R_SPARC_L44		52	/* Direct low 10 of 44 bit */
+#define R_SPARC_REGISTER	53	/* Global register usage */
+#define R_SPARC_UA64		54	/* Direct 64 bit unaligned */
+#define R_SPARC_UA16		55	/* Direct 16 bit unaligned */
+#define R_SPARC_TLS_GD_HI22	56
+#define R_SPARC_TLS_GD_LO10	57
+#define R_SPARC_TLS_GD_ADD	58
+#define R_SPARC_TLS_GD_CALL	59
+#define R_SPARC_TLS_LDM_HI22	60
+#define R_SPARC_TLS_LDM_LO10	61
+#define R_SPARC_TLS_LDM_ADD	62
+#define R_SPARC_TLS_LDM_CALL	63
+#define R_SPARC_TLS_LDO_HIX22	64
+#define R_SPARC_TLS_LDO_LOX10	65
+#define R_SPARC_TLS_LDO_ADD	66
+#define R_SPARC_TLS_IE_HI22	67
+#define R_SPARC_TLS_IE_LO10	68
+#define R_SPARC_TLS_IE_LD	69
+#define R_SPARC_TLS_IE_LDX	70
+#define R_SPARC_TLS_IE_ADD	71
+#define R_SPARC_TLS_LE_HIX22	72
+#define R_SPARC_TLS_LE_LOX10	73
+#define R_SPARC_TLS_DTPMOD32	74
+#define R_SPARC_TLS_DTPMOD64	75
+#define R_SPARC_TLS_DTPOFF32	76
+#define R_SPARC_TLS_DTPOFF64	77
+#define R_SPARC_TLS_TPOFF32	78
+#define R_SPARC_TLS_TPOFF64	79
+/* Keep this the last entry.  */
+#define R_SPARC_NUM		80
+
+/* For Sparc64, legal values for d_tag of Elf64_Dyn.  */
+
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_SPARC_NUM	2
+
+/* Bits present in AT_HWCAP on SPARC.  */
+
+#define HWCAP_SPARC_FLUSH	1	/* The CPU supports flush insn.  */
+#define HWCAP_SPARC_STBAR	2
+#define HWCAP_SPARC_SWAP	4
+#define HWCAP_SPARC_MULDIV	8
+#define HWCAP_SPARC_V9		16	/* The CPU is v9, so v8plus is ok.  */
+#define HWCAP_SPARC_ULTRA3	32
+#define HWCAP_SPARC_BLKINIT	64	/* Sun4v with block-init/load-twin.  */
+#define HWCAP_SPARC_N2		128
+
+/* MIPS R3000 specific definitions.  */
+
+/* Legal values for e_flags field of Elf32_Ehdr.  */
+
+#define EF_MIPS_NOREORDER   1		/* A .noreorder directive was used */
+#define EF_MIPS_PIC	    2		/* Contains PIC code */
+#define EF_MIPS_CPIC	    4		/* Uses PIC calling sequence */
+#define EF_MIPS_XGOT	    8
+#define EF_MIPS_64BIT_WHIRL 16
+#define EF_MIPS_ABI2	    32
+#define EF_MIPS_ABI_ON32    64
+#define EF_MIPS_ARCH	    0xf0000000	/* MIPS architecture level */
+
+/* Legal values for MIPS architecture level.  */
+
+#define EF_MIPS_ARCH_1	    0x00000000	/* -mips1 code.  */
+#define EF_MIPS_ARCH_2	    0x10000000	/* -mips2 code.  */
+#define EF_MIPS_ARCH_3	    0x20000000	/* -mips3 code.  */
+#define EF_MIPS_ARCH_4	    0x30000000	/* -mips4 code.  */
+#define EF_MIPS_ARCH_5	    0x40000000	/* -mips5 code.  */
+#define EF_MIPS_ARCH_32	    0x60000000	/* MIPS32 code.  */
+#define EF_MIPS_ARCH_64	    0x70000000	/* MIPS64 code.  */
+
+/* The following are non-official names and should not be used.  */
+
+#define E_MIPS_ARCH_1	  0x00000000	/* -mips1 code.  */
+#define E_MIPS_ARCH_2	  0x10000000	/* -mips2 code.  */
+#define E_MIPS_ARCH_3	  0x20000000	/* -mips3 code.  */
+#define E_MIPS_ARCH_4	  0x30000000	/* -mips4 code.  */
+#define E_MIPS_ARCH_5	  0x40000000	/* -mips5 code.  */
+#define E_MIPS_ARCH_32	  0x60000000	/* MIPS32 code.  */
+#define E_MIPS_ARCH_64	  0x70000000	/* MIPS64 code.  */
+
+/* Special section indices.  */
+
+#define SHN_MIPS_ACOMMON    0xff00	/* Allocated common symbols */
+#define SHN_MIPS_TEXT	    0xff01	/* Allocated test symbols.  */
+#define SHN_MIPS_DATA	    0xff02	/* Allocated data symbols.  */
+#define SHN_MIPS_SCOMMON    0xff03	/* Small common symbols */
+#define SHN_MIPS_SUNDEFINED 0xff04	/* Small undefined symbols */
+
+/* Legal values for sh_type field of Elf32_Shdr.  */
+
+#define SHT_MIPS_LIBLIST       0x70000000 /* Shared objects used in link */
+#define SHT_MIPS_MSYM	       0x70000001
+#define SHT_MIPS_CONFLICT      0x70000002 /* Conflicting symbols */
+#define SHT_MIPS_GPTAB	       0x70000003 /* Global data area sizes */
+#define SHT_MIPS_UCODE	       0x70000004 /* Reserved for SGI/MIPS compilers */
+#define SHT_MIPS_DEBUG	       0x70000005 /* MIPS ECOFF debugging information*/
+#define SHT_MIPS_REGINFO       0x70000006 /* Register usage information */
+#define SHT_MIPS_PACKAGE       0x70000007
+#define SHT_MIPS_PACKSYM       0x70000008
+#define SHT_MIPS_RELD	       0x70000009
+#define SHT_MIPS_IFACE         0x7000000b
+#define SHT_MIPS_CONTENT       0x7000000c
+#define SHT_MIPS_OPTIONS       0x7000000d /* Miscellaneous options.  */
+#define SHT_MIPS_SHDR	       0x70000010
+#define SHT_MIPS_FDESC	       0x70000011
+#define SHT_MIPS_EXTSYM	       0x70000012
+#define SHT_MIPS_DENSE	       0x70000013
+#define SHT_MIPS_PDESC	       0x70000014
+#define SHT_MIPS_LOCSYM	       0x70000015
+#define SHT_MIPS_AUXSYM	       0x70000016
+#define SHT_MIPS_OPTSYM	       0x70000017
+#define SHT_MIPS_LOCSTR	       0x70000018
+#define SHT_MIPS_LINE	       0x70000019
+#define SHT_MIPS_RFDESC	       0x7000001a
+#define SHT_MIPS_DELTASYM      0x7000001b
+#define SHT_MIPS_DELTAINST     0x7000001c
+#define SHT_MIPS_DELTACLASS    0x7000001d
+#define SHT_MIPS_DWARF         0x7000001e /* DWARF debugging information.  */
+#define SHT_MIPS_DELTADECL     0x7000001f
+#define SHT_MIPS_SYMBOL_LIB    0x70000020
+#define SHT_MIPS_EVENTS	       0x70000021 /* Event section.  */
+#define SHT_MIPS_TRANSLATE     0x70000022
+#define SHT_MIPS_PIXIE	       0x70000023
+#define SHT_MIPS_XLATE	       0x70000024
+#define SHT_MIPS_XLATE_DEBUG   0x70000025
+#define SHT_MIPS_WHIRL	       0x70000026
+#define SHT_MIPS_EH_REGION     0x70000027
+#define SHT_MIPS_XLATE_OLD     0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+
+/* Legal values for sh_flags field of Elf32_Shdr.  */
+
+#define SHF_MIPS_GPREL	 0x10000000	/* Must be part of global data area */
+#define SHF_MIPS_MERGE	 0x20000000
+#define SHF_MIPS_ADDR	 0x40000000
+#define SHF_MIPS_STRINGS 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL	 0x04000000
+#define SHF_MIPS_NAMES	 0x02000000
+#define SHF_MIPS_NODUPE	 0x01000000
+
+
+/* Symbol tables.  */
+
+/* MIPS specific values for `st_other'.  */
+#define STO_MIPS_DEFAULT		0x0
+#define STO_MIPS_INTERNAL		0x1
+#define STO_MIPS_HIDDEN			0x2
+#define STO_MIPS_PROTECTED		0x3
+#define STO_MIPS_PLT			0x8
+#define STO_MIPS_SC_ALIGN_UNUSED	0xff
+
+/* MIPS specific values for `st_info'.  */
+#define STB_MIPS_SPLIT_COMMON		13
+
+/* Entries found in sections of type SHT_MIPS_GPTAB.  */
+
+typedef union
+{
+  struct
+    {
+      Elf32_Word gt_current_g_value;	/* -G value used for compilation */
+      Elf32_Word gt_unused;		/* Not used */
+    } gt_header;			/* First entry in section */
+  struct
+    {
+      Elf32_Word gt_g_value;		/* If this value were used for -G */
+      Elf32_Word gt_bytes;		/* This many bytes would be used */
+    } gt_entry;				/* Subsequent entries in section */
+} Elf32_gptab;
+
+/* Entry found in sections of type SHT_MIPS_REGINFO.  */
+
+typedef struct
+{
+  Elf32_Word	ri_gprmask;		/* General registers used */
+  Elf32_Word	ri_cprmask[4];		/* Coprocessor registers used */
+  Elf32_Sword	ri_gp_value;		/* $gp register value */
+} Elf32_RegInfo;
+
+/* Entries found in sections of type SHT_MIPS_OPTIONS.  */
+
+typedef struct
+{
+  unsigned char kind;		/* Determines interpretation of the
+				   variable part of descriptor.  */
+  unsigned char size;		/* Size of descriptor, including header.  */
+  Elf32_Section section;	/* Section header index of section affected,
+				   0 for global options.  */
+  Elf32_Word info;		/* Kind-specific information.  */
+} Elf_Options;
+
+/* Values for `kind' field in Elf_Options.  */
+
+#define ODK_NULL	0	/* Undefined.  */
+#define ODK_REGINFO	1	/* Register usage information.  */
+#define ODK_EXCEPTIONS	2	/* Exception processing options.  */
+#define ODK_PAD		3	/* Section padding options.  */
+#define ODK_HWPATCH	4	/* Hardware workarounds performed */
+#define ODK_FILL	5	/* record the fill value used by the linker. */
+#define ODK_TAGS	6	/* reserve space for desktop tools to write. */
+#define ODK_HWAND	7	/* HW workarounds.  'AND' bits when merging. */
+#define ODK_HWOR	8	/* HW workarounds.  'OR' bits when merging.  */
+
+/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries.  */
+
+#define OEX_FPU_MIN	0x1f	/* FPE's which MUST be enabled.  */
+#define OEX_FPU_MAX	0x1f00	/* FPE's which MAY be enabled.  */
+#define OEX_PAGE0	0x10000	/* page zero must be mapped.  */
+#define OEX_SMM		0x20000	/* Force sequential memory mode?  */
+#define OEX_FPDBUG	0x40000	/* Force floating point debug mode?  */
+#define OEX_PRECISEFP	OEX_FPDBUG
+#define OEX_DISMISS	0x80000	/* Dismiss invalid address faults?  */
+
+#define OEX_FPU_INVAL	0x10
+#define OEX_FPU_DIV0	0x08
+#define OEX_FPU_OFLO	0x04
+#define OEX_FPU_UFLO	0x02
+#define OEX_FPU_INEX	0x01
+
+/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry.  */
+
+#define OHW_R4KEOP	0x1	/* R4000 end-of-page patch.  */
+#define OHW_R8KPFETCH	0x2	/* may need R8000 prefetch patch.  */
+#define OHW_R5KEOP	0x4	/* R5000 end-of-page patch.  */
+#define OHW_R5KCVTL	0x8	/* R5000 cvt.[ds].l bug.  clean=1.  */
+
+#define OPAD_PREFIX	0x1
+#define OPAD_POSTFIX	0x2
+#define OPAD_SYMBOL	0x4
+
+/* Entry found in `.options' section.  */
+
+typedef struct
+{
+  Elf32_Word hwp_flags1;	/* Extra flags.  */
+  Elf32_Word hwp_flags2;	/* Extra flags.  */
+} Elf_Options_Hw;
+
+/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries.  */
+
+#define OHWA0_R4KEOP_CHECKED	0x00000001
+#define OHWA1_R4KEOP_CLEAN	0x00000002
+
+/* MIPS relocs.  */
+
+#define R_MIPS_NONE		0	/* No reloc */
+#define R_MIPS_16		1	/* Direct 16 bit */
+#define R_MIPS_32		2	/* Direct 32 bit */
+#define R_MIPS_REL32		3	/* PC relative 32 bit */
+#define R_MIPS_26		4	/* Direct 26 bit shifted */
+#define R_MIPS_HI16		5	/* High 16 bit */
+#define R_MIPS_LO16		6	/* Low 16 bit */
+#define R_MIPS_GPREL16		7	/* GP relative 16 bit */
+#define R_MIPS_LITERAL		8	/* 16 bit literal entry */
+#define R_MIPS_GOT16		9	/* 16 bit GOT entry */
+#define R_MIPS_PC16		10	/* PC relative 16 bit */
+#define R_MIPS_CALL16		11	/* 16 bit GOT entry for function */
+#define R_MIPS_GPREL32		12	/* GP relative 32 bit */
+
+#define R_MIPS_SHIFT5		16
+#define R_MIPS_SHIFT6		17
+#define R_MIPS_64		18
+#define R_MIPS_GOT_DISP		19
+#define R_MIPS_GOT_PAGE		20
+#define R_MIPS_GOT_OFST		21
+#define R_MIPS_GOT_HI16		22
+#define R_MIPS_GOT_LO16		23
+#define R_MIPS_SUB		24
+#define R_MIPS_INSERT_A		25
+#define R_MIPS_INSERT_B		26
+#define R_MIPS_DELETE		27
+#define R_MIPS_HIGHER		28
+#define R_MIPS_HIGHEST		29
+#define R_MIPS_CALL_HI16	30
+#define R_MIPS_CALL_LO16	31
+#define R_MIPS_SCN_DISP		32
+#define R_MIPS_REL16		33
+#define R_MIPS_ADD_IMMEDIATE	34
+#define R_MIPS_PJUMP		35
+#define R_MIPS_RELGOT		36
+#define R_MIPS_JALR		37
+#define R_MIPS_TLS_DTPMOD32	38	/* Module number 32 bit */
+#define R_MIPS_TLS_DTPREL32	39	/* Module-relative offset 32 bit */
+#define R_MIPS_TLS_DTPMOD64	40	/* Module number 64 bit */
+#define R_MIPS_TLS_DTPREL64	41	/* Module-relative offset 64 bit */
+#define R_MIPS_TLS_GD		42	/* 16 bit GOT offset for GD */
+#define R_MIPS_TLS_LDM		43	/* 16 bit GOT offset for LDM */
+#define R_MIPS_TLS_DTPREL_HI16	44	/* Module-relative offset, high 16 bits */
+#define R_MIPS_TLS_DTPREL_LO16	45	/* Module-relative offset, low 16 bits */
+#define R_MIPS_TLS_GOTTPREL	46	/* 16 bit GOT offset for IE */
+#define R_MIPS_TLS_TPREL32	47	/* TP-relative offset, 32 bit */
+#define R_MIPS_TLS_TPREL64	48	/* TP-relative offset, 64 bit */
+#define R_MIPS_TLS_TPREL_HI16	49	/* TP-relative offset, high 16 bits */
+#define R_MIPS_TLS_TPREL_LO16	50	/* TP-relative offset, low 16 bits */
+#define R_MIPS_GLOB_DAT		51
+#define R_MIPS_COPY		126
+#define R_MIPS_JUMP_SLOT        127
+/* Keep this the last entry.  */
+#define R_MIPS_NUM		128
+
+/* Legal values for p_type field of Elf32_Phdr.  */
+
+#define PT_MIPS_REGINFO	0x70000000	/* Register usage information */
+#define PT_MIPS_RTPROC  0x70000001	/* Runtime procedure table. */
+#define PT_MIPS_OPTIONS 0x70000002
+
+/* Special program header types.  */
+
+#define PF_MIPS_LOCAL	0x10000000
+
+/* Legal values for d_tag field of Elf32_Dyn.  */
+
+#define DT_MIPS_RLD_VERSION  0x70000001	/* Runtime linker interface version */
+#define DT_MIPS_TIME_STAMP   0x70000002	/* Timestamp */
+#define DT_MIPS_ICHECKSUM    0x70000003	/* Checksum */
+#define DT_MIPS_IVERSION     0x70000004	/* Version string (string tbl index) */
+#define DT_MIPS_FLAGS	     0x70000005	/* Flags */
+#define DT_MIPS_BASE_ADDRESS 0x70000006	/* Base address */
+#define DT_MIPS_MSYM	     0x70000007
+#define DT_MIPS_CONFLICT     0x70000008	/* Address of CONFLICT section */
+#define DT_MIPS_LIBLIST	     0x70000009	/* Address of LIBLIST section */
+#define DT_MIPS_LOCAL_GOTNO  0x7000000a	/* Number of local GOT entries */
+#define DT_MIPS_CONFLICTNO   0x7000000b	/* Number of CONFLICT entries */
+#define DT_MIPS_LIBLISTNO    0x70000010	/* Number of LIBLIST entries */
+#define DT_MIPS_SYMTABNO     0x70000011	/* Number of DYNSYM entries */
+#define DT_MIPS_UNREFEXTNO   0x70000012	/* First external DYNSYM */
+#define DT_MIPS_GOTSYM	     0x70000013	/* First GOT entry in DYNSYM */
+#define DT_MIPS_HIPAGENO     0x70000014	/* Number of GOT page table entries */
+#define DT_MIPS_RLD_MAP	     0x70000016	/* Address of run time loader map.  */
+#define DT_MIPS_DELTA_CLASS  0x70000017	/* Delta C++ class definition.  */
+#define DT_MIPS_DELTA_CLASS_NO    0x70000018 /* Number of entries in
+						DT_MIPS_DELTA_CLASS.  */
+#define DT_MIPS_DELTA_INSTANCE    0x70000019 /* Delta C++ class instances.  */
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in
+						DT_MIPS_DELTA_INSTANCE.  */
+#define DT_MIPS_DELTA_RELOC  0x7000001b /* Delta relocations.  */
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in
+					     DT_MIPS_DELTA_RELOC.  */
+#define DT_MIPS_DELTA_SYM    0x7000001d /* Delta symbols that Delta
+					   relocations refer to.  */
+#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in
+					   DT_MIPS_DELTA_SYM.  */
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the
+					     class declaration.  */
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in
+						DT_MIPS_DELTA_CLASSSYM.  */
+#define DT_MIPS_CXX_FLAGS    0x70000022 /* Flags indicating for C++ flavor.  */
+#define DT_MIPS_PIXIE_INIT   0x70000023
+#define DT_MIPS_SYMBOL_LIB   0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS	     0x70000029 /* Address of .options.  */
+#define DT_MIPS_INTERFACE    0x7000002a /* Address of .interface.  */
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
+#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve
+						    function stored in GOT.  */
+#define DT_MIPS_PERF_SUFFIX  0x7000002e /* Default suffix of dso to be added
+					   by rld on dlopen() calls.  */
+#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
+#define DT_MIPS_GP_VALUE     0x70000030 /* GP value for aux GOTs.  */
+#define DT_MIPS_AUX_DYNAMIC  0x70000031 /* Address of aux .dynamic.  */
+/* The address of .got.plt in an executable using the new non-PIC ABI.  */
+#define DT_MIPS_PLTGOT	     0x70000032
+/* The base of the PLT in an executable using the new non-PIC ABI if that
+   PLT is writable.  For a non-writable PLT, this is omitted or has a zero
+   value.  */
+#define DT_MIPS_RWPLT        0x70000034
+#define DT_MIPS_NUM	     0x35
+
+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry.  */
+
+#define RHF_NONE		   0		/* No flags */
+#define RHF_QUICKSTART		   (1 << 0)	/* Use quickstart */
+#define RHF_NOTPOT		   (1 << 1)	/* Hash size not power of 2 */
+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)	/* Ignore LD_LIBRARY_PATH */
+#define RHF_NO_MOVE		   (1 << 3)
+#define RHF_SGI_ONLY		   (1 << 4)
+#define RHF_GUARANTEE_INIT	   (1 << 5)
+#define RHF_DELTA_C_PLUS_PLUS	   (1 << 6)
+#define RHF_GUARANTEE_START_INIT   (1 << 7)
+#define RHF_PIXIE		   (1 << 8)
+#define RHF_DEFAULT_DELAY_LOAD	   (1 << 9)
+#define RHF_REQUICKSTART	   (1 << 10)
+#define RHF_REQUICKSTARTED	   (1 << 11)
+#define RHF_CORD		   (1 << 12)
+#define RHF_NO_UNRES_UNDEF	   (1 << 13)
+#define RHF_RLD_ORDER_SAFE	   (1 << 14)
+
+/* Entries found in sections of type SHT_MIPS_LIBLIST.  */
+
+typedef struct
+{
+  Elf32_Word l_name;		/* Name (string table index) */
+  Elf32_Word l_time_stamp;	/* Timestamp */
+  Elf32_Word l_checksum;	/* Checksum */
+  Elf32_Word l_version;		/* Interface version */
+  Elf32_Word l_flags;		/* Flags */
+} Elf32_Lib;
+
+typedef struct
+{
+  Elf64_Word l_name;		/* Name (string table index) */
+  Elf64_Word l_time_stamp;	/* Timestamp */
+  Elf64_Word l_checksum;	/* Checksum */
+  Elf64_Word l_version;		/* Interface version */
+  Elf64_Word l_flags;		/* Flags */
+} Elf64_Lib;
+
+
+/* Legal values for l_flags.  */
+
+#define LL_NONE		  0
+#define LL_EXACT_MATCH	  (1 << 0)	/* Require exact match */
+#define LL_IGNORE_INT_VER (1 << 1)	/* Ignore interface version */
+#define LL_REQUIRE_MINOR  (1 << 2)
+#define LL_EXPORTS	  (1 << 3)
+#define LL_DELAY_LOAD	  (1 << 4)
+#define LL_DELTA	  (1 << 5)
+
+/* Entries found in sections of type SHT_MIPS_CONFLICT.  */
+
+typedef Elf32_Addr Elf32_Conflict;
+
+
+/* HPPA specific definitions.  */
+
+/* Legal values for e_flags field of Elf32_Ehdr.  */
+
+#define EF_PARISC_TRAPNIL	0x00010000 /* Trap nil pointer dereference.  */
+#define EF_PARISC_EXT		0x00020000 /* Program uses arch. extensions. */
+#define EF_PARISC_LSB		0x00040000 /* Program expects little endian. */
+#define EF_PARISC_WIDE		0x00080000 /* Program expects wide mode.  */
+#define EF_PARISC_NO_KABP	0x00100000 /* No kernel assisted branch
+					      prediction.  */
+#define EF_PARISC_LAZYSWAP	0x00400000 /* Allow lazy swapping.  */
+#define EF_PARISC_ARCH		0x0000ffff /* Architecture version.  */
+
+/* Defined values for `e_flags & EF_PARISC_ARCH' are:  */
+
+#define EFA_PARISC_1_0		    0x020b /* PA-RISC 1.0 big-endian.  */
+#define EFA_PARISC_1_1		    0x0210 /* PA-RISC 1.1 big-endian.  */
+#define EFA_PARISC_2_0		    0x0214 /* PA-RISC 2.0 big-endian.  */
+
+/* Additional section indeces.  */
+
+#define SHN_PARISC_ANSI_COMMON	0xff00	   /* Section for tenatively declared
+					      symbols in ANSI C.  */
+#define SHN_PARISC_HUGE_COMMON	0xff01	   /* Common blocks in huge model.  */
+
+/* Legal values for sh_type field of Elf32_Shdr.  */
+
+#define SHT_PARISC_EXT		0x70000000 /* Contains product specific ext. */
+#define SHT_PARISC_UNWIND	0x70000001 /* Unwind information.  */
+#define SHT_PARISC_DOC		0x70000002 /* Debug info for optimized code. */
+
+/* Legal values for sh_flags field of Elf32_Shdr.  */
+
+#define SHF_PARISC_SHORT	0x20000000 /* Section with short addressing. */
+#define SHF_PARISC_HUGE		0x40000000 /* Section far from gp.  */
+#define SHF_PARISC_SBP		0x80000000 /* Static branch prediction code. */
+
+/* Legal values for ST_TYPE subfield of st_info (symbol type).  */
+
+#define STT_PARISC_MILLICODE	13	/* Millicode function entry point.  */
+
+#define STT_HP_OPAQUE		(STT_LOOS + 0x1)
+#define STT_HP_STUB		(STT_LOOS + 0x2)
+
+/* HPPA relocs.  */
+
+#define R_PARISC_NONE		0	/* No reloc.  */
+#define R_PARISC_DIR32		1	/* Direct 32-bit reference.  */
+#define R_PARISC_DIR21L		2	/* Left 21 bits of eff. address.  */
+#define R_PARISC_DIR17R		3	/* Right 17 bits of eff. address.  */
+#define R_PARISC_DIR17F		4	/* 17 bits of eff. address.  */
+#define R_PARISC_DIR14R		6	/* Right 14 bits of eff. address.  */
+#define R_PARISC_PCREL32	9	/* 32-bit rel. address.  */
+#define R_PARISC_PCREL21L	10	/* Left 21 bits of rel. address.  */
+#define R_PARISC_PCREL17R	11	/* Right 17 bits of rel. address.  */
+#define R_PARISC_PCREL17F	12	/* 17 bits of rel. address.  */
+#define R_PARISC_PCREL14R	14	/* Right 14 bits of rel. address.  */
+#define R_PARISC_DPREL21L	18	/* Left 21 bits of rel. address.  */
+#define R_PARISC_DPREL14R	22	/* Right 14 bits of rel. address.  */
+#define R_PARISC_GPREL21L	26	/* GP-relative, left 21 bits.  */
+#define R_PARISC_GPREL14R	30	/* GP-relative, right 14 bits.  */
+#define R_PARISC_LTOFF21L	34	/* LT-relative, left 21 bits.  */
+#define R_PARISC_LTOFF14R	38	/* LT-relative, right 14 bits.  */
+#define R_PARISC_SECREL32	41	/* 32 bits section rel. address.  */
+#define R_PARISC_SEGBASE	48	/* No relocation, set segment base.  */
+#define R_PARISC_SEGREL32	49	/* 32 bits segment rel. address.  */
+#define R_PARISC_PLTOFF21L	50	/* PLT rel. address, left 21 bits.  */
+#define R_PARISC_PLTOFF14R	54	/* PLT rel. address, right 14 bits.  */
+#define R_PARISC_LTOFF_FPTR32	57	/* 32 bits LT-rel. function pointer. */
+#define R_PARISC_LTOFF_FPTR21L	58	/* LT-rel. fct ptr, left 21 bits. */
+#define R_PARISC_LTOFF_FPTR14R	62	/* LT-rel. fct ptr, right 14 bits. */
+#define R_PARISC_FPTR64		64	/* 64 bits function address.  */
+#define R_PARISC_PLABEL32	65	/* 32 bits function address.  */
+#define R_PARISC_PLABEL21L	66	/* Left 21 bits of fdesc address.  */
+#define R_PARISC_PLABEL14R	70	/* Right 14 bits of fdesc address.  */
+#define R_PARISC_PCREL64	72	/* 64 bits PC-rel. address.  */
+#define R_PARISC_PCREL22F	74	/* 22 bits PC-rel. address.  */
+#define R_PARISC_PCREL14WR	75	/* PC-rel. address, right 14 bits.  */
+#define R_PARISC_PCREL14DR	76	/* PC rel. address, right 14 bits.  */
+#define R_PARISC_PCREL16F	77	/* 16 bits PC-rel. address.  */
+#define R_PARISC_PCREL16WF	78	/* 16 bits PC-rel. address.  */
+#define R_PARISC_PCREL16DF	79	/* 16 bits PC-rel. address.  */
+#define R_PARISC_DIR64		80	/* 64 bits of eff. address.  */
+#define R_PARISC_DIR14WR	83	/* 14 bits of eff. address.  */
+#define R_PARISC_DIR14DR	84	/* 14 bits of eff. address.  */
+#define R_PARISC_DIR16F		85	/* 16 bits of eff. address.  */
+#define R_PARISC_DIR16WF	86	/* 16 bits of eff. address.  */
+#define R_PARISC_DIR16DF	87	/* 16 bits of eff. address.  */
+#define R_PARISC_GPREL64	88	/* 64 bits of GP-rel. address.  */
+#define R_PARISC_GPREL14WR	91	/* GP-rel. address, right 14 bits.  */
+#define R_PARISC_GPREL14DR	92	/* GP-rel. address, right 14 bits.  */
+#define R_PARISC_GPREL16F	93	/* 16 bits GP-rel. address.  */
+#define R_PARISC_GPREL16WF	94	/* 16 bits GP-rel. address.  */
+#define R_PARISC_GPREL16DF	95	/* 16 bits GP-rel. address.  */
+#define R_PARISC_LTOFF64	96	/* 64 bits LT-rel. address.  */
+#define R_PARISC_LTOFF14WR	99	/* LT-rel. address, right 14 bits.  */
+#define R_PARISC_LTOFF14DR	100	/* LT-rel. address, right 14 bits.  */
+#define R_PARISC_LTOFF16F	101	/* 16 bits LT-rel. address.  */
+#define R_PARISC_LTOFF16WF	102	/* 16 bits LT-rel. address.  */
+#define R_PARISC_LTOFF16DF	103	/* 16 bits LT-rel. address.  */
+#define R_PARISC_SECREL64	104	/* 64 bits section rel. address.  */
+#define R_PARISC_SEGREL64	112	/* 64 bits segment rel. address.  */
+#define R_PARISC_PLTOFF14WR	115	/* PLT-rel. address, right 14 bits.  */
+#define R_PARISC_PLTOFF14DR	116	/* PLT-rel. address, right 14 bits.  */
+#define R_PARISC_PLTOFF16F	117	/* 16 bits LT-rel. address.  */
+#define R_PARISC_PLTOFF16WF	118	/* 16 bits PLT-rel. address.  */
+#define R_PARISC_PLTOFF16DF	119	/* 16 bits PLT-rel. address.  */
+#define R_PARISC_LTOFF_FPTR64	120	/* 64 bits LT-rel. function ptr.  */
+#define R_PARISC_LTOFF_FPTR14WR	123	/* LT-rel. fct. ptr., right 14 bits. */
+#define R_PARISC_LTOFF_FPTR14DR	124	/* LT-rel. fct. ptr., right 14 bits. */
+#define R_PARISC_LTOFF_FPTR16F	125	/* 16 bits LT-rel. function ptr.  */
+#define R_PARISC_LTOFF_FPTR16WF	126	/* 16 bits LT-rel. function ptr.  */
+#define R_PARISC_LTOFF_FPTR16DF	127	/* 16 bits LT-rel. function ptr.  */
+#define R_PARISC_LORESERVE	128
+#define R_PARISC_COPY		128	/* Copy relocation.  */
+#define R_PARISC_IPLT		129	/* Dynamic reloc, imported PLT */
+#define R_PARISC_EPLT		130	/* Dynamic reloc, exported PLT */
+#define R_PARISC_TPREL32	153	/* 32 bits TP-rel. address.  */
+#define R_PARISC_TPREL21L	154	/* TP-rel. address, left 21 bits.  */
+#define R_PARISC_TPREL14R	158	/* TP-rel. address, right 14 bits.  */
+#define R_PARISC_LTOFF_TP21L	162	/* LT-TP-rel. address, left 21 bits. */
+#define R_PARISC_LTOFF_TP14R	166	/* LT-TP-rel. address, right 14 bits.*/
+#define R_PARISC_LTOFF_TP14F	167	/* 14 bits LT-TP-rel. address.  */
+#define R_PARISC_TPREL64	216	/* 64 bits TP-rel. address.  */
+#define R_PARISC_TPREL14WR	219	/* TP-rel. address, right 14 bits.  */
+#define R_PARISC_TPREL14DR	220	/* TP-rel. address, right 14 bits.  */
+#define R_PARISC_TPREL16F	221	/* 16 bits TP-rel. address.  */
+#define R_PARISC_TPREL16WF	222	/* 16 bits TP-rel. address.  */
+#define R_PARISC_TPREL16DF	223	/* 16 bits TP-rel. address.  */
+#define R_PARISC_LTOFF_TP64	224	/* 64 bits LT-TP-rel. address.  */
+#define R_PARISC_LTOFF_TP14WR	227	/* LT-TP-rel. address, right 14 bits.*/
+#define R_PARISC_LTOFF_TP14DR	228	/* LT-TP-rel. address, right 14 bits.*/
+#define R_PARISC_LTOFF_TP16F	229	/* 16 bits LT-TP-rel. address.  */
+#define R_PARISC_LTOFF_TP16WF	230	/* 16 bits LT-TP-rel. address.  */
+#define R_PARISC_LTOFF_TP16DF	231	/* 16 bits LT-TP-rel. address.  */
+#define R_PARISC_GNU_VTENTRY	232
+#define R_PARISC_GNU_VTINHERIT	233
+#define R_PARISC_TLS_GD21L	234	/* GD 21-bit left.  */
+#define R_PARISC_TLS_GD14R	235	/* GD 14-bit right.  */
+#define R_PARISC_TLS_GDCALL	236	/* GD call to __t_g_a.  */
+#define R_PARISC_TLS_LDM21L	237	/* LD module 21-bit left.  */
+#define R_PARISC_TLS_LDM14R	238	/* LD module 14-bit right.  */
+#define R_PARISC_TLS_LDMCALL	239	/* LD module call to __t_g_a.  */
+#define R_PARISC_TLS_LDO21L	240	/* LD offset 21-bit left.  */
+#define R_PARISC_TLS_LDO14R	241	/* LD offset 14-bit right.  */
+#define R_PARISC_TLS_DTPMOD32	242	/* DTP module 32-bit.  */
+#define R_PARISC_TLS_DTPMOD64	243	/* DTP module 64-bit.  */
+#define R_PARISC_TLS_DTPOFF32	244	/* DTP offset 32-bit.  */
+#define R_PARISC_TLS_DTPOFF64	245	/* DTP offset 32-bit.  */
+#define R_PARISC_TLS_LE21L	R_PARISC_TPREL21L
+#define R_PARISC_TLS_LE14R	R_PARISC_TPREL14R
+#define R_PARISC_TLS_IE21L	R_PARISC_LTOFF_TP21L
+#define R_PARISC_TLS_IE14R	R_PARISC_LTOFF_TP14R
+#define R_PARISC_TLS_TPREL32	R_PARISC_TPREL32
+#define R_PARISC_TLS_TPREL64	R_PARISC_TPREL64
+#define R_PARISC_HIRESERVE	255
+
+/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr.  */
+
+#define PT_HP_TLS		(PT_LOOS + 0x0)
+#define PT_HP_CORE_NONE		(PT_LOOS + 0x1)
+#define PT_HP_CORE_VERSION	(PT_LOOS + 0x2)
+#define PT_HP_CORE_KERNEL	(PT_LOOS + 0x3)
+#define PT_HP_CORE_COMM		(PT_LOOS + 0x4)
+#define PT_HP_CORE_PROC		(PT_LOOS + 0x5)
+#define PT_HP_CORE_LOADABLE	(PT_LOOS + 0x6)
+#define PT_HP_CORE_STACK	(PT_LOOS + 0x7)
+#define PT_HP_CORE_SHM		(PT_LOOS + 0x8)
+#define PT_HP_CORE_MMF		(PT_LOOS + 0x9)
+#define PT_HP_PARALLEL		(PT_LOOS + 0x10)
+#define PT_HP_FASTBIND		(PT_LOOS + 0x11)
+#define PT_HP_OPT_ANNOT		(PT_LOOS + 0x12)
+#define PT_HP_HSL_ANNOT		(PT_LOOS + 0x13)
+#define PT_HP_STACK		(PT_LOOS + 0x14)
+
+#define PT_PARISC_ARCHEXT	0x70000000
+#define PT_PARISC_UNWIND	0x70000001
+
+/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr.  */
+
+#define PF_PARISC_SBP		0x08000000
+
+#define PF_HP_PAGE_SIZE		0x00100000
+#define PF_HP_FAR_SHARED	0x00200000
+#define PF_HP_NEAR_SHARED	0x00400000
+#define PF_HP_CODE		0x01000000
+#define PF_HP_MODIFY		0x02000000
+#define PF_HP_LAZYSWAP		0x04000000
+#define PF_HP_SBP		0x08000000
+
+
+/* Alpha specific definitions.  */
+
+/* Legal values for e_flags field of Elf64_Ehdr.  */
+
+#define EF_ALPHA_32BIT		1	/* All addresses must be < 2GB.  */
+#define EF_ALPHA_CANRELAX	2	/* Relocations for relaxing exist.  */
+
+/* Legal values for sh_type field of Elf64_Shdr.  */
+
+/* These two are primerily concerned with ECOFF debugging info.  */
+#define SHT_ALPHA_DEBUG		0x70000001
+#define SHT_ALPHA_REGINFO	0x70000002
+
+/* Legal values for sh_flags field of Elf64_Shdr.  */
+
+#define SHF_ALPHA_GPREL		0x10000000
+
+/* Legal values for st_other field of Elf64_Sym.  */
+#define STO_ALPHA_NOPV		0x80	/* No PV required.  */
+#define STO_ALPHA_STD_GPLOAD	0x88	/* PV only used for initial ldgp.  */
+
+/* Alpha relocs.  */
+
+#define R_ALPHA_NONE		0	/* No reloc */
+#define R_ALPHA_REFLONG		1	/* Direct 32 bit */
+#define R_ALPHA_REFQUAD		2	/* Direct 64 bit */
+#define R_ALPHA_GPREL32		3	/* GP relative 32 bit */
+#define R_ALPHA_LITERAL		4	/* GP relative 16 bit w/optimization */
+#define R_ALPHA_LITUSE		5	/* Optimization hint for LITERAL */
+#define R_ALPHA_GPDISP		6	/* Add displacement to GP */
+#define R_ALPHA_BRADDR		7	/* PC+4 relative 23 bit shifted */
+#define R_ALPHA_HINT		8	/* PC+4 relative 16 bit shifted */
+#define R_ALPHA_SREL16		9	/* PC relative 16 bit */
+#define R_ALPHA_SREL32		10	/* PC relative 32 bit */
+#define R_ALPHA_SREL64		11	/* PC relative 64 bit */
+#define R_ALPHA_GPRELHIGH	17	/* GP relative 32 bit, high 16 bits */
+#define R_ALPHA_GPRELLOW	18	/* GP relative 32 bit, low 16 bits */
+#define R_ALPHA_GPREL16		19	/* GP relative 16 bit */
+#define R_ALPHA_COPY		24	/* Copy symbol at runtime */
+#define R_ALPHA_GLOB_DAT	25	/* Create GOT entry */
+#define R_ALPHA_JMP_SLOT	26	/* Create PLT entry */
+#define R_ALPHA_RELATIVE	27	/* Adjust by program base */
+#define R_ALPHA_TLS_GD_HI	28
+#define R_ALPHA_TLSGD		29
+#define R_ALPHA_TLS_LDM		30
+#define R_ALPHA_DTPMOD64	31
+#define R_ALPHA_GOTDTPREL	32
+#define R_ALPHA_DTPREL64	33
+#define R_ALPHA_DTPRELHI	34
+#define R_ALPHA_DTPRELLO	35
+#define R_ALPHA_DTPREL16	36
+#define R_ALPHA_GOTTPREL	37
+#define R_ALPHA_TPREL64		38
+#define R_ALPHA_TPRELHI		39
+#define R_ALPHA_TPRELLO		40
+#define R_ALPHA_TPREL16		41
+/* Keep this the last entry.  */
+#define R_ALPHA_NUM		46
+
+/* Magic values of the LITUSE relocation addend.  */
+#define LITUSE_ALPHA_ADDR	0
+#define LITUSE_ALPHA_BASE	1
+#define LITUSE_ALPHA_BYTOFF	2
+#define LITUSE_ALPHA_JSR	3
+#define LITUSE_ALPHA_TLS_GD	4
+#define LITUSE_ALPHA_TLS_LDM	5
+
+/* Legal values for d_tag of Elf64_Dyn.  */
+#define DT_ALPHA_PLTRO		(DT_LOPROC + 0)
+#define DT_ALPHA_NUM		1
+
+/* PowerPC specific declarations */
+
+/* Values for Elf32/64_Ehdr.e_flags.  */
+#define EF_PPC_EMB		0x80000000	/* PowerPC embedded flag */
+
+/* Cygnus local bits below */
+#define EF_PPC_RELOCATABLE	0x00010000	/* PowerPC -mrelocatable flag*/
+#define EF_PPC_RELOCATABLE_LIB	0x00008000	/* PowerPC -mrelocatable-lib
+						   flag */
+
+/* PowerPC relocations defined by the ABIs */
+#define R_PPC_NONE		0
+#define R_PPC_ADDR32		1	/* 32bit absolute address */
+#define R_PPC_ADDR24		2	/* 26bit address, 2 bits ignored.  */
+#define R_PPC_ADDR16		3	/* 16bit absolute address */
+#define R_PPC_ADDR16_LO		4	/* lower 16bit of absolute address */
+#define R_PPC_ADDR16_HI		5	/* high 16bit of absolute address */
+#define R_PPC_ADDR16_HA		6	/* adjusted high 16bit */
+#define R_PPC_ADDR14		7	/* 16bit address, 2 bits ignored */
+#define R_PPC_ADDR14_BRTAKEN	8
+#define R_PPC_ADDR14_BRNTAKEN	9
+#define R_PPC_REL24		10	/* PC relative 26 bit */
+#define R_PPC_REL14		11	/* PC relative 16 bit */
+#define R_PPC_REL14_BRTAKEN	12
+#define R_PPC_REL14_BRNTAKEN	13
+#define R_PPC_GOT16		14
+#define R_PPC_GOT16_LO		15
+#define R_PPC_GOT16_HI		16
+#define R_PPC_GOT16_HA		17
+#define R_PPC_PLTREL24		18
+#define R_PPC_COPY		19
+#define R_PPC_GLOB_DAT		20
+#define R_PPC_JMP_SLOT		21
+#define R_PPC_RELATIVE		22
+#define R_PPC_LOCAL24PC		23
+#define R_PPC_UADDR32		24
+#define R_PPC_UADDR16		25
+#define R_PPC_REL32		26
+#define R_PPC_PLT32		27
+#define R_PPC_PLTREL32		28
+#define R_PPC_PLT16_LO		29
+#define R_PPC_PLT16_HI		30
+#define R_PPC_PLT16_HA		31
+#define R_PPC_SDAREL16		32
+#define R_PPC_SECTOFF		33
+#define R_PPC_SECTOFF_LO	34
+#define R_PPC_SECTOFF_HI	35
+#define R_PPC_SECTOFF_HA	36
+
+/* PowerPC relocations defined for the TLS access ABI.  */
+#define R_PPC_TLS		67 /* none	(sym+add)@tls */
+#define R_PPC_DTPMOD32		68 /* word32	(sym+add)@dtpmod */
+#define R_PPC_TPREL16		69 /* half16*	(sym+add)@tprel */
+#define R_PPC_TPREL16_LO	70 /* half16	(sym+add)@tprel@l */
+#define R_PPC_TPREL16_HI	71 /* half16	(sym+add)@tprel@h */
+#define R_PPC_TPREL16_HA	72 /* half16	(sym+add)@tprel@ha */
+#define R_PPC_TPREL32		73 /* word32	(sym+add)@tprel */
+#define R_PPC_DTPREL16		74 /* half16*	(sym+add)@dtprel */
+#define R_PPC_DTPREL16_LO	75 /* half16	(sym+add)@dtprel@l */
+#define R_PPC_DTPREL16_HI	76 /* half16	(sym+add)@dtprel@h */
+#define R_PPC_DTPREL16_HA	77 /* half16	(sym+add)@dtprel@ha */
+#define R_PPC_DTPREL32		78 /* word32	(sym+add)@dtprel */
+#define R_PPC_GOT_TLSGD16	79 /* half16*	(sym+add)@got@tlsgd */
+#define R_PPC_GOT_TLSGD16_LO	80 /* half16	(sym+add)@got@tlsgd@l */
+#define R_PPC_GOT_TLSGD16_HI	81 /* half16	(sym+add)@got@tlsgd@h */
+#define R_PPC_GOT_TLSGD16_HA	82 /* half16	(sym+add)@got@tlsgd@ha */
+#define R_PPC_GOT_TLSLD16	83 /* half16*	(sym+add)@got@tlsld */
+#define R_PPC_GOT_TLSLD16_LO	84 /* half16	(sym+add)@got@tlsld@l */
+#define R_PPC_GOT_TLSLD16_HI	85 /* half16	(sym+add)@got@tlsld@h */
+#define R_PPC_GOT_TLSLD16_HA	86 /* half16	(sym+add)@got@tlsld@ha */
+#define R_PPC_GOT_TPREL16	87 /* half16*	(sym+add)@got@tprel */
+#define R_PPC_GOT_TPREL16_LO	88 /* half16	(sym+add)@got@tprel@l */
+#define R_PPC_GOT_TPREL16_HI	89 /* half16	(sym+add)@got@tprel@h */
+#define R_PPC_GOT_TPREL16_HA	90 /* half16	(sym+add)@got@tprel@ha */
+#define R_PPC_GOT_DTPREL16	91 /* half16*	(sym+add)@got@dtprel */
+#define R_PPC_GOT_DTPREL16_LO	92 /* half16*	(sym+add)@got@dtprel@l */
+#define R_PPC_GOT_DTPREL16_HI	93 /* half16*	(sym+add)@got@dtprel@h */
+#define R_PPC_GOT_DTPREL16_HA	94 /* half16*	(sym+add)@got@dtprel@ha */
+
+/* Keep this the last entry.  */
+#define R_PPC_NUM		95
+
+/* The remaining relocs are from the Embedded ELF ABI, and are not
+   in the SVR4 ELF ABI.  */
+#define R_PPC_EMB_NADDR32	101
+#define R_PPC_EMB_NADDR16	102
+#define R_PPC_EMB_NADDR16_LO	103
+#define R_PPC_EMB_NADDR16_HI	104
+#define R_PPC_EMB_NADDR16_HA	105
+#define R_PPC_EMB_SDAI16	106
+#define R_PPC_EMB_SDA2I16	107
+#define R_PPC_EMB_SDA2REL	108
+#define R_PPC_EMB_SDA21		109	/* 16 bit offset in SDA */
+#define R_PPC_EMB_MRKREF	110
+#define R_PPC_EMB_RELSEC16	111
+#define R_PPC_EMB_RELST_LO	112
+#define R_PPC_EMB_RELST_HI	113
+#define R_PPC_EMB_RELST_HA	114
+#define R_PPC_EMB_BIT_FLD	115
+#define R_PPC_EMB_RELSDA	116	/* 16 bit relative offset in SDA */
+
+/* Diab tool relocations.  */
+#define R_PPC_DIAB_SDA21_LO	180	/* like EMB_SDA21, but lower 16 bit */
+#define R_PPC_DIAB_SDA21_HI	181	/* like EMB_SDA21, but high 16 bit */
+#define R_PPC_DIAB_SDA21_HA	182	/* like EMB_SDA21, adjusted high 16 */
+#define R_PPC_DIAB_RELSDA_LO	183	/* like EMB_RELSDA, but lower 16 bit */
+#define R_PPC_DIAB_RELSDA_HI	184	/* like EMB_RELSDA, but high 16 bit */
+#define R_PPC_DIAB_RELSDA_HA	185	/* like EMB_RELSDA, adjusted high 16 */
+
+/* GNU relocs used in PIC code sequences.  */
+#define R_PPC_REL16		249	/* word32   (sym-.) */
+#define R_PPC_REL16_LO		250	/* half16   (sym-.)@l */
+#define R_PPC_REL16_HI		251	/* half16   (sym-.)@h */
+#define R_PPC_REL16_HA		252	/* half16   (sym-.)@ha */
+
+/* This is a phony reloc to handle any old fashioned TOC16 references
+   that may still be in object files.  */
+#define R_PPC_TOC16		255
+
+/* PowerPC specific values for the Dyn d_tag field.  */
+#define DT_PPC_GOT		(DT_LOPROC + 0)
+#define DT_PPC_NUM		1
+
+/* PowerPC64 relocations defined by the ABIs */
+#define R_PPC64_NONE		R_PPC_NONE
+#define R_PPC64_ADDR32		R_PPC_ADDR32 /* 32bit absolute address */
+#define R_PPC64_ADDR24		R_PPC_ADDR24 /* 26bit address, word aligned */
+#define R_PPC64_ADDR16		R_PPC_ADDR16 /* 16bit absolute address */
+#define R_PPC64_ADDR16_LO	R_PPC_ADDR16_LO	/* lower 16bits of address */
+#define R_PPC64_ADDR16_HI	R_PPC_ADDR16_HI	/* high 16bits of address. */
+#define R_PPC64_ADDR16_HA	R_PPC_ADDR16_HA /* adjusted high 16bits.  */
+#define R_PPC64_ADDR14		R_PPC_ADDR14 /* 16bit address, word aligned */
+#define R_PPC64_ADDR14_BRTAKEN	R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN	R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24		R_PPC_REL24 /* PC-rel. 26 bit, word aligned */
+#define R_PPC64_REL14		R_PPC_REL14 /* PC relative 16 bit */
+#define R_PPC64_REL14_BRTAKEN	R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN	R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16		R_PPC_GOT16
+#define R_PPC64_GOT16_LO	R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI	R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA	R_PPC_GOT16_HA
+
+#define R_PPC64_COPY		R_PPC_COPY
+#define R_PPC64_GLOB_DAT	R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT	R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE	R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32		R_PPC_UADDR32
+#define R_PPC64_UADDR16		R_PPC_UADDR16
+#define R_PPC64_REL32		R_PPC_REL32
+#define R_PPC64_PLT32		R_PPC_PLT32
+#define R_PPC64_PLTREL32	R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO	R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI	R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA	R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF		R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO	R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI	R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA	R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30		37 /* word30 (S + A - P) >> 2 */
+#define R_PPC64_ADDR64		38 /* doubleword64 S + A */
+#define R_PPC64_ADDR16_HIGHER	39 /* half16 #higher(S + A) */
+#define R_PPC64_ADDR16_HIGHERA	40 /* half16 #highera(S + A) */
+#define R_PPC64_ADDR16_HIGHEST	41 /* half16 #highest(S + A) */
+#define R_PPC64_ADDR16_HIGHESTA	42 /* half16 #highesta(S + A) */
+#define R_PPC64_UADDR64		43 /* doubleword64 S + A */
+#define R_PPC64_REL64		44 /* doubleword64 S + A - P */
+#define R_PPC64_PLT64		45 /* doubleword64 L + A */
+#define R_PPC64_PLTREL64	46 /* doubleword64 L + A - P */
+#define R_PPC64_TOC16		47 /* half16* S + A - .TOC */
+#define R_PPC64_TOC16_LO	48 /* half16 #lo(S + A - .TOC.) */
+#define R_PPC64_TOC16_HI	49 /* half16 #hi(S + A - .TOC.) */
+#define R_PPC64_TOC16_HA	50 /* half16 #ha(S + A - .TOC.) */
+#define R_PPC64_TOC		51 /* doubleword64 .TOC */
+#define R_PPC64_PLTGOT16	52 /* half16* M + A */
+#define R_PPC64_PLTGOT16_LO	53 /* half16 #lo(M + A) */
+#define R_PPC64_PLTGOT16_HI	54 /* half16 #hi(M + A) */
+#define R_PPC64_PLTGOT16_HA	55 /* half16 #ha(M + A) */
+
+#define R_PPC64_ADDR16_DS	56 /* half16ds* (S + A) >> 2 */
+#define R_PPC64_ADDR16_LO_DS	57 /* half16ds  #lo(S + A) >> 2 */
+#define R_PPC64_GOT16_DS	58 /* half16ds* (G + A) >> 2 */
+#define R_PPC64_GOT16_LO_DS	59 /* half16ds  #lo(G + A) >> 2 */
+#define R_PPC64_PLT16_LO_DS	60 /* half16ds  #lo(L + A) >> 2 */
+#define R_PPC64_SECTOFF_DS	61 /* half16ds* (R + A) >> 2 */
+#define R_PPC64_SECTOFF_LO_DS	62 /* half16ds  #lo(R + A) >> 2 */
+#define R_PPC64_TOC16_DS	63 /* half16ds* (S + A - .TOC.) >> 2 */
+#define R_PPC64_TOC16_LO_DS	64 /* half16ds  #lo(S + A - .TOC.) >> 2 */
+#define R_PPC64_PLTGOT16_DS	65 /* half16ds* (M + A) >> 2 */
+#define R_PPC64_PLTGOT16_LO_DS	66 /* half16ds  #lo(M + A) >> 2 */
+
+/* PowerPC64 relocations defined for the TLS access ABI.  */
+#define R_PPC64_TLS		67 /* none	(sym+add)@tls */
+#define R_PPC64_DTPMOD64	68 /* doubleword64 (sym+add)@dtpmod */
+#define R_PPC64_TPREL16		69 /* half16*	(sym+add)@tprel */
+#define R_PPC64_TPREL16_LO	70 /* half16	(sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HI	71 /* half16	(sym+add)@tprel@h */
+#define R_PPC64_TPREL16_HA	72 /* half16	(sym+add)@tprel@ha */
+#define R_PPC64_TPREL64		73 /* doubleword64 (sym+add)@tprel */
+#define R_PPC64_DTPREL16	74 /* half16*	(sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO	75 /* half16	(sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HI	76 /* half16	(sym+add)@dtprel@h */
+#define R_PPC64_DTPREL16_HA	77 /* half16	(sym+add)@dtprel@ha */
+#define R_PPC64_DTPREL64	78 /* doubleword64 (sym+add)@dtprel */
+#define R_PPC64_GOT_TLSGD16	79 /* half16*	(sym+add)@got@tlsgd */
+#define R_PPC64_GOT_TLSGD16_LO	80 /* half16	(sym+add)@got@tlsgd@l */
+#define R_PPC64_GOT_TLSGD16_HI	81 /* half16	(sym+add)@got@tlsgd@h */
+#define R_PPC64_GOT_TLSGD16_HA	82 /* half16	(sym+add)@got@tlsgd@ha */
+#define R_PPC64_GOT_TLSLD16	83 /* half16*	(sym+add)@got@tlsld */
+#define R_PPC64_GOT_TLSLD16_LO	84 /* half16	(sym+add)@got@tlsld@l */
+#define R_PPC64_GOT_TLSLD16_HI	85 /* half16	(sym+add)@got@tlsld@h */
+#define R_PPC64_GOT_TLSLD16_HA	86 /* half16	(sym+add)@got@tlsld@ha */
+#define R_PPC64_GOT_TPREL16_DS	87 /* half16ds*	(sym+add)@got@tprel */
+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
+#define R_PPC64_GOT_TPREL16_HI	89 /* half16	(sym+add)@got@tprel@h */
+#define R_PPC64_GOT_TPREL16_HA	90 /* half16	(sym+add)@got@tprel@ha */
+#define R_PPC64_GOT_DTPREL16_DS	91 /* half16ds*	(sym+add)@got@dtprel */
+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
+#define R_PPC64_GOT_DTPREL16_HI	93 /* half16	(sym+add)@got@dtprel@h */
+#define R_PPC64_GOT_DTPREL16_HA	94 /* half16	(sym+add)@got@dtprel@ha */
+#define R_PPC64_TPREL16_DS	95 /* half16ds*	(sym+add)@tprel */
+#define R_PPC64_TPREL16_LO_DS	96 /* half16ds	(sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HIGHER	97 /* half16	(sym+add)@tprel@higher */
+#define R_PPC64_TPREL16_HIGHERA	98 /* half16	(sym+add)@tprel@highera */
+#define R_PPC64_TPREL16_HIGHEST	99 /* half16	(sym+add)@tprel@highest */
+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16	(sym+add)@tprel@highesta */
+#define R_PPC64_DTPREL16_DS	101 /* half16ds* (sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO_DS	102 /* half16ds	(sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HIGHER	103 /* half16	(sym+add)@dtprel@higher */
+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16	(sym+add)@dtprel@highera */
+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16	(sym+add)@dtprel@highest */
+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16	(sym+add)@dtprel@highesta */
+
+/* Keep this the last entry.  */
+#define R_PPC64_NUM		107
+
+/* PowerPC64 specific values for the Dyn d_tag field.  */
+#define DT_PPC64_GLINK  (DT_LOPROC + 0)
+#define DT_PPC64_OPD	(DT_LOPROC + 1)
+#define DT_PPC64_OPDSZ	(DT_LOPROC + 2)
+#define DT_PPC64_NUM    3
+
+
+/* ARM specific declarations */
+
+/* Processor specific flags for the ELF header e_flags field.  */
+#define EF_ARM_RELEXEC     0x01
+#define EF_ARM_HASENTRY    0x02
+#define EF_ARM_INTERWORK   0x04
+#define EF_ARM_APCS_26     0x08
+#define EF_ARM_APCS_FLOAT  0x10
+#define EF_ARM_PIC         0x20
+#define EF_ARM_ALIGN8      0x40		/* 8-bit structure alignment is in use */
+#define EF_ARM_NEW_ABI     0x80
+#define EF_ARM_OLD_ABI     0x100
+
+/* Other constants defined in the ARM ELF spec. version B-01.  */
+/* NB. These conflict with values defined above.  */
+#define EF_ARM_SYMSARESORTED	0x04
+#define EF_ARM_DYNSYMSUSESEGIDX 0x08
+#define EF_ARM_MAPSYMSFIRST	0x10
+#define EF_ARM_EABIMASK		0XFF000000
+
+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
+#define EF_ARM_EABI_UNKNOWN  0x00000000
+#define EF_ARM_EABI_VER1     0x01000000
+#define EF_ARM_EABI_VER2     0x02000000
+
+/* Additional symbol types for Thumb */
+#define STT_ARM_TFUNC      0xd
+
+/* ARM-specific values for sh_flags */
+#define SHF_ARM_ENTRYSECT  0x10000000   /* Section contains an entry point */
+#define SHF_ARM_COMDEF     0x80000000   /* Section may be multiply defined
+					   in the input to a link step */
+
+/* ARM-specific program header flags */
+#define PF_ARM_SB          0x10000000   /* Segment contains the location
+					   addressed by the static base */
+
+/* Processor specific values for the Phdr p_type field.  */
+#define PT_ARM_EXIDX	0x70000001	/* .ARM.exidx segment */
+
+/* ARM relocs.  */
+
+#define R_ARM_NONE		0	/* No reloc */
+#define R_ARM_PC24		1	/* PC relative 26 bit branch */
+#define R_ARM_ABS32		2	/* Direct 32 bit  */
+#define R_ARM_REL32		3	/* PC relative 32 bit */
+#define R_ARM_PC13		4
+#define R_ARM_ABS16		5	/* Direct 16 bit */
+#define R_ARM_ABS12		6	/* Direct 12 bit */
+#define R_ARM_THM_ABS5		7
+#define R_ARM_ABS8		8	/* Direct 8 bit */
+#define R_ARM_SBREL32		9
+#define R_ARM_THM_PC22		10
+#define R_ARM_THM_PC8		11
+#define R_ARM_AMP_VCALL9	12
+#define R_ARM_SWI24		13
+#define R_ARM_THM_SWI8		14
+#define R_ARM_XPC25		15
+#define R_ARM_THM_XPC22		16
+#define R_ARM_TLS_DTPMOD32	17	/* ID of module containing symbol */
+#define R_ARM_TLS_DTPOFF32	18	/* Offset in TLS block */
+#define R_ARM_TLS_TPOFF32	19	/* Offset in static TLS block */
+#define R_ARM_COPY		20	/* Copy symbol at runtime */
+#define R_ARM_GLOB_DAT		21	/* Create GOT entry */
+#define R_ARM_JUMP_SLOT		22	/* Create PLT entry */
+#define R_ARM_RELATIVE		23	/* Adjust by program base */
+#define R_ARM_GOTOFF		24	/* 32 bit offset to GOT */
+#define R_ARM_GOTPC		25	/* 32 bit PC relative offset to GOT */
+#define R_ARM_GOT32		26	/* 32 bit GOT entry */
+#define R_ARM_PLT32		27	/* 32 bit PLT address */
+#define R_ARM_ALU_PCREL_7_0	32
+#define R_ARM_ALU_PCREL_15_8	33
+#define R_ARM_ALU_PCREL_23_15	34
+#define R_ARM_LDR_SBREL_11_0	35
+#define R_ARM_ALU_SBREL_19_12	36
+#define R_ARM_ALU_SBREL_27_20	37
+#define R_ARM_GNU_VTENTRY	100
+#define R_ARM_GNU_VTINHERIT	101
+#define R_ARM_THM_PC11		102	/* thumb unconditional branch */
+#define R_ARM_THM_PC9		103	/* thumb conditional branch */
+#define R_ARM_TLS_GD32		104	/* PC-rel 32 bit for global dynamic
+					   thread local data */
+#define R_ARM_TLS_LDM32		105	/* PC-rel 32 bit for local dynamic
+					   thread local data */
+#define R_ARM_TLS_LDO32		106	/* 32 bit offset relative to TLS
+					   block */
+#define R_ARM_TLS_IE32		107	/* PC-rel 32 bit for GOT entry of
+					   static TLS block offset */
+#define R_ARM_TLS_LE32		108	/* 32 bit offset relative to static
+					   TLS block */
+#define R_ARM_RXPC25		249
+#define R_ARM_RSBREL32		250
+#define R_ARM_THM_RPC22		251
+#define R_ARM_RREL32		252
+#define R_ARM_RABS22		253
+#define R_ARM_RPC24		254
+#define R_ARM_RBASE		255
+/* Keep this the last entry.  */
+#define R_ARM_NUM		256
+
+/* IA-64 specific declarations.  */
+
+/* Processor specific flags for the Ehdr e_flags field.  */
+#define EF_IA_64_MASKOS		0x0000000f	/* os-specific flags */
+#define EF_IA_64_ABI64		0x00000010	/* 64-bit ABI */
+#define EF_IA_64_ARCH		0xff000000	/* arch. version mask */
+
+/* Processor specific values for the Phdr p_type field.  */
+#define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)	/* arch extension bits */
+#define PT_IA_64_UNWIND		(PT_LOPROC + 1)	/* ia64 unwind bits */
+#define PT_IA_64_HP_OPT_ANOT	(PT_LOOS + 0x12)
+#define PT_IA_64_HP_HSL_ANOT	(PT_LOOS + 0x13)
+#define PT_IA_64_HP_STACK	(PT_LOOS + 0x14)
+
+/* Processor specific flags for the Phdr p_flags field.  */
+#define PF_IA_64_NORECOV	0x80000000	/* spec insns w/o recovery */
+
+/* Processor specific values for the Shdr sh_type field.  */
+#define SHT_IA_64_EXT		(SHT_LOPROC + 0) /* extension bits */
+#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1) /* unwind bits */
+
+/* Processor specific flags for the Shdr sh_flags field.  */
+#define SHF_IA_64_SHORT		0x10000000	/* section near gp */
+#define SHF_IA_64_NORECOV	0x20000000	/* spec insns w/o recovery */
+
+/* Processor specific values for the Dyn d_tag field.  */
+#define DT_IA_64_PLT_RESERVE	(DT_LOPROC + 0)
+#define DT_IA_64_NUM		1
+
+/* IA-64 relocations.  */
+#define R_IA64_NONE		0x00	/* none */
+#define R_IA64_IMM14		0x21	/* symbol + addend, add imm14 */
+#define R_IA64_IMM22		0x22	/* symbol + addend, add imm22 */
+#define R_IA64_IMM64		0x23	/* symbol + addend, mov imm64 */
+#define R_IA64_DIR32MSB		0x24	/* symbol + addend, data4 MSB */
+#define R_IA64_DIR32LSB		0x25	/* symbol + addend, data4 LSB */
+#define R_IA64_DIR64MSB		0x26	/* symbol + addend, data8 MSB */
+#define R_IA64_DIR64LSB		0x27	/* symbol + addend, data8 LSB */
+#define R_IA64_GPREL22		0x2a	/* @gprel(sym + add), add imm22 */
+#define R_IA64_GPREL64I		0x2b	/* @gprel(sym + add), mov imm64 */
+#define R_IA64_GPREL32MSB	0x2c	/* @gprel(sym + add), data4 MSB */
+#define R_IA64_GPREL32LSB	0x2d	/* @gprel(sym + add), data4 LSB */
+#define R_IA64_GPREL64MSB	0x2e	/* @gprel(sym + add), data8 MSB */
+#define R_IA64_GPREL64LSB	0x2f	/* @gprel(sym + add), data8 LSB */
+#define R_IA64_LTOFF22		0x32	/* @ltoff(sym + add), add imm22 */
+#define R_IA64_LTOFF64I		0x33	/* @ltoff(sym + add), mov imm64 */
+#define R_IA64_PLTOFF22		0x3a	/* @pltoff(sym + add), add imm22 */
+#define R_IA64_PLTOFF64I	0x3b	/* @pltoff(sym + add), mov imm64 */
+#define R_IA64_PLTOFF64MSB	0x3e	/* @pltoff(sym + add), data8 MSB */
+#define R_IA64_PLTOFF64LSB	0x3f	/* @pltoff(sym + add), data8 LSB */
+#define R_IA64_FPTR64I		0x43	/* @fptr(sym + add), mov imm64 */
+#define R_IA64_FPTR32MSB	0x44	/* @fptr(sym + add), data4 MSB */
+#define R_IA64_FPTR32LSB	0x45	/* @fptr(sym + add), data4 LSB */
+#define R_IA64_FPTR64MSB	0x46	/* @fptr(sym + add), data8 MSB */
+#define R_IA64_FPTR64LSB	0x47	/* @fptr(sym + add), data8 LSB */
+#define R_IA64_PCREL60B		0x48	/* @pcrel(sym + add), brl */
+#define R_IA64_PCREL21B		0x49	/* @pcrel(sym + add), ptb, call */
+#define R_IA64_PCREL21M		0x4a	/* @pcrel(sym + add), chk.s */
+#define R_IA64_PCREL21F		0x4b	/* @pcrel(sym + add), fchkf */
+#define R_IA64_PCREL32MSB	0x4c	/* @pcrel(sym + add), data4 MSB */
+#define R_IA64_PCREL32LSB	0x4d	/* @pcrel(sym + add), data4 LSB */
+#define R_IA64_PCREL64MSB	0x4e	/* @pcrel(sym + add), data8 MSB */
+#define R_IA64_PCREL64LSB	0x4f	/* @pcrel(sym + add), data8 LSB */
+#define R_IA64_LTOFF_FPTR22	0x52	/* @ltoff(@fptr(s+a)), imm22 */
+#define R_IA64_LTOFF_FPTR64I	0x53	/* @ltoff(@fptr(s+a)), imm64 */
+#define R_IA64_LTOFF_FPTR32MSB	0x54	/* @ltoff(@fptr(s+a)), data4 MSB */
+#define R_IA64_LTOFF_FPTR32LSB	0x55	/* @ltoff(@fptr(s+a)), data4 LSB */
+#define R_IA64_LTOFF_FPTR64MSB	0x56	/* @ltoff(@fptr(s+a)), data8 MSB */
+#define R_IA64_LTOFF_FPTR64LSB	0x57	/* @ltoff(@fptr(s+a)), data8 LSB */
+#define R_IA64_SEGREL32MSB	0x5c	/* @segrel(sym + add), data4 MSB */
+#define R_IA64_SEGREL32LSB	0x5d	/* @segrel(sym + add), data4 LSB */
+#define R_IA64_SEGREL64MSB	0x5e	/* @segrel(sym + add), data8 MSB */
+#define R_IA64_SEGREL64LSB	0x5f	/* @segrel(sym + add), data8 LSB */
+#define R_IA64_SECREL32MSB	0x64	/* @secrel(sym + add), data4 MSB */
+#define R_IA64_SECREL32LSB	0x65	/* @secrel(sym + add), data4 LSB */
+#define R_IA64_SECREL64MSB	0x66	/* @secrel(sym + add), data8 MSB */
+#define R_IA64_SECREL64LSB	0x67	/* @secrel(sym + add), data8 LSB */
+#define R_IA64_REL32MSB		0x6c	/* data 4 + REL */
+#define R_IA64_REL32LSB		0x6d	/* data 4 + REL */
+#define R_IA64_REL64MSB		0x6e	/* data 8 + REL */
+#define R_IA64_REL64LSB		0x6f	/* data 8 + REL */
+#define R_IA64_LTV32MSB		0x74	/* symbol + addend, data4 MSB */
+#define R_IA64_LTV32LSB		0x75	/* symbol + addend, data4 LSB */
+#define R_IA64_LTV64MSB		0x76	/* symbol + addend, data8 MSB */
+#define R_IA64_LTV64LSB		0x77	/* symbol + addend, data8 LSB */
+#define R_IA64_PCREL21BI	0x79	/* @pcrel(sym + add), 21bit inst */
+#define R_IA64_PCREL22		0x7a	/* @pcrel(sym + add), 22bit inst */
+#define R_IA64_PCREL64I		0x7b	/* @pcrel(sym + add), 64bit inst */
+#define R_IA64_IPLTMSB		0x80	/* dynamic reloc, imported PLT, MSB */
+#define R_IA64_IPLTLSB		0x81	/* dynamic reloc, imported PLT, LSB */
+#define R_IA64_COPY		0x84	/* copy relocation */
+#define R_IA64_SUB		0x85	/* Addend and symbol difference */
+#define R_IA64_LTOFF22X		0x86	/* LTOFF22, relaxable.  */
+#define R_IA64_LDXMOV		0x87	/* Use of LTOFF22X.  */
+#define R_IA64_TPREL14		0x91	/* @tprel(sym + add), imm14 */
+#define R_IA64_TPREL22		0x92	/* @tprel(sym + add), imm22 */
+#define R_IA64_TPREL64I		0x93	/* @tprel(sym + add), imm64 */
+#define R_IA64_TPREL64MSB	0x96	/* @tprel(sym + add), data8 MSB */
+#define R_IA64_TPREL64LSB	0x97	/* @tprel(sym + add), data8 LSB */
+#define R_IA64_LTOFF_TPREL22	0x9a	/* @ltoff(@tprel(s+a)), imm2 */
+#define R_IA64_DTPMOD64MSB	0xa6	/* @dtpmod(sym + add), data8 MSB */
+#define R_IA64_DTPMOD64LSB	0xa7	/* @dtpmod(sym + add), data8 LSB */
+#define R_IA64_LTOFF_DTPMOD22	0xaa	/* @ltoff(@dtpmod(sym + add)), imm22 */
+#define R_IA64_DTPREL14		0xb1	/* @dtprel(sym + add), imm14 */
+#define R_IA64_DTPREL22		0xb2	/* @dtprel(sym + add), imm22 */
+#define R_IA64_DTPREL64I	0xb3	/* @dtprel(sym + add), imm64 */
+#define R_IA64_DTPREL32MSB	0xb4	/* @dtprel(sym + add), data4 MSB */
+#define R_IA64_DTPREL32LSB	0xb5	/* @dtprel(sym + add), data4 LSB */
+#define R_IA64_DTPREL64MSB	0xb6	/* @dtprel(sym + add), data8 MSB */
+#define R_IA64_DTPREL64LSB	0xb7	/* @dtprel(sym + add), data8 LSB */
+#define R_IA64_LTOFF_DTPREL22	0xba	/* @ltoff(@dtprel(s+a)), imm22 */
+
+/* SH specific declarations */
+
+/* SH relocs.  */
+#define	R_SH_NONE		0
+#define	R_SH_DIR32		1
+#define	R_SH_REL32		2
+#define	R_SH_DIR8WPN		3
+#define	R_SH_IND12W		4
+#define	R_SH_DIR8WPL		5
+#define	R_SH_DIR8WPZ		6
+#define	R_SH_DIR8BP		7
+#define	R_SH_DIR8W		8
+#define	R_SH_DIR8L		9
+#define	R_SH_SWITCH16		25
+#define	R_SH_SWITCH32		26
+#define	R_SH_USES		27
+#define	R_SH_COUNT		28
+#define	R_SH_ALIGN		29
+#define	R_SH_CODE		30
+#define	R_SH_DATA		31
+#define	R_SH_LABEL		32
+#define	R_SH_SWITCH8		33
+#define	R_SH_GNU_VTINHERIT	34
+#define	R_SH_GNU_VTENTRY	35
+#define	R_SH_TLS_GD_32		144
+#define	R_SH_TLS_LD_32		145
+#define	R_SH_TLS_LDO_32		146
+#define	R_SH_TLS_IE_32		147
+#define	R_SH_TLS_LE_32		148
+#define	R_SH_TLS_DTPMOD32	149
+#define	R_SH_TLS_DTPOFF32	150
+#define	R_SH_TLS_TPOFF32	151
+#define	R_SH_GOT32		160
+#define	R_SH_PLT32		161
+#define	R_SH_COPY		162
+#define	R_SH_GLOB_DAT		163
+#define	R_SH_JMP_SLOT		164
+#define	R_SH_RELATIVE		165
+#define	R_SH_GOTOFF		166
+#define	R_SH_GOTPC		167
+/* Keep this the last entry.  */
+#define	R_SH_NUM		256
+
+/* Additional s390 relocs */
+
+#define R_390_NONE		0	/* No reloc.  */
+#define R_390_8			1	/* Direct 8 bit.  */
+#define R_390_12		2	/* Direct 12 bit.  */
+#define R_390_16		3	/* Direct 16 bit.  */
+#define R_390_32		4	/* Direct 32 bit.  */
+#define R_390_PC32		5	/* PC relative 32 bit.	*/
+#define R_390_GOT12		6	/* 12 bit GOT offset.  */
+#define R_390_GOT32		7	/* 32 bit GOT offset.  */
+#define R_390_PLT32		8	/* 32 bit PC relative PLT address.  */
+#define R_390_COPY		9	/* Copy symbol at runtime.  */
+#define R_390_GLOB_DAT		10	/* Create GOT entry.  */
+#define R_390_JMP_SLOT		11	/* Create PLT entry.  */
+#define R_390_RELATIVE		12	/* Adjust by program base.  */
+#define R_390_GOTOFF32		13	/* 32 bit offset to GOT.	 */
+#define R_390_GOTPC		14	/* 32 bit PC relative offset to GOT.  */
+#define R_390_GOT16		15	/* 16 bit GOT offset.  */
+#define R_390_PC16		16	/* PC relative 16 bit.	*/
+#define R_390_PC16DBL		17	/* PC relative 16 bit shifted by 1.  */
+#define R_390_PLT16DBL		18	/* 16 bit PC rel. PLT shifted by 1.  */
+#define R_390_PC32DBL		19	/* PC relative 32 bit shifted by 1.  */
+#define R_390_PLT32DBL		20	/* 32 bit PC rel. PLT shifted by 1.  */
+#define R_390_GOTPCDBL		21	/* 32 bit PC rel. GOT shifted by 1.  */
+#define R_390_64		22	/* Direct 64 bit.  */
+#define R_390_PC64		23	/* PC relative 64 bit.	*/
+#define R_390_GOT64		24	/* 64 bit GOT offset.  */
+#define R_390_PLT64		25	/* 64 bit PC relative PLT address.  */
+#define R_390_GOTENT		26	/* 32 bit PC rel. to GOT entry >> 1. */
+#define R_390_GOTOFF16		27	/* 16 bit offset to GOT. */
+#define R_390_GOTOFF64		28	/* 64 bit offset to GOT. */
+#define R_390_GOTPLT12		29	/* 12 bit offset to jump slot.	*/
+#define R_390_GOTPLT16		30	/* 16 bit offset to jump slot.	*/
+#define R_390_GOTPLT32		31	/* 32 bit offset to jump slot.	*/
+#define R_390_GOTPLT64		32	/* 64 bit offset to jump slot.	*/
+#define R_390_GOTPLTENT		33	/* 32 bit rel. offset to jump slot.  */
+#define R_390_PLTOFF16		34	/* 16 bit offset from GOT to PLT. */
+#define R_390_PLTOFF32		35	/* 32 bit offset from GOT to PLT. */
+#define R_390_PLTOFF64		36	/* 16 bit offset from GOT to PLT. */
+#define R_390_TLS_LOAD		37	/* Tag for load insn in TLS code.  */
+#define R_390_TLS_GDCALL	38	/* Tag for function call in general
+					   dynamic TLS code. */
+#define R_390_TLS_LDCALL	39	/* Tag for function call in local
+					   dynamic TLS code. */
+#define R_390_TLS_GD32		40	/* Direct 32 bit for general dynamic
+					   thread local data.  */
+#define R_390_TLS_GD64		41	/* Direct 64 bit for general dynamic
+					  thread local data.  */
+#define R_390_TLS_GOTIE12	42	/* 12 bit GOT offset for static TLS
+					   block offset.  */
+#define R_390_TLS_GOTIE32	43	/* 32 bit GOT offset for static TLS
+					   block offset.  */
+#define R_390_TLS_GOTIE64	44	/* 64 bit GOT offset for static TLS
+					   block offset. */
+#define R_390_TLS_LDM32		45	/* Direct 32 bit for local dynamic
+					   thread local data in LE code.  */
+#define R_390_TLS_LDM64		46	/* Direct 64 bit for local dynamic
+					   thread local data in LE code.  */
+#define R_390_TLS_IE32		47	/* 32 bit address of GOT entry for
+					   negated static TLS block offset.  */
+#define R_390_TLS_IE64		48	/* 64 bit address of GOT entry for
+					   negated static TLS block offset.  */
+#define R_390_TLS_IEENT		49	/* 32 bit rel. offset to GOT entry for
+					   negated static TLS block offset.  */
+#define R_390_TLS_LE32		50	/* 32 bit negated offset relative to
+					   static TLS block.  */
+#define R_390_TLS_LE64		51	/* 64 bit negated offset relative to
+					   static TLS block.  */
+#define R_390_TLS_LDO32		52	/* 32 bit offset relative to TLS
+					   block.  */
+#define R_390_TLS_LDO64		53	/* 64 bit offset relative to TLS
+					   block.  */
+#define R_390_TLS_DTPMOD	54	/* ID of module containing symbol.  */
+#define R_390_TLS_DTPOFF	55	/* Offset in TLS block.	 */
+#define R_390_TLS_TPOFF		56	/* Negated offset in static TLS
+					   block.  */
+#define R_390_20		57	/* Direct 20 bit.  */
+#define R_390_GOT20		58	/* 20 bit GOT offset.  */
+#define R_390_GOTPLT20		59	/* 20 bit offset to jump slot.  */
+#define R_390_TLS_GOTIE20	60	/* 20 bit GOT offset for static TLS
+					   block offset.  */
+/* Keep this the last entry.  */
+#define R_390_NUM		61
+
+
+/* CRIS relocations.  */
+#define R_CRIS_NONE		0
+#define R_CRIS_8		1
+#define R_CRIS_16		2
+#define R_CRIS_32		3
+#define R_CRIS_8_PCREL		4
+#define R_CRIS_16_PCREL		5
+#define R_CRIS_32_PCREL		6
+#define R_CRIS_GNU_VTINHERIT	7
+#define R_CRIS_GNU_VTENTRY	8
+#define R_CRIS_COPY		9
+#define R_CRIS_GLOB_DAT		10
+#define R_CRIS_JUMP_SLOT	11
+#define R_CRIS_RELATIVE		12
+#define R_CRIS_16_GOT		13
+#define R_CRIS_32_GOT		14
+#define R_CRIS_16_GOTPLT	15
+#define R_CRIS_32_GOTPLT	16
+#define R_CRIS_32_GOTREL	17
+#define R_CRIS_32_PLT_GOTREL	18
+#define R_CRIS_32_PLT_PCREL	19
+
+#define R_CRIS_NUM		20
+
+
+/* AMD x86-64 relocations.  */
+#define R_X86_64_NONE		0	/* No reloc */
+#define R_X86_64_64		1	/* Direct 64 bit  */
+#define R_X86_64_PC32		2	/* PC relative 32 bit signed */
+#define R_X86_64_GOT32		3	/* 32 bit GOT entry */
+#define R_X86_64_PLT32		4	/* 32 bit PLT address */
+#define R_X86_64_COPY		5	/* Copy symbol at runtime */
+#define R_X86_64_GLOB_DAT	6	/* Create GOT entry */
+#define R_X86_64_JUMP_SLOT	7	/* Create PLT entry */
+#define R_X86_64_RELATIVE	8	/* Adjust by program base */
+#define R_X86_64_GOTPCREL	9	/* 32 bit signed PC relative
+					   offset to GOT */
+#define R_X86_64_32		10	/* Direct 32 bit zero extended */
+#define R_X86_64_32S		11	/* Direct 32 bit sign extended */
+#define R_X86_64_16		12	/* Direct 16 bit zero extended */
+#define R_X86_64_PC16		13	/* 16 bit sign extended pc relative */
+#define R_X86_64_8		14	/* Direct 8 bit sign extended  */
+#define R_X86_64_PC8		15	/* 8 bit sign extended pc relative */
+#define R_X86_64_DTPMOD64	16	/* ID of module containing symbol */
+#define R_X86_64_DTPOFF64	17	/* Offset in module's TLS block */
+#define R_X86_64_TPOFF64	18	/* Offset in initial TLS block */
+#define R_X86_64_TLSGD		19	/* 32 bit signed PC relative offset
+					   to two GOT entries for GD symbol */
+#define R_X86_64_TLSLD		20	/* 32 bit signed PC relative offset
+					   to two GOT entries for LD symbol */
+#define R_X86_64_DTPOFF32	21	/* Offset in TLS block */
+#define R_X86_64_GOTTPOFF	22	/* 32 bit signed PC relative offset
+					   to GOT entry for IE symbol */
+#define R_X86_64_TPOFF32	23	/* Offset in initial TLS block */
+#define R_X86_64_PC64		24	/* PC relative 64 bit */
+#define R_X86_64_GOTOFF64	25	/* 64 bit offset to GOT */
+#define R_X86_64_GOTPC32	26	/* 32 bit signed pc relative
+					   offset to GOT */
+/* 27 .. 33 */
+#define R_X86_64_GOTPC32_TLSDESC 34	/* GOT offset for TLS descriptor.  */
+#define R_X86_64_TLSDESC_CALL   35	/* Marker for call through TLS
+					   descriptor.  */
+#define R_X86_64_TLSDESC        36	/* TLS descriptor.  */
+
+#define R_X86_64_NUM		37
+
+
+/* AM33 relocations.  */
+#define R_MN10300_NONE		0	/* No reloc.  */
+#define R_MN10300_32		1	/* Direct 32 bit.  */
+#define R_MN10300_16		2	/* Direct 16 bit.  */
+#define R_MN10300_8		3	/* Direct 8 bit.  */
+#define R_MN10300_PCREL32	4	/* PC-relative 32-bit.  */
+#define R_MN10300_PCREL16	5	/* PC-relative 16-bit signed.  */
+#define R_MN10300_PCREL8	6	/* PC-relative 8-bit signed.  */
+#define R_MN10300_GNU_VTINHERIT	7	/* Ancient C++ vtable garbage... */
+#define R_MN10300_GNU_VTENTRY	8	/* ... collection annotation.  */
+#define R_MN10300_24		9	/* Direct 24 bit.  */
+#define R_MN10300_GOTPC32	10	/* 32-bit PCrel offset to GOT.  */
+#define R_MN10300_GOTPC16	11	/* 16-bit PCrel offset to GOT.  */
+#define R_MN10300_GOTOFF32	12	/* 32-bit offset from GOT.  */
+#define R_MN10300_GOTOFF24	13	/* 24-bit offset from GOT.  */
+#define R_MN10300_GOTOFF16	14	/* 16-bit offset from GOT.  */
+#define R_MN10300_PLT32		15	/* 32-bit PCrel to PLT entry.  */
+#define R_MN10300_PLT16		16	/* 16-bit PCrel to PLT entry.  */
+#define R_MN10300_GOT32		17	/* 32-bit offset to GOT entry.  */
+#define R_MN10300_GOT24		18	/* 24-bit offset to GOT entry.  */
+#define R_MN10300_GOT16		19	/* 16-bit offset to GOT entry.  */
+#define R_MN10300_COPY		20	/* Copy symbol at runtime.  */
+#define R_MN10300_GLOB_DAT	21	/* Create GOT entry.  */
+#define R_MN10300_JMP_SLOT	22	/* Create PLT entry.  */
+#define R_MN10300_RELATIVE	23	/* Adjust by program base.  */
+
+#define R_MN10300_NUM		24
+
+
+/* M32R relocs.  */
+#define R_M32R_NONE		0	/* No reloc. */
+#define R_M32R_16		1	/* Direct 16 bit. */
+#define R_M32R_32		2	/* Direct 32 bit. */
+#define R_M32R_24		3	/* Direct 24 bit. */
+#define R_M32R_10_PCREL		4	/* PC relative 10 bit shifted. */
+#define R_M32R_18_PCREL		5	/* PC relative 18 bit shifted. */
+#define R_M32R_26_PCREL		6	/* PC relative 26 bit shifted. */
+#define R_M32R_HI16_ULO		7	/* High 16 bit with unsigned low. */
+#define R_M32R_HI16_SLO		8	/* High 16 bit with signed low. */
+#define R_M32R_LO16		9	/* Low 16 bit. */
+#define R_M32R_SDA16		10	/* 16 bit offset in SDA. */
+#define R_M32R_GNU_VTINHERIT	11
+#define R_M32R_GNU_VTENTRY	12
+/* M32R relocs use SHT_RELA.  */
+#define R_M32R_16_RELA		33	/* Direct 16 bit. */
+#define R_M32R_32_RELA		34	/* Direct 32 bit. */
+#define R_M32R_24_RELA		35	/* Direct 24 bit. */
+#define R_M32R_10_PCREL_RELA	36	/* PC relative 10 bit shifted. */
+#define R_M32R_18_PCREL_RELA	37	/* PC relative 18 bit shifted. */
+#define R_M32R_26_PCREL_RELA	38	/* PC relative 26 bit shifted. */
+#define R_M32R_HI16_ULO_RELA	39	/* High 16 bit with unsigned low */
+#define R_M32R_HI16_SLO_RELA	40	/* High 16 bit with signed low */
+#define R_M32R_LO16_RELA	41	/* Low 16 bit */
+#define R_M32R_SDA16_RELA	42	/* 16 bit offset in SDA */
+#define R_M32R_RELA_GNU_VTINHERIT	43
+#define R_M32R_RELA_GNU_VTENTRY	44
+#define R_M32R_REL32		45	/* PC relative 32 bit.  */
+
+#define R_M32R_GOT24		48	/* 24 bit GOT entry */
+#define R_M32R_26_PLTREL	49	/* 26 bit PC relative to PLT shifted */
+#define R_M32R_COPY		50	/* Copy symbol at runtime */
+#define R_M32R_GLOB_DAT		51	/* Create GOT entry */
+#define R_M32R_JMP_SLOT		52	/* Create PLT entry */
+#define R_M32R_RELATIVE		53	/* Adjust by program base */
+#define R_M32R_GOTOFF		54	/* 24 bit offset to GOT */
+#define R_M32R_GOTPC24		55	/* 24 bit PC relative offset to GOT */
+#define R_M32R_GOT16_HI_ULO	56	/* High 16 bit GOT entry with unsigned
+					   low */
+#define R_M32R_GOT16_HI_SLO	57	/* High 16 bit GOT entry with signed
+					   low */
+#define R_M32R_GOT16_LO		58	/* Low 16 bit GOT entry */
+#define R_M32R_GOTPC_HI_ULO	59	/* High 16 bit PC relative offset to
+					   GOT with unsigned low */
+#define R_M32R_GOTPC_HI_SLO	60	/* High 16 bit PC relative offset to
+					   GOT with signed low */
+#define R_M32R_GOTPC_LO		61	/* Low 16 bit PC relative offset to
+					   GOT */
+#define R_M32R_GOTOFF_HI_ULO	62	/* High 16 bit offset to GOT
+					   with unsigned low */
+#define R_M32R_GOTOFF_HI_SLO	63	/* High 16 bit offset to GOT
+					   with signed low */
+#define R_M32R_GOTOFF_LO	64	/* Low 16 bit offset to GOT */
+#define R_M32R_NUM		256	/* Keep this the last entry. */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* elf.h */
diff --git openjdk-orig/hotspot/lsb/include/link.h openjdk/hotspot/lsb/include/link.h
new file mode 100644
index 0000000..c36d3d7
--- /dev/null
+++ openjdk/hotspot/lsb/include/link.h
@@ -0,0 +1,3 @@
+
+/* empty file.  LSB version does not need it */
+
diff --git openjdk-orig/hotspot/lsb/include/mntent.h openjdk/hotspot/lsb/include/mntent.h
new file mode 100644
index 0000000..9ade427
--- /dev/null
+++ openjdk/hotspot/lsb/include/mntent.h
@@ -0,0 +1,101 @@
+/* Utilities for reading/writing fstab, mtab, etc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_MNTENT_H_OPENJDK_WRAPPER
+#define	_MNTENT_H_OPENJDK_WRAPPER	1
+
+#include <stdio.h>
+#include <paths.h>
+
+
+/* File listing canonical interesting mount points.  */
+#define	MNTTAB		_PATH_MNTTAB	/* Deprecated alias.  */
+
+/* File listing currently active mount points.  */
+#define	MOUNTED		_PATH_MOUNTED	/* Deprecated alias.  */
+
+
+/* General filesystem types.  */
+#define MNTTYPE_IGNORE	"ignore"	/* Ignore this entry.  */
+#define MNTTYPE_NFS	"nfs"		/* Network file system.  */
+#define MNTTYPE_SWAP	"swap"		/* Swap device.  */
+
+
+/* Generic mount options.  */
+#define MNTOPT_DEFAULTS	"defaults"	/* Use all default options.  */
+#define MNTOPT_RO	"ro"		/* Read only.  */
+#define MNTOPT_RW	"rw"		/* Read/write.  */
+#define MNTOPT_SUID	"suid"		/* Set uid allowed.  */
+#define MNTOPT_NOSUID	"nosuid"	/* No set uid allowed.  */
+#define MNTOPT_NOAUTO	"noauto"	/* Do not auto mount.  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#define __THROW throw()
+#else
+#define __THROW 
+#endif
+
+/* Structure describing a mount table entry.  */
+struct mntent
+  {
+    char *mnt_fsname;		/* Device or server for filesystem.  */
+    char *mnt_dir;		/* Directory mounted on.  */
+    char *mnt_type;		/* Type of filesystem: ufs, nfs, etc.  */
+    char *mnt_opts;		/* Comma-separated options for fs.  */
+    int mnt_freq;		/* Dump frequency (in days).  */
+    int mnt_passno;		/* Pass number for `fsck'.  */
+  };
+
+
+/* Prepare to begin reading and/or writing mount table entries from the
+   beginning of FILE.  MODE is as for `fopen'.  */
+extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW;
+
+/* Read one mount table entry from STREAM.  Returns a pointer to storage
+   reused on the next call, or null for EOF or error (use feof/ferror to
+   check).  */
+extern struct mntent *getmntent (FILE *__stream) __THROW;
+
+/* Reentrant version of the above function.  */
+extern struct mntent *getmntent_r (FILE *__restrict __stream,
+				   struct mntent *__restrict __result,
+				   char *__restrict __buffer,
+				   int __bufsize) __THROW;
+
+/* Write the mount table entry described by MNT to STREAM.
+   Return zero on success, nonzero on failure.  */
+extern int addmntent (FILE *__restrict __stream,
+		      __const struct mntent *__restrict __mnt) __THROW;
+
+/* Close a stream opened with `setmntent'.  */
+extern int endmntent (FILE *__stream) __THROW;
+
+/* Search MNT->mnt_opts for an option matching OPT.
+   Returns the address of the substring, or null if none found.  */
+extern char *hasmntopt (__const struct mntent *__mnt,
+			__const char *__opt) __THROW;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* mntent.h */
diff --git openjdk-orig/hotspot/lsb/include/sys/ptrace.h openjdk/hotspot/lsb/include/sys/ptrace.h
new file mode 100644
index 0000000..b2d6f48
--- /dev/null
+++ openjdk/hotspot/lsb/include/sys/ptrace.h
@@ -0,0 +1,155 @@
+
+
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Type of the REQUEST argument to `ptrace.'  */
+enum __ptrace_request
+{
+  /* Indicate that the process making this request should be traced.
+     All signals received by this process can be intercepted by its
+     parent, and its parent can use the other `ptrace' requests.  */
+  PTRACE_TRACEME = 0,
+#define PT_TRACE_ME PTRACE_TRACEME
+
+  /* Return the word in the process's text space at address ADDR.  */
+  PTRACE_PEEKTEXT = 1,
+#define PT_READ_I PTRACE_PEEKTEXT
+
+  /* Return the word in the process's data space at address ADDR.  */
+  PTRACE_PEEKDATA = 2,
+#define PT_READ_D PTRACE_PEEKDATA
+
+  /* Return the word in the process's user area at offset ADDR.  */
+  PTRACE_PEEKUSER = 3,
+#define PT_READ_U PTRACE_PEEKUSER
+
+  /* Write the word DATA into the process's text space at address ADDR.  */
+  PTRACE_POKETEXT = 4,
+#define PT_WRITE_I PTRACE_POKETEXT
+
+  /* Write the word DATA into the process's data space at address ADDR.  */
+  PTRACE_POKEDATA = 5,
+#define PT_WRITE_D PTRACE_POKEDATA
+
+  /* Write the word DATA into the process's user area at offset ADDR.  */
+  PTRACE_POKEUSER = 6,
+#define PT_WRITE_U PTRACE_POKEUSER
+
+  /* Continue the process.  */
+  PTRACE_CONT = 7,
+#define PT_CONTINUE PTRACE_CONT
+
+  /* Kill the process.  */
+  PTRACE_KILL = 8,
+#define PT_KILL PTRACE_KILL
+
+  /* Single step the process.
+     This is not supported on all machines.  */
+  PTRACE_SINGLESTEP = 9,
+#define PT_STEP PTRACE_SINGLESTEP
+
+  /* Get all general purpose registers used by a processes.
+     This is not supported on all machines.  */
+   PTRACE_GETREGS = 12,
+#define PT_GETREGS PTRACE_GETREGS
+
+  /* Set all general purpose registers used by a processes.
+     This is not supported on all machines.  */
+   PTRACE_SETREGS = 13,
+#define PT_SETREGS PTRACE_SETREGS
+
+  /* Get all floating point registers used by a processes.
+     This is not supported on all machines.  */
+   PTRACE_GETFPREGS = 14,
+#define PT_GETFPREGS PTRACE_GETFPREGS
+
+  /* Set all floating point registers used by a processes.
+     This is not supported on all machines.  */
+   PTRACE_SETFPREGS = 15,
+#define PT_SETFPREGS PTRACE_SETFPREGS
+
+  /* Attach to a process that is already running. */
+  PTRACE_ATTACH = 16,
+#define PT_ATTACH PTRACE_ATTACH
+
+  /* Detach from a process attached to with PTRACE_ATTACH.  */
+  PTRACE_DETACH = 17,
+#define PT_DETACH PTRACE_DETACH
+
+  /* Get all extended floating point registers used by a processes.
+     This is not supported on all machines.  */
+   PTRACE_GETFPXREGS = 18,
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+
+  /* Set all extended floating point registers used by a processes.
+     This is not supported on all machines.  */
+   PTRACE_SETFPXREGS = 19,
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+
+  /* Continue and stop at the next (return from) syscall.  */
+  PTRACE_SYSCALL = 24,
+#define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+};
+
+
+/* Options set using PTRACE_SETOPTIONS.  */
+enum __ptrace_setoptions {
+  PTRACE_O_TRACESYSGOOD	= 0x00000001,
+  PTRACE_O_TRACEFORK	= 0x00000002,
+  PTRACE_O_TRACEVFORK   = 0x00000004,
+  PTRACE_O_TRACECLONE	= 0x00000008,
+  PTRACE_O_TRACEEXEC	= 0x00000010,
+  PTRACE_O_TRACEVFORKDONE = 0x00000020,
+  PTRACE_O_TRACEEXIT	= 0x00000040,
+  PTRACE_O_MASK		= 0x0000007f
+};
+
+/* Wait extended result codes for the above trace options.  */
+enum __ptrace_eventcodes {
+  PTRACE_EVENT_FORK	= 1,
+  PTRACE_EVENT_VFORK	= 2,
+  PTRACE_EVENT_CLONE	= 3,
+  PTRACE_EVENT_EXEC	= 4,
+  PTRACE_EVENT_VFORK_DONE = 5,
+  PTRACE_EVENT_EXIT	= 6
+};
+
+/* Perform process tracing functions.  REQUEST is one of the values
+   above, and determines the action to be taken.
+   For all requests except PTRACE_TRACEME, PID specifies the process to be
+   traced.
+
+   PID and the other arguments described above for the various requests should
+   appear (those that are used for the particular request) as:
+     pid_t PID, void *ADDR, int DATA, void *ADDR2
+   after REQUEST.  */
+extern long int ptrace(enum __ptrace_request request, pid_t pid,
+                  void *addr, void *data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // include sentry
+
diff --git openjdk-orig/hotspot/lsb/include/sys/sysinfo.h openjdk/hotspot/lsb/include/sys/sysinfo.h
new file mode 100644
index 0000000..2ce1843
--- /dev/null
+++ openjdk/hotspot/lsb/include/sys/sysinfo.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 1996, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H	1
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* struct sysinfo from linux/kernel.h.  Complies to sysinfo manpage */
+struct sysinfo {
+	long uptime;			/* Seconds since boot */
+	unsigned long loads[3];		/* 1, 5, and 15 minute load averages */
+	unsigned long totalram;		/* Total usable main memory size */
+	unsigned long freeram;		/* Available memory size */
+	unsigned long sharedram;	/* Amount of shared memory */
+	unsigned long bufferram;	/* Memory used by buffers */
+	unsigned long totalswap;	/* Total swap space size */
+	unsigned long freeswap;		/* swap space still available */
+	unsigned short procs;		/* Number of current processes */
+	unsigned short pad;		/* explicit padding for m68k */
+	unsigned long totalhigh;	/* Total high memory size */
+	unsigned long freehigh;		/* Available high memory size */
+	unsigned int mem_unit;		/* Memory unit size in bytes */
+	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
+};
+
+/* Returns information on overall system statistics.  */
+extern int sysinfo (struct sysinfo *__info);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif	/* sys/sysinfo.h */
+
diff --git openjdk-orig/hotspot/lsb/include/syscall.h openjdk/hotspot/lsb/include/syscall.h
new file mode 100644
index 0000000..6fc1ab9
--- /dev/null
+++ openjdk/hotspot/lsb/include/syscall.h
@@ -0,0 +1,19 @@
+
+/* syscall wrappers id we need something */
+
+#ifndef _SYSCALL_H
+#define _SYSCALL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int syscall_gettid_available();
+extern int syscall_gettid();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //Include sentry
+
diff --git openjdk-orig/hotspot/lsb/include/thread_db.h openjdk/hotspot/lsb/include/thread_db.h
new file mode 100644
index 0000000..c071170
--- /dev/null
+++ openjdk/hotspot/lsb/include/thread_db.h
@@ -0,0 +1,371 @@
+
+/* LSB-compliant interface to libthread_db used in Serviceability agent */
+/* We picked only the functions used */
+
+/* thread_db.h -- interface to libthread_db.so library for debugging -lpthread
+   Copyright (C) 1999,2001,2002,2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _THREAD_DB_H
+#define _THREAD_DB_H	1
+
+/* This is the debugger interface for the NPTL library.  It is
+   modelled closely after the interface with same names in Solaris
+   with the goal to share the same code in the debugger.  */
+#include <pthread.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/procfs.h>
+#include <sys/wait.h>
+#include <signal.h>
+
+
+/* Error codes of the library.  */
+typedef enum
+{
+  TD_OK,	  /* No error.  */
+  TD_ERR,	  /* No further specified error.  */
+  TD_NOTHR,	  /* No matching thread found.  */
+  TD_NOSV,	  /* No matching synchronization handle found.  */
+  TD_NOLWP,	  /* No matching light-weighted process found.  */
+  TD_BADPH,	  /* Invalid process handle.  */
+  TD_BADTH,	  /* Invalid thread handle.  */
+  TD_BADSH,	  /* Invalid synchronization handle.  */
+  TD_BADTA,	  /* Invalid thread agent.  */
+  TD_BADKEY,	  /* Invalid key.  */
+  TD_NOMSG,	  /* No event available.  */
+  TD_NOFPREGS,	  /* No floating-point register content available.  */
+  TD_NOLIBTHREAD, /* Application not linked with thread library.  */
+  TD_NOEVENT,	  /* Requested event is not supported.  */
+  TD_NOCAPAB,	  /* Capability not available.  */
+  TD_DBERR,	  /* Internal debug library error.  */
+  TD_NOAPLIC,	  /* Operation is not applicable.  */
+  TD_NOTSD,	  /* No thread-specific data available.  */
+  TD_MALLOC,	  /* Out of memory.  */
+  TD_PARTIALREG,  /* Not entire register set was read or written.  */
+  TD_NOXREGS,	  /* X register set not available for given thread.  */
+  TD_TLSDEFER,	  /* Thread has not yet allocated TLS for given module.  */
+  TD_NOTALLOC = TD_TLSDEFER,
+  TD_VERSION,	  /* Version if libpthread and libthread_db do not match.  */
+  TD_NOTLS	  /* There is no TLS segment in the given module.  */
+} td_err_e;
+
+
+/* Possible thread states.  TD_THR_ANY_STATE is a pseudo-state used to
+   select threads regardless of state in td_ta_thr_iter().  */
+typedef enum
+{
+  TD_THR_ANY_STATE,
+  TD_THR_UNKNOWN,
+  TD_THR_STOPPED,
+  TD_THR_RUN,
+  TD_THR_ACTIVE,
+  TD_THR_ZOMBIE,
+  TD_THR_SLEEP,
+  TD_THR_STOPPED_ASLEEP
+} td_thr_state_e;
+
+/* Thread type: user or system.  TD_THR_ANY_TYPE is a pseudo-type used
+   to select threads regardless of type in td_ta_thr_iter().  */
+typedef enum
+{
+  TD_THR_ANY_TYPE,
+  TD_THR_USER,
+  TD_THR_SYSTEM
+} td_thr_type_e;
+
+
+/* Types of the debugging library.  */
+
+/* Handle for a process.  This type is opaque.  */
+typedef struct td_thragent td_thragent_t;
+
+/* The actual thread handle type.  This is also opaque.  */
+typedef struct td_thrhandle
+{
+  td_thragent_t *th_ta_p;
+  psaddr_t th_unique;
+} td_thrhandle_t;
+
+
+/* Forward declaration of a type defined by and for the dynamic linker.  */
+struct link_map;
+
+
+/* Flags for `td_ta_thr_iter'.  */
+#define TD_THR_ANY_USER_FLAGS	0xffffffff
+#define TD_THR_LOWEST_PRIORITY	-20
+#define TD_SIGNO_MASK		NULL
+
+
+#define TD_EVENTSIZE	2
+#define BT_UISHIFT	5 /* log base 2 of BT_NBIPUI, to extract word index */
+#define BT_NBIPUI	(1 << BT_UISHIFT)       /* n bits per uint */
+#define BT_UIMASK	(BT_NBIPUI - 1)         /* to extract bit index */
+
+/* Bitmask of enabled events. */
+typedef struct td_thr_events
+{
+  uint32_t event_bits[TD_EVENTSIZE];
+} td_thr_events_t;
+
+/* Event set manipulation macros. */
+#define __td_eventmask(n) \
+  (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
+#define __td_eventword(n) \
+  ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
+
+#define td_event_emptyset(setp) \
+  do {									      \
+    int __i;								      \
+    for (__i = TD_EVENTSIZE; __i > 0; --__i)				      \
+      (setp)->event_bits[__i - 1] = 0;					      \
+  } while (0)
+
+#define td_event_fillset(setp) \
+  do {									      \
+    int __i;								      \
+    for (__i = TD_EVENTSIZE; __i > 0; --__i)				      \
+      (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff);		      \
+  } while (0)
+
+#define td_event_addset(setp, n) \
+  (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n))
+#define td_event_delset(setp, n) \
+  (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n))
+#define td_eventismember(setp, n) \
+  (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)]))
+#if TD_EVENTSIZE == 2
+# define td_eventisempty(setp) \
+  (!((setp)->event_bits[0]) && !((setp)->event_bits[1]))
+#else
+# error "td_eventisempty must be changed to match TD_EVENTSIZE"
+#endif
+
+/* Events reportable by the thread implementation.  */
+typedef enum
+{
+  TD_ALL_EVENTS,		 /* Pseudo-event number.  */
+  TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context.  */
+  TD_READY,			 /* Is executable now. */
+  TD_SLEEP,			 /* Blocked in a synchronization obj.  */
+  TD_SWITCHTO,			 /* Now assigned to a process.  */
+  TD_SWITCHFROM,		 /* Not anymore assigned to a process.  */
+  TD_LOCK_TRY,			 /* Trying to get an unavailable lock.  */
+  TD_CATCHSIG,			 /* Signal posted to the thread.  */
+  TD_IDLE,			 /* Process getting idle.  */
+  TD_CREATE,			 /* New thread created.  */
+  TD_DEATH,			 /* Thread terminated.  */
+  TD_PREEMPT,			 /* Preempted.  */
+  TD_PRI_INHERIT,		 /* Inherited elevated priority.  */
+  TD_REAP,			 /* Reaped.  */
+  TD_CONCURRENCY,		 /* Number of processes changing.  */
+  TD_TIMEOUT,			 /* Conditional variable wait timed out.  */
+  TD_MIN_EVENT_NUM = TD_READY,
+  TD_MAX_EVENT_NUM = TD_TIMEOUT,
+  TD_EVENTS_ENABLE = 31		/* Event reporting enabled.  */
+} td_event_e;
+
+/* Values representing the different ways events are reported.  */
+typedef enum
+{
+  NOTIFY_BPT,			/* User must insert breakpoint at u.bptaddr. */
+  NOTIFY_AUTOBPT,		/* Breakpoint at u.bptaddr is automatically
+				   inserted.  */
+  NOTIFY_SYSCALL		/* System call u.syscallno will be invoked.  */
+} td_notify_e;
+
+/* Description how event type is reported.  */
+typedef struct td_notify
+{
+  td_notify_e type;		/* Way the event is reported.  */
+  union
+  {
+    psaddr_t bptaddr;		/* Address of breakpoint.  */
+    int syscallno;		/* Number of system call used.  */
+  } u;
+} td_notify_t;
+
+/* Structure used to report event.  */
+typedef struct td_event_msg
+{
+  td_event_e event;		/* Event type being reported.  */
+  const td_thrhandle_t *th_p;	/* Thread reporting the event.  */
+  union
+  {
+# if 0
+    td_synchandle_t *sh;	/* Handle of synchronization object.  */
+#endif
+    uintptr_t data;		/* Event specific data.  */
+  } msg;
+} td_event_msg_t;
+
+/* Structure containing event data available in each thread structure.  */
+typedef struct
+{
+  td_thr_events_t eventmask;	/* Mask of enabled events.  */
+  td_event_e eventnum;		/* Number of last event.  */
+  void *eventdata;		/* Data associated with event.  */
+} td_eventbuf_t;
+
+
+/* Gathered statistics about the process.  */
+typedef struct td_ta_stats
+{
+  int nthreads;       		/* Total number of threads in use.  */
+  int r_concurrency;		/* Concurrency level requested by user.  */
+  int nrunnable_num;		/* Average runnable threads, numerator.  */
+  int nrunnable_den;		/* Average runnable threads, denominator.  */
+  int a_concurrency_num;	/* Achieved concurrency level, numerator.  */
+  int a_concurrency_den;	/* Achieved concurrency level, denominator.  */
+  int nlwps_num;		/* Average number of processes in use,
+				   numerator.  */
+  int nlwps_den;		/* Average number of processes in use,
+				   denominator.  */
+  int nidle_num;		/* Average number of idling processes,
+				   numerator.  */
+  int nidle_den;		/* Average number of idling processes,
+				   denominator.  */
+} td_ta_stats_t;
+
+
+/* Since Sun's library is based on Solaris threads we have to define a few
+   types to map them to POSIX threads.  */
+typedef pthread_t thread_t;
+typedef pthread_key_t thread_key_t;
+
+
+/* Callback for iteration over threads.  */
+typedef int td_thr_iter_f (const td_thrhandle_t *, void *);
+
+/* Callback for iteration over thread local data.  */
+typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *);
+
+
+
+/* Forward declaration.  This has to be defined by the user.  */
+struct ps_prochandle;
+
+
+/* Information about the thread.  */
+typedef struct td_thrinfo
+{
+  td_thragent_t *ti_ta_p;		/* Process handle.  */
+  unsigned int ti_user_flags;		/* Unused.  */
+  thread_t ti_tid;			/* Thread ID returned by
+					   pthread_create().  */
+  char *ti_tls;				/* Pointer to thread-local data.  */
+  psaddr_t ti_startfunc;		/* Start function passed to
+					   pthread_create().  */
+  psaddr_t ti_stkbase;			/* Base of thread's stack.  */
+  long int ti_stksize;			/* Size of thread's stack.  */
+  psaddr_t ti_ro_area;			/* Unused.  */
+  int ti_ro_size;			/* Unused.  */
+  td_thr_state_e ti_state;		/* Thread state.  */
+  unsigned char ti_db_suspended;	/* Nonzero if suspended by debugger. */
+  td_thr_type_e ti_type;		/* Type of the thread (system vs
+					   user thread).  */
+  intptr_t ti_pc;			/* Unused.  */
+  intptr_t ti_sp;			/* Unused.  */
+  short int ti_flags;			/* Unused.  */
+  int ti_pri;				/* Thread priority.  */
+  lwpid_t ti_lid;			/* Kernel PID for this thread.  */
+  sigset_t ti_sigmask;			/* Signal mask.  */
+  unsigned char ti_traceme;		/* Nonzero if event reporting
+					   enabled.  */
+  unsigned char ti_preemptflag;		/* Unused.  */
+  unsigned char ti_pirecflag;		/* Unused.  */
+  sigset_t ti_pending;			/* Set of pending signals.  */
+  td_thr_events_t ti_events;		/* Set of enabled events.  */
+} td_thrinfo_t;
+
+#endif	/* thread_db.h */
+
+#ifndef _LSB_LIBTHREAD_DB_H
+#define _LSB_LIBTHREAD_DB_H
+
+
+/* Initialize the thread debug support library.  */
+extern td_err_e td_init (void);
+
+/* Generate new thread debug library handle for process PS.  */
+
+extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta);
+
+/* Free resources allocated for TA.  */
+extern td_err_e td_ta_delete (td_thragent_t *__ta);
+
+/* Call for each thread in a process associated with TA the callback function
+   CALLBACK.  */
+extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta,
+				td_thr_iter_f *__callback, void *__cbdata_p,
+				td_thr_state_e __state, int __ti_pri,
+				sigset_t *__ti_sigmask_p,
+				unsigned int __ti_user_flags);
+
+/* Return information about thread TH.  */
+extern td_err_e td_thr_get_info (const td_thrhandle_t *__th,
+				 td_thrinfo_t *__infop);
+
+// Slight incomplete definition of link_map structure
+
+struct link_map
+  {
+    /* These first few members are part of the protocol with the debugger.
+       This is the same format used in SVR4.  */
+
+    uint32_t l_addr;      /* Base address shared object is loaded at.  */
+    char *l_name;       /* Absolute file name object was found in.  */
+    struct  {
+      int32_t d_tag;
+      union {
+        uint32_t d_val;
+        uint32_t d_ptr;
+      } d_un;
+    } *l_ld;        /* Dynamic section of the shared object.  */
+    struct link_map *l_next, *l_prev; /* Chain of loaded objects.  */
+  };
+
+// complete r_debug
+struct r_debug
+  {
+    int r_version;		/* Version number for this protocol.  */
+
+    struct link_map *r_map;	/* Head of the chain of loaded objects.  */
+
+    /* This is the address of a function internal to the run-time linker,
+       that will always be called when the linker begins to map in a
+       library or unmap it, and again when the mapping change is complete.
+       The debugger can set a breakpoint at this address if it wants to
+       notice shared object mapping changes.  */
+    uint32_t r_brk;
+    enum
+      {
+        /* This state value describes the mapping change taking place when
+           the `r_brk' address is called.  */
+        RT_CONSISTENT,		/* Mapping change is complete.  */
+        RT_ADD,			/* Beginning to add a new object.  */
+        RT_DELETE		/* Beginning to remove an object mapping.  */
+      } r_state;
+
+    uint32_t r_ldbase;	/* Base address the linker is loaded at.  */
+  };
+
+
+#endif
+
diff --git openjdk-orig/hotspot/lsb/lsb_config.h openjdk/hotspot/lsb/lsb_config.h
new file mode 100644
index 0000000..013f6c7
--- /dev/null
+++ openjdk/hotspot/lsb/lsb_config.h
@@ -0,0 +1,219 @@
+/* LSB interfaces availability configuration file
+
+Think of it as of autoconf's config.h.  (Actually, if you're going to
+undermine the intent of this file, you actually may write an autoconf script
+for its contents.)  The constants defined here are used to determine
+availiability in compile-time.
+
+Also the file contains functions to determine availability in runtime.  They
+are named like function_available() and libsomething_available().
+
+NOTE on automatic conditions.  The macro __LSB_PROVIDES_xxx actually means
+``xxx can be reached via normal #include and does not require a wrapper''.
+That actually means that xxx should either be provided by LSB or a non-LSB
+build should be running atm.  That's why conditions have an additional maxterm
+``!defined __LSB_VERSION__''.
+*/
+
+#ifndef _LSB_CONFIG_H
+#define _LSB_CONFIG_H
+
+/* Several interfaces are not included in LSB but should be included or
+reviewed in future.  In order not to let you forget about them, I'm making
+the autobuild fail on newer standards, so that the autobuild maintainer
+would be notified about that.
+If you are not SURE, to what version the interface will be included,
+use __LSB_NEXT_STANDARD macro */
+
+#define __LSB_NEXT_STANDARD 41
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "lsb_helpers.h"
+
+// pthread_getattr_np (bug #2364)
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_pthread_getattr_np
+#define pthread_getattr_np_available() 1
+#else
+LSB_AVAIL_RUNTIME(pthread_getattr_np);
+#endif
+
+// dlvsym (bug #2673)
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_dlvsym
+#define dlvsym_available() 1
+#else
+LSB_AVAIL_RUNTIME(dlvsym);
+#endif
+
+// sysinfo (bug #2163)
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_sysinfo
+#define sysinfo_available() 1
+#else
+LSB_AVAIL_RUNTIME(sysinfo);
+#endif
+
+
+// mntent group -- interfaces for reading /etc/fstab
+
+// mntent_r
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_setmntent
+#define setmntent_available() 1
+#define __LSB_PROVIDES_getmntent_r
+#define getmntent_r_available() 1
+#define __LSB_PROVIDES_endmntent
+#define endmntent_available() 1
+#define __LSB_PROVIDES_sysinfo
+#define sysinfo_available() 1
+#else
+LSB_AVAIL_RUNTIME(setmntent);
+LSB_AVAIL_RUNTIME(getmntent_r);
+LSB_AVAIL_RUNTIME(endmntent);
+#endif
+
+
+// snd_rawmidi_info
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_snd_rawmidi_info
+#define snd_rawmidi_info_available() 1
+#else
+LSB_AVAIL_RUNTIME(snd_rawmidi_info);
+#endif
+
+
+// snd_rawmidi_info_get_card
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_snd_rawmidi_info_get_card
+#define snd_rawmidi_info_get_card_available() 1
+#else
+LSB_AVAIL_RUNTIME(snd_rawmidi_info_get_card);
+#endif
+
+// Different flags
+
+// enum snd_seq_event_type
+// I think it's a mistake that it's not in LSB.
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_snd_seq_event_type
+#define snd_seq_event_type_available() 1
+#else
+#define snd_seq_event_type_available() 0
+#endif
+
+// SO_PEERCRED
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_SO_PEERCRED
+#define SO_PEERCRED_available() 1
+#else
+#define SO_PEERCRED_available() 0
+#endif
+
+// IFHWADDRLEN
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_IFHWADDRLEN
+#define IFHWADDRLEN_available() 1
+#else
+#define IFHWADDRLEN_available() 0
+#endif
+
+
+// dlopen's RTLD_NOLOAD
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_RTLD_NOLOAD
+#define RTLD_NOLOAD_available() 1
+#else
+#define RTLD_NOLOAD_available() 0
+#endif
+
+
+//MAP_NORESERVE
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_MAP_NORESERVE
+#define MAP_NORESERVE_available() 1
+#else
+#define MAP_NORESERVE_available() 0
+#endif
+
+
+//FT_StreamRec.  Small omission.
+#if (__LSB_VERSION__ >= 41) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_FT_StreamRec
+#define FT_StreamRec_available() 1
+#else
+#define FT_StreamRec_available() 0
+#endif
+
+
+// FT_GlyphSlot_Embolden
+#if (__LSB_VERSION__ >= __LSB_NEXT_STANDARD) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_FT_GlyphSlot_Embolden
+#define FT_GlyphSlot_Embolden_available() 1
+#else
+LSB_AVAIL_RUNTIME(FT_GlyphSlot_Embolden);
+#endif
+
+// FT_GlyphSlot_Oblique
+#if (__LSB_VERSION__ >= __LSB_NEXT_STANDARD) || (!defined __LSB_VERSION__)
+#define __LSB_PROVIDES_FT_GlyphSlot_Oblique
+#define FT_GlyphSlot_Oblique_available() 1
+#else
+LSB_AVAIL_RUNTIME(FT_GlyphSlot_Oblique);
+#endif
+
+
+
+// The support of the following functions is not planned
+// Therefore, we have to enwrap them in ifdef condition that triggers only
+// if we're doing an lsb build.
+
+#ifdef __LSB_VERSION__
+
+
+// libthread_db
+#undef __LSB_PROVIDES_libthread_db
+LSB_AVAIL_RUNTIME(libthread_db);
+
+// ptrace (bug #1664)
+#undef __LSB_PROVIDES_ptrace
+LSB_AVAIL_RUNTIME(ptrace);
+
+// syscalls
+#undef __LSB_PROVIDES_syscall_gettid
+#define syscall_gettid_available() 0
+// For more fine grained syscall availability and calling interfaces see
+// include/syscall.h
+
+#undef __LSB_PROVIDES_syscall_fork
+#undef __LSB_PROVIDES_syscall_exevce
+
+#undef __LSB_PROVIDES_NAME_MAX
+
+// This flag is used in such a way, that it actually does no sense on modern 
+// kernels and workarounds RFC incompliance of older ones.  So, it does no
+// harm to leave this as never-in-lsb and define the flag.
+// For more info see http://marc.info/?l=linux-netdev&m=120851487828101&w=2
+#undef __LSB_PROVIDES_IPV6_CHECKSUM
+
+
+// mincore is too low-level and Java specs allow it to be absent
+#undef __LSB_PROVIDES_mincore
+
+
+// The value is used in the implementation of library inlined into openjdk
+#undef __LSB_PROVIDES_MSG_FIN
+
+
+#endif // __LSB_VERSION__
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // include sentry
+
diff --git openjdk-orig/hotspot/lsb/lsb_flags.h openjdk/hotspot/lsb/lsb_flags.h
new file mode 100644
index 0000000..10db826
--- /dev/null
+++ openjdk/hotspot/lsb/lsb_flags.h
@@ -0,0 +1,94 @@
+/* LSB flags overrides
+
+Some interfaces are in LSB but do not have certain options, i.e. some flags
+are missing.  This doesn't cause errors in dynamic linking, but can cause
+1) Absence of flag in interface's implementation as LSB doesn't require it
+    That's unlikely to happen, because hardly anyone would re-compile 
+    glibc or something else like in gentoo with its use-flags.
+2) Not enough quality for interface - the flag is not tested.
+    OpenJDK's code is very vulnerable and workarounds are always added in
+    these cases.  But if a flag requires non-lsb workaround, then this flag
+    is better be added and tested.
+
+So, this file provides the flags and other compile-time stuff that is declared
+in headers, that are included to LSB, but is itself absent from LSB.
+
+*/
+
+#ifndef _LSB_FLAGS_H
+#define _LSB_FLAGS_H
+
+#ifndef __LSB_PROVIDES_MAP_NORESERVE
+// from <sys/mmap.h>
+#define MAP_NORESERVE 0x04000
+#endif
+
+// For register flags
+#include "static/lsb_ucontext.h"
+
+// To use NAME_MAX in some places
+#ifndef __LSB_PROVIDES_NAME_MAX
+// It's 256, but we'll give it more--just in case
+#define NAME_MAX_FORBIDDEN 1024
+#else
+#define NAME_MAX_FORBIDDEN NAME_MAX
+#endif
+
+
+// SO_PEERCRED.  Unix domain socket to allow inter-process (or inter-thread)
+// communication with authorization with uids and gids.
+#ifndef __LSB_PROVIDES_SO_PEERCRED
+// from 2.6.30 kernel sources
+#if (defined __powerpc__) || (defined __powerpc64__)
+#define SO_PEERCRED 21
+#else
+#define SO_PEERCRED	17
+#endif
+
+//now we also need structure to store cred_info.  That's simple.
+
+struct ucred
+{
+  pid_t pid;			/* PID of sending process.  */
+  uid_t uid;			/* UID of sending process.  */
+  gid_t gid;			/* GID of sending process.  */
+};
+
+#endif
+
+
+#include "static/lsb_dlfcn.h"
+
+
+#ifndef __LSB_PROVIDES_IFHWADDRLEN
+// defined in net/if.h
+#define IFHWADDRLEN 6
+#endif
+
+
+
+#ifndef __LSB_PROVIDES_IPV6_CHECKSUM
+#define IPV6_CHECKSUM 7
+#endif
+
+
+#ifndef __LSB_PROVIDES_MSG_FIN
+//taken from glibc sources.
+#define MSG_FIN 0x200
+#endif
+
+
+// for alsa missing interfaces
+#include "static/alsa/lsb_seq_event.h"
+
+
+#ifndef __LSB_PROVIDES_FT_StreamRec
+//that's just an omission in freetype
+#include "ft2build.h"
+#include FT_SYSTEM_H
+typedef struct  FT_StreamRec_ FT_StreamRec;
+#endif
+
+#endif //include sentry
+
+
diff --git openjdk-orig/hotspot/lsb/lsb_helpers.c openjdk/hotspot/lsb/lsb_helpers.c
new file mode 100644
index 0000000..62e4237
--- /dev/null
+++ openjdk/hotspot/lsb/lsb_helpers.c
@@ -0,0 +1,20 @@
+
+#ifndef __LSB_VERSION__
+// dlfcn.h manual requires _GNU_SOURCE for RTLD_DEFAULT
+#define _GNU_SOURCE
+#endif
+
+#include <dlfcn.h>
+#include "lsb_helpers.h"
+
+char DEFAULT_name[] = "RTLD_DEFAULT";
+int DEFAULT_available()
+{
+    //always available
+    return 1;
+}
+void* DEFAULT_handle()
+{
+    return RTLD_DEFAULT;
+}
+
diff --git openjdk-orig/hotspot/lsb/lsb_helpers.h openjdk/hotspot/lsb/lsb_helpers.h
new file mode 100644
index 0000000..03134a8
--- /dev/null
+++ openjdk/hotspot/lsb/lsb_helpers.h
@@ -0,0 +1,87 @@
+/* LSB wrapper helpers
+
+The header file contains helpers for LSB wrappers generation.
+*/
+
+#ifndef __LSB_HELPERS_H
+#define __LSB_HELPERS_H
+
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Library dlopen helpers.  lib_id is an identifier to refer to this library
+   and lib_soname is a string with sonema to dlopen.
+*/
+#define LSB_LIB_LOAD(lib_id, lib_soname) \
+void * lib_id##_h; \
+int lib_id##_h_tried = 0; \
+char lib_id##_name[] = lib_soname; \
+int lib_id##_available() \
+{ \
+    if (!lib_id##_h_tried){ \
+        lib_id##_h = dlopen(lib_soname,RTLD_LAZY | RTLD_GLOBAL); \
+        lib_id##_h_tried = 1; \
+        return (int)(lib_id##_h); \
+    }else{ \
+        return (int)(lib_id##_h); \
+    } \
+} \
+void* lib_id##_handle() \
+{ \
+    if (! lib_id##_available()){ \
+        fprintf(stderr,"Required library %s is absent in your system.  LSB does not require it to present, but the program can't run without it.  Sorry.\n",lib_soname); \
+        exit(-1); \
+    } \
+    return lib_id##_h; \
+} \
+
+// availablilty declaration for lsb_config.h
+#define LSB_AVAIL_RUNTIME(something) extern int something##_available();
+
+// f - name of funciton defined in some other place
+// lib - id of library as supplied in LSB_LIB_LOAD
+#define LSB_CHECKER(lib,f) \
+__typeof__(f) * f##_a;  \
+char const* f##_lib_name = lib##_name;  \
+int f##_a_tried = 0;  \
+int f##_available() \
+{ \
+    if (f##_a_tried){ \
+        return (int)f##_a; \
+    }else{ \
+        if (!lib##_available()){ \
+            return 0; \
+        } \
+        *(void **) (&f##_a)=dlsym(lib##_handle(), #f); \
+        f##_a_tried = 1; \
+        return (int)f##_a; \
+    } \
+}
+
+/* Unfortunately, there is no way to predefine a macro for automatic wrapper 
+   generation.  So you're just to copy it from the header file and use the
+   LSB_WRAPPER_CALL macro, like that:
+
+        int function(int arg1, void* arg2)
+        {
+            LSB_WRAPPER_CALL(library_id,function,arg1,arg2);
+        }
+
+*/
+#define LSB_WRAPPER_CALL(f, ...) \
+    if (!f##_available()) \
+    { \
+        fprintf(stderr,"Required interface %s is absent in your system's library %s.  LSB does not require it to present, but the program can't run without it.  Sorry.\n",#f,f##_lib_name); \
+        exit(-1); \
+    } \
+    return (*f##_a)(__VA_ARGS__)
+
+/* Special handle for symbols that are dlsym'ed from RTLD_DEFAULT.
+   Such symbols should be assigned to DEFAULT library */
+extern char DEFAULT_name[];
+extern int DEFAULT_available();
+extern void* DEFAULT_handle();
+
+#endif //include sentry
+
diff --git openjdk-orig/hotspot/lsb/lsb_wrappers.c openjdk/hotspot/lsb/lsb_wrappers.c
new file mode 100644
index 0000000..d521a2c
--- /dev/null
+++ openjdk/hotspot/lsb/lsb_wrappers.c
@@ -0,0 +1,172 @@
+/* LSB wrapper implementation
+
+This unit conrains wrappers for non-lsb functions that are used throughout
+the OpenJDK project.  It dynamically loads them and implements functions
+to check their availibility in runtime as well as wrapper implementations
+with the same name as the original. */
+
+#include "lsb_config.h"
+#include "lsb_helpers.h"
+
+#ifndef __LSB_PROVIDES_libthread_db
+#include <thread_db.h>
+LSB_LIB_LOAD(thread_db,"libthread_db.so");
+LSB_CHECKER(thread_db,td_init);
+LSB_CHECKER(thread_db,td_ta_new);
+LSB_CHECKER(thread_db,td_thr_get_info);
+LSB_CHECKER(thread_db,td_ta_thr_iter);
+LSB_CHECKER(thread_db,td_ta_delete);
+
+/* As this function is used as checker for correct libthread_db loader
+   in OpenJDK code, let it return error gracefully if td_init wasn't actually
+   loaded.
+
+   We also rely on this function as on the first function from libthread_db
+   called in openjdk code.  So, we do some dlopen magic here for it to be
+   loaded correctly.
+*/
+td_err_e td_init (void)
+{
+    /* libthread_db contains several undefined symbols that should be found
+       in the library it's linked agains in compile time.  As we don't link
+       it in compile time due to its possible inavailability, we have to
+       use dlopen magic and re-open libsaproc.so to allow consequent dlsyms
+       to find undefined symbols dynamically.
+    */
+    dlopen("libsaproc.so",RTLD_NOW|RTLD_GLOBAL);
+    if (!td_init_available()){
+        fprintf(stderr,"Due to absence of libthread_db, the functionality is not supported on your system.\n");
+        return TD_ERR;
+    }
+    LSB_WRAPPER_CALL(td_init);
+}
+
+td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta)
+{
+    LSB_WRAPPER_CALL(td_ta_new,__ps,__ta);
+}
+
+td_err_e td_ta_delete (td_thragent_t *__ta)
+{
+    LSB_WRAPPER_CALL(td_ta_delete,__ta);
+}
+
+td_err_e td_ta_thr_iter (const td_thragent_t *__ta,
+				td_thr_iter_f *__callback, void *__cbdata_p,
+				td_thr_state_e __state, int __ti_pri,
+				sigset_t *__ti_sigmask_p,
+				unsigned int __ti_user_flags)
+{
+    LSB_WRAPPER_CALL(td_ta_thr_iter,__ta,__callback,__cbdata_p,__state,__ti_pri,__ti_sigmask_p,__ti_user_flags);
+}
+
+td_err_e td_thr_get_info (const td_thrhandle_t *__th, td_thrinfo_t *__infop)
+{
+    LSB_WRAPPER_CALL(td_thr_get_info,__th,__infop);
+}
+#endif  // __LSB_PROVIDES_libthread_db
+
+#ifndef __LSB_PROVIDES_ptrace
+#include <sys/ptrace.h>
+LSB_CHECKER(DEFAULT,ptrace);
+long int ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data)
+{
+    LSB_WRAPPER_CALL(ptrace,request,pid,addr,data);
+}
+#endif  // LSB_PROVIDES_ptrace
+
+#ifndef __LSB_PROVIDES_dlvsym
+#include <lsb_wrappers.h>
+// wrappers are assigned to DEFAULT library -- see lsb_wrappers.h
+LSB_CHECKER(DEFAULT,dlvsym);
+void *dlvsym(void *handle, char const *symbol, char const *version)
+{
+    LSB_WRAPPER_CALL(dlvsym,handle,symbol,version);
+}
+#endif  // __LSB_PROVIDES_dlvsym
+
+
+#ifndef __LSB_PROVIDES_pthread_getattr_np
+#include <lsb_wrappers.h>
+#include <pthread.h>
+// wrappers are assigned to DEFAULT library -- see lsb_wrappers.h
+LSB_CHECKER(DEFAULT,pthread_getattr_np);
+int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr)
+{
+    LSB_WRAPPER_CALL(pthread_getattr_np,__th,__attr);
+}
+#endif
+
+
+
+#ifndef __LSB_PROVIDES_sysinfo
+#include <lsb_wrappers.h>
+#include <sys/sysinfo.h>
+LSB_CHECKER(DEFAULT,sysinfo);
+int sysinfo (struct sysinfo *__info)
+{
+    LSB_WRAPPER_CALL(sysinfo,__info);
+}
+#endif
+
+
+#ifndef __LSB_PROVIDES_mincore
+#include <lsb_wrappers.h>
+LSB_CHECKER(DEFAULT,mincore);
+int mincore (void *__start, size_t __len, unsigned char *__vec)
+{
+    LSB_WRAPPER_CALL(mincore,__start,__len,__vec);
+}
+#endif
+
+
+#ifndef __LSB_PROVIDES_getmntent_r
+#include <mntent.h>
+LSB_CHECKER(DEFAULT,getmntent_r);
+struct mntent *getmntent_r (FILE *__restrict __stream,
+				   struct mntent *__restrict __result,
+				   char *__restrict __buffer,
+				   int __bufsize) 
+{
+    LSB_WRAPPER_CALL(getmntent_r,__stream,__result,__buffer,__bufsize);
+}
+#endif
+
+#ifndef __LSB_PROVIDES_setmntent
+#include <mntent.h>
+LSB_CHECKER(DEFAULT,setmntent);
+FILE *setmntent (__const char *__file, __const char *__mode) 
+{
+    LSB_WRAPPER_CALL(setmntent,__file,__mode);
+}
+#endif
+
+#ifndef __LSB_PROVIDES_endmntent
+#include <mntent.h>
+LSB_CHECKER(DEFAULT,endmntent);
+int endmntent (FILE *__stream) 
+{
+    LSB_WRAPPER_CALL(endmntent,__stream);
+}
+#endif
+
+
+#ifndef __LSB_PROVIDES_snd_rawmidi_info
+#include <lsb_wrappers.h>
+LSB_CHECKER(DEFAULT,snd_rawmidi_info);
+int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info)
+{
+    LSB_WRAPPER_CALL(snd_rawmidi_info,rmidi,info);
+}
+#endif
+
+#ifndef __LSB_PROVIDES_snd_rawmidi_info_get_card
+#include <lsb_wrappers.h>
+LSB_CHECKER(DEFAULT,snd_rawmidi_info_get_card);
+int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj)
+{
+    LSB_WRAPPER_CALL(snd_rawmidi_info_get_card,obj);
+}
+#endif
+
+
diff --git openjdk-orig/hotspot/lsb/lsb_wrappers.h openjdk/hotspot/lsb/lsb_wrappers.h
new file mode 100644
index 0000000..30dbb2b
--- /dev/null
+++ openjdk/hotspot/lsb/lsb_wrappers.h
@@ -0,0 +1,40 @@
+/* Wrappers for non-lsb interfaces
+
+Some interfaces are not in LSB, but are declared in the headeres that are
+in standard.  If we would like to call them, we need a separate file to
+include.
+
+Interfaces that require separate header are declared in header files
+stored in lsb/include/.
+
+The interfaces declared here are usually assigned to DEFAULT library in
+lsb_wrappers.c.  The reason is that if developer included an LSB header
+into its source file, he should have linked it with the proper library.
+So, at the point of dlopening the wrapped interface, its library should
+already be loaded.  All rules have exceptions, though.
+
+*/
+
+#ifndef _LSB_WRAPPERS_H
+#define _LSB_WRAPPERS_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "static/lsb_pthread.h"
+
+#include "static/lsb_dlfcn.h"
+
+#include "static/lsb_freetype.h"
+
+#include "static/sys/lsb_mman.h"
+
+#include "static/alsa/lsb_rawmidi.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //include sentry
+
diff --git openjdk-orig/hotspot/lsb/static/alsa/lsb_rawmidi.h openjdk/hotspot/lsb/static/alsa/lsb_rawmidi.h
new file mode 100644
index 0000000..d65a53a
--- /dev/null
+++ openjdk/hotspot/lsb/static/alsa/lsb_rawmidi.h
@@ -0,0 +1,19 @@
+
+#ifndef _ALSA_RAWMIDI_H_OPENJDK_WRAPPER
+#define _ALSA_RAWMIDI_H_OPENJDK_WRAPPER
+
+#include <alsa/rawmidi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
+int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // include sentry
+
diff --git openjdk-orig/hotspot/lsb/static/alsa/lsb_seq_event.h openjdk/hotspot/lsb/static/alsa/lsb_seq_event.h
new file mode 100644
index 0000000..d9bd643
--- /dev/null
+++ openjdk/hotspot/lsb/static/alsa/lsb_seq_event.h
@@ -0,0 +1,144 @@
+
+
+#ifndef _ALSA_SEQ_EVENT_H_OPENJDK_WRAPPER
+#define _ALSA_SEQ_EVENT_H_OPENJDK_WRAPPER
+
+#ifndef __LSB_PROVIDES_snd_seq_event_type
+
+/** Sequencer event type */
+enum snd_seq_event_type {
+	/** system status; event data type = #snd_seq_result_t */
+	SND_SEQ_EVENT_SYSTEM = 0,
+	/** returned result status; event data type = #snd_seq_result_t */
+	SND_SEQ_EVENT_RESULT,
+
+	/** note on and off with duration; event data type = #snd_seq_ev_note_t */
+	SND_SEQ_EVENT_NOTE = 5,
+	/** note on; event data type = #snd_seq_ev_note_t */
+	SND_SEQ_EVENT_NOTEON,
+	/** note off; event data type = #snd_seq_ev_note_t */
+	SND_SEQ_EVENT_NOTEOFF,
+	/** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
+	SND_SEQ_EVENT_KEYPRESS,
+	
+	/** controller; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_CONTROLLER = 10,
+	/** program change; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_PGMCHANGE,
+	/** channel pressure; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_CHANPRESS,
+	/** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
+	SND_SEQ_EVENT_PITCHBEND,
+	/** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_CONTROL14,
+	/** 14 bit NRPN;  event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_NONREGPARAM,
+	/** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_REGPARAM,
+
+	/** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_SONGPOS = 20,
+	/** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_SONGSEL,
+	/** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_QFRAME,
+	/** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_TIMESIGN,
+	/** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
+	SND_SEQ_EVENT_KEYSIGN,
+	        
+	/** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_START = 30,
+	/** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_CONTINUE,
+	/** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_STOP,
+	/** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_SETPOS_TICK,
+	/** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_SETPOS_TIME,
+	/** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_TEMPO,
+	/** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_CLOCK,
+	/** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_TICK,
+	/** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_QUEUE_SKEW,
+	/** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
+	SND_SEQ_EVENT_SYNC_POS,
+
+	/** Tune request; event data type = none */
+	SND_SEQ_EVENT_TUNE_REQUEST = 40,
+	/** Reset to power-on state; event data type = none */
+	SND_SEQ_EVENT_RESET,
+	/** Active sensing event; event data type = none */
+	SND_SEQ_EVENT_SENSING,
+
+	/** Echo-back event; event data type = any type */
+	SND_SEQ_EVENT_ECHO = 50,
+	/** OSS emulation raw event; event data type = any type */
+	SND_SEQ_EVENT_OSS,
+
+	/** New client has connected; event data type = #snd_seq_addr_t */
+	SND_SEQ_EVENT_CLIENT_START = 60,
+	/** Client has left the system; event data type = #snd_seq_addr_t */
+	SND_SEQ_EVENT_CLIENT_EXIT,
+	/** Client status/info has changed; event data type = #snd_seq_addr_t */
+	SND_SEQ_EVENT_CLIENT_CHANGE,
+	/** New port was created; event data type = #snd_seq_addr_t */
+	SND_SEQ_EVENT_PORT_START,
+	/** Port was deleted from system; event data type = #snd_seq_addr_t */
+	SND_SEQ_EVENT_PORT_EXIT,
+	/** Port status/info has changed; event data type = #snd_seq_addr_t */
+	SND_SEQ_EVENT_PORT_CHANGE,
+
+	/** Ports connected; event data type = #snd_seq_connect_t */
+	SND_SEQ_EVENT_PORT_SUBSCRIBED,
+	/** Ports disconnected; event data type = #snd_seq_connect_t */
+	SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
+
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR0 = 90,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR1,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR2,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR3,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR4,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR5,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR6,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR7,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR8,
+	/** user-defined event; event data type = any (fixed size) */
+	SND_SEQ_EVENT_USR9,
+
+	/** system exclusive data (variable length);  event data type = #snd_seq_ev_ext_t */
+	SND_SEQ_EVENT_SYSEX = 130,
+	/** error event;  event data type = #snd_seq_ev_ext_t */
+	SND_SEQ_EVENT_BOUNCE,
+	/** reserved for user apps;  event data type = #snd_seq_ev_ext_t */
+	SND_SEQ_EVENT_USR_VAR0 = 135,
+	/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+	SND_SEQ_EVENT_USR_VAR1,
+	/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+	SND_SEQ_EVENT_USR_VAR2,
+	/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+	SND_SEQ_EVENT_USR_VAR3,
+	/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+	SND_SEQ_EVENT_USR_VAR4,
+
+	/** NOP; ignored in any case */
+	SND_SEQ_EVENT_NONE = 255
+};
+#endif
+
+
+#endif // include sentry
+
diff --git openjdk-orig/hotspot/lsb/static/freetype_impl.c openjdk/hotspot/lsb/static/freetype_impl.c
new file mode 100644
index 0000000..ffa42c1
--- /dev/null
+++ openjdk/hotspot/lsb/static/freetype_impl.c
@@ -0,0 +1,279 @@
+
+
+/* File that implements a couple of Freetype functions that
+   are not in LSB but are used in OpenJDK 7 */
+
+// Includes that define types and functions implemented
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TRIGONOMETRY_H
+#include FT_BITMAP_H
+#include FT_GLYPH_H
+
+#include "lsb_freetype.h"
+
+#include <lsb_config.h>
+
+  FT_Error
+  FT_Outline_Embolden( FT_Outline*  outline,
+                       FT_Pos       strength );
+#ifdef __LSB_PROVIDES_FT_GlyphSlot_Embolden
+  FT_Error
+  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );
+#endif
+
+#ifdef __LSB_PROVIDES_FT_GlyphSlot_Embolden
+  void
+  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )
+  {
+    FT_Library  library = slot->library;
+    FT_Face     face    = slot->face;
+    FT_Error    error;
+    FT_Pos      xstr, ystr;
+
+
+    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&
+         slot->format != FT_GLYPH_FORMAT_BITMAP )
+      return;
+
+    /* some reasonable strength */
+    xstr = FT_MulFix( face->units_per_EM,
+                      face->size->metrics.y_scale ) / 24;
+    ystr = xstr;
+
+    if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
+    {
+      error = FT_Outline_Embolden( &slot->outline, xstr );
+      /* ignore error */
+
+      /* this is more than enough for most glyphs; if you need accurate */
+      /* values, you have to call FT_Outline_Get_CBox                   */
+      xstr = xstr * 2;
+      ystr = xstr;
+    }
+    else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
+    {
+      /* round to full pixels */
+      xstr &= ~63;
+      if ( xstr == 0 )
+        xstr = 1 << 6;
+      ystr &= ~63;
+
+      error = FT_GlyphSlot_Own_Bitmap( slot );
+      if ( error )
+        return;
+
+      error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );
+      if ( error )
+        return;
+    }
+
+    if ( slot->advance.x )
+      slot->advance.x += xstr;
+
+    if ( slot->advance.y )
+      slot->advance.y += ystr;
+
+    slot->metrics.width        += xstr;
+    slot->metrics.height       += ystr;
+    slot->metrics.horiBearingY += ystr;
+    slot->metrics.horiAdvance  += xstr;
+    slot->metrics.vertBearingX -= xstr / 2;
+    slot->metrics.vertBearingY += ystr;
+    slot->metrics.vertAdvance  += ystr;
+
+    if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
+      slot->bitmap_top += ystr >> 6;
+  }
+#endif
+
+#ifdef __LSB_PROVIDES_FT_GlyphSlot_Oblique
+  void
+  FT_GlyphSlot_Oblique( FT_GlyphSlot  slot )
+  {
+    FT_Matrix    transform;
+    FT_Outline*  outline = &slot->outline;
+
+
+    /* only oblique outline glyphs */
+    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
+      return;
+
+    /* we don't touch the advance width */
+
+    /* For italic, simply apply a shear transform, with an angle */
+    /* of about 12 degrees.                                      */
+
+    transform.xx = 0x10000L;
+    transform.yx = 0x00000L;
+
+    transform.xy = 0x06000L;
+    transform.yy = 0x10000L;
+
+    FT_Outline_Transform( outline, &transform );
+  }
+#endif
+
+
+  /* We encarve this internal structure here because, in order to retain
+     binary compatibility, Freetype developers will keep at least these fields
+     unchanged. */
+  typedef struct  FT_GlyphLoadRec_
+  {
+    FT_Outline   outline;       /* outline                   */
+    FT_Vector*   extra_points;  /* extra points table        */
+    FT_Vector*   extra_points2; /* second extra points table */
+    FT_UInt      num_subglyphs; /* number of subglyphs       */
+    FT_SubGlyph  subglyphs;     /* subglyphs                 */
+
+  } FT_GlyphLoadRec, *FT_GlyphLoad;
+
+  typedef struct  FT_GlyphLoaderRec_
+  {
+    FT_Memory        memory;
+    FT_UInt          max_points;
+    FT_UInt          max_contours;
+    FT_UInt          max_subglyphs;
+    FT_Bool          use_extra;
+
+    FT_GlyphLoadRec  base;
+    FT_GlyphLoadRec  current;
+
+    void*            other;            /* for possible future extension? */
+
+  } FT_GlyphLoaderRec;
+    typedef struct FT_GlyphLoaderRec_*  FT_GlyphLoader ;
+
+#define FT_GLYPH_OWN_BITMAP  0x1
+
+  typedef struct  FT_Slot_InternalRec_  
+  { 
+    FT_GlyphLoader  loader; 
+    FT_UInt         flags; 
+    FT_Bool         glyph_transformed; 
+    FT_Matrix       glyph_matrix; 
+    FT_Vector       glyph_delta; 
+    void*           glyph_hints; 
+  } FT_GlyphSlot_InternalRec; 
+
+
+#ifdef __LSB_PROVIDES_FT_GlyphSlot_Embolden
+  FT_Error
+  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot )
+  {
+    if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP   &&
+         !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
+    {
+      FT_Bitmap  bitmap;
+      FT_Error   error;
+
+
+      FT_Bitmap_New( &bitmap );
+      error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
+      if ( error )
+        return error;
+
+      slot->bitmap = bitmap;
+      slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+    }
+
+    return FT_Err_Ok;
+  }
+#endif
+
+
+#ifdef __LSB_PROVIDES_FT_GlyphSlot_Embolden
+  FT_Error
+  FT_Outline_Embolden( FT_Outline*  outline,
+                       FT_Pos       strength )
+  { 
+    FT_Vector*  points; 
+    FT_Vector   v_prev, v_first, v_next, v_cur;
+    FT_Angle    rotate, angle_in, angle_out;
+    FT_Int      c, n, first;
+    FT_Int      orientation;
+
+    
+    if ( !outline )
+      return FT_Err_Invalid_Argument;
+    
+    strength /= 2;
+    if ( strength == 0 )
+      return FT_Err_Ok;
+    
+    orientation = FT_Outline_Get_Orientation( outline );
+    if ( orientation == FT_ORIENTATION_NONE )
+    { 
+      if ( outline->n_contours )
+        return FT_Err_Invalid_Argument;
+      else
+        return FT_Err_Ok;
+    }
+
+    if ( orientation == FT_ORIENTATION_TRUETYPE )
+      rotate = -FT_ANGLE_PI2;
+    else
+      rotate = FT_ANGLE_PI2;
+
+    points = outline->points;
+
+    first = 0;
+    for ( c = 0; c < outline->n_contours; c++ )
+    {
+      int  last = outline->contours[c];
+
+
+      v_first = points[first];
+      v_prev  = points[last];
+     v_cur   = v_first;
+
+      for ( n = first; n <= last; n++ )
+      {
+        FT_Vector  in, out;
+        FT_Angle   angle_diff;
+        FT_Pos     d;
+        FT_Fixed   scale;
+
+
+        if ( n < last )
+          v_next = points[n + 1];
+        else
+          v_next = v_first;
+
+        /* compute the in and out vectors */
+        in.x = v_cur.x - v_prev.x;
+        in.y = v_cur.y - v_prev.y;
+
+        out.x = v_next.x - v_cur.x;
+        out.y = v_next.y - v_cur.y;
+
+        angle_in   = FT_Atan2( in.x, in.y );
+        angle_out  = FT_Atan2( out.x, out.y );
+        angle_diff = FT_Angle_Diff( angle_in, angle_out );
+        scale      = FT_Cos( angle_diff / 2 );
+
+        if ( scale < 0x4000L && scale > -0x4000L )
+          in.x = in.y = 0;
+        else
+        {
+          d = FT_DivFix( strength, scale );
+
+          FT_Vector_From_Polar( &in, d, angle_in + angle_diff / 2 - rotate );
+        }
+
+        outline->points[n].x = v_cur.x + strength + in.x;
+        outline->points[n].y = v_cur.y + strength + in.y;
+
+        v_prev = v_cur;
+        v_cur  = v_next;
+      }
+
+      first = last + 1;
+    }
+
+    return FT_Err_Ok;
+  }
+#endif
+
+
diff --git openjdk-orig/hotspot/lsb/static/lsb_dlfcn.h openjdk/hotspot/lsb/static/lsb_dlfcn.h
new file mode 100644
index 0000000..8642a9a
--- /dev/null
+++ openjdk/hotspot/lsb/static/lsb_dlfcn.h
@@ -0,0 +1,15 @@
+
+#ifndef _LSB_DLFCN_H_OPENJDK_WRAPPER
+#define _LSB_DLFCN_H_OPENJDK_WRAPPER
+
+#ifndef __LSB_PROVIDES_RTLD_NOLOAD
+#define RTLD_NOLOAD 0x00004
+#endif
+
+// dlvsym
+#ifndef __LSB_PROVIDES_dlvsym
+extern void *dlvsym(void *handle, char const *symbol, char const *version);
+#endif
+
+#endif // include sentry
+
diff --git openjdk-orig/hotspot/lsb/static/lsb_flags.c openjdk/hotspot/lsb/static/lsb_flags.c
new file mode 100644
index 0000000..836dfc1
--- /dev/null
+++ openjdk/hotspot/lsb/static/lsb_flags.c
@@ -0,0 +1,3 @@
+
+#include <lsb_flags.h>
+
diff --git openjdk-orig/hotspot/lsb/static/lsb_freetype.h openjdk/hotspot/lsb/static/lsb_freetype.h
new file mode 100644
index 0000000..54e2129
--- /dev/null
+++ openjdk/hotspot/lsb/static/lsb_freetype.h
@@ -0,0 +1,24 @@
+
+/* Include this file if you want to use non-lsb freetype functions */
+
+/* 
+FT_GlyphSlot_Embolden
+FT_GlyphSlot_Oblique
+*/
+
+#ifndef _LSB_FREETYPE_H_OPENJDK_WRAPPER
+#define _LSB_FREETYPE_H_OPENJDK_WRAPPER
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifndef __LSB_PROVIDES_FT_GlyphSlot_Embolden
+void FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );
+#endif
+
+#ifndef __LSB_PROVIDES_FT_GlyphSlot_Oblique
+void FT_GlyphSlot_Oblique( FT_GlyphSlot  slot );
+#endif
+
+#endif
+
diff --git openjdk-orig/hotspot/lsb/static/lsb_pthread.h openjdk/hotspot/lsb/static/lsb_pthread.h
new file mode 100644
index 0000000..30c74d4
--- /dev/null
+++ openjdk/hotspot/lsb/static/lsb_pthread.h
@@ -0,0 +1,14 @@
+
+/* Non-LSB pthread interfaces */
+
+#ifndef _LSB_PTHREAD_H_OPENJDK_WRAPPER
+#define _LSB_PTHREAD_H_OPENJDK_WRAPPER
+
+#include <pthread.h>
+
+#ifndef __LSB_PROVIDES_pthread_getattr_np
+extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr);
+#endif
+
+#endif // include sentry
+
diff --git openjdk-orig/hotspot/lsb/static/lsb_ucontext.h openjdk/hotspot/lsb/static/lsb_ucontext.h
new file mode 100644
index 0000000..4c2b27f
--- /dev/null
+++ openjdk/hotspot/lsb/static/lsb_ucontext.h
@@ -0,0 +1,117 @@
+
+// Becareful not to interfere with LSB's header include sentry!
+#ifndef _LSB_UCONTEXT_H_OPENJDK_WRAPPER
+#define _LSB_UCONTEXT_H_OPENJDK_WRAPPER
+
+#if defined(__alpha) || defined(__alpha__) || \
+    defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__) || \
+    defined(__x86_64__)
+// 64-bit arch
+
+/* Number of general registers.  */
+#define NGREG	23
+
+/* Number of each register in the `gregset_t' array.  */
+enum
+{
+  REG_R8 = 0,
+# define REG_R8		REG_R8
+  REG_R9,
+# define REG_R9		REG_R9
+  REG_R10,
+# define REG_R10	REG_R10
+  REG_R11,
+# define REG_R11	REG_R11
+  REG_R12,
+# define REG_R12	REG_R12
+  REG_R13,
+# define REG_R13	REG_R13
+  REG_R14,
+# define REG_R14	REG_R14
+  REG_R15,
+# define REG_R15	REG_R15
+  REG_RDI,
+# define REG_RDI	REG_RDI
+  REG_RSI,
+# define REG_RSI	REG_RSI
+  REG_RBP,
+# define REG_RBP	REG_RBP
+  REG_RBX,
+# define REG_RBX	REG_RBX
+  REG_RDX,
+# define REG_RDX	REG_RDX
+  REG_RAX,
+# define REG_RAX	REG_RAX
+  REG_RCX,
+# define REG_RCX	REG_RCX
+  REG_RSP,
+# define REG_RSP	REG_RSP
+  REG_RIP,
+# define REG_RIP	REG_RIP
+  REG_EFL,
+# define REG_EFL	REG_EFL
+  REG_CSGSFS,		/* Actually short cs, gs, fs, __pad0.  */
+# define REG_CSGSFS	REG_CSGSFS
+  REG_ERR,
+# define REG_ERR	REG_ERR
+  REG_TRAPNO,
+# define REG_TRAPNO	REG_TRAPNO
+  REG_OLDMASK,
+# define REG_OLDMASK	REG_OLDMASK
+  REG_CR2
+# define REG_CR2	REG_CR2
+};
+
+#else /* else 32 bit arch */
+
+/* Number of general registers.  */
+#define NGREG	19
+
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  REG_GS = 0,
+# define REG_GS		REG_GS
+  REG_FS,
+# define REG_FS		REG_FS
+  REG_ES,
+# define REG_ES		REG_ES
+  REG_DS,
+# define REG_DS		REG_DS
+  REG_EDI,
+# define REG_EDI	REG_EDI
+  REG_ESI,
+# define REG_ESI	REG_ESI
+  REG_EBP,
+# define REG_EBP	REG_EBP
+  REG_ESP,
+# define REG_ESP	REG_ESP
+  REG_EBX,
+# define REG_EBX	REG_EBX
+  REG_EDX,
+# define REG_EDX	REG_EDX
+  REG_ECX,
+# define REG_ECX	REG_ECX
+  REG_EAX,
+# define REG_EAX	REG_EAX
+  REG_TRAPNO,
+# define REG_TRAPNO	REG_TRAPNO
+  REG_ERR,
+# define REG_ERR	REG_ERR
+  REG_EIP,
+# define REG_EIP	REG_EIP
+  REG_CS,
+# define REG_CS		REG_CS
+  REG_EFL,
+# define REG_EFL	REG_EFL
+  REG_UESP,
+# define REG_UESP	REG_UESP
+  REG_SS
+# define REG_SS	REG_SS
+};
+
+#endif // arch wordsize
+
+
+#endif //include sentry
+
diff --git openjdk-orig/hotspot/lsb/static/sys/lsb_mman.h openjdk/hotspot/lsb/static/sys/lsb_mman.h
new file mode 100644
index 0000000..cc53196
--- /dev/null
+++ openjdk/hotspot/lsb/static/sys/lsb_mman.h
@@ -0,0 +1,8 @@
+
+#ifndef _SYS_MMAN_H_OPENJDK_WRAPPER
+#define _SYS_MMAN_H_OPENJDK_WRAPPER
+
+extern int mincore (void *__start, size_t __len, unsigned char *__vec);
+
+#endif //include sentry
+
diff --git openjdk-orig/hotspot/lsb/static/syscall_impl.c openjdk/hotspot/lsb/static/syscall_impl.c
new file mode 100644
index 0000000..0d2fabb
--- /dev/null
+++ openjdk/hotspot/lsb/static/syscall_impl.c
@@ -0,0 +1,38 @@
+
+#include <syscall.h>
+#include <lsb_helpers.h>
+
+// syscall can't have helprer due to variable number of arguments.  
+// So we have to call it through pointer.
+int syscall(int,...);
+LSB_CHECKER(DEFAULT,syscall);
+// now pointer syscall_a is available.
+
+int syscall_gettid_available()
+{
+    return syscall_available() && (syscall_gettid() != -1);
+}
+
+#ifndef SYS_gettid
+// i386: 224, ia64: 1105, amd64: 186, sparc 143
+#ifdef __ia64__
+#define SYS_gettid 1105
+#elif __i386__
+#define SYS_gettid 224
+#elif __amd64__
+#define SYS_gettid 186
+#elif __sparc__
+#define SYS_gettid 143
+#else
+#error define gettid for the arch
+#endif
+#endif
+
+int syscall_gettid()
+{
+    //To load address we must check availability
+    syscall_available();
+    //now syscall
+    return (*syscall_a)(SYS_gettid);
+}
+
diff --git openjdk-orig/hotspot/make/linux/makefiles/defs.make openjdk/hotspot/make/linux/makefiles/defs.make
index 39321fb..0aa3559 100644
--- openjdk-orig/hotspot/make/linux/makefiles/defs.make
+++ openjdk/hotspot/make/linux/makefiles/defs.make
@@ -135,3 +135,9 @@ else
 endif
 endif
 endif
+
+#Lsb exports
+ifdef OPENJDK_LSB_VERSION
+#Directiry for overrides for non-lsb header files
+LSB_INCLUDE_AUX= -I$(GAMMADIR)/lsb/include -I$(GAMMADIR)/lsb
+endif
diff --git openjdk-orig/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/make/linux/makefiles/gcc.make
index 5701dd4..6701e95 100644
--- openjdk-orig/hotspot/make/linux/makefiles/gcc.make
+++ openjdk/hotspot/make/linux/makefiles/gcc.make
@@ -179,3 +179,16 @@ DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
 DEBUG_CFLAGS += -gstabs
 endif
+
+#------------------------------------------------------------------------
+# LSB overrides
+
+ifdef OPENJDK_LSB_VERSION
+CPP = /opt/lsb/bin/lsbc++ $(LSB_INCLUDE_AUX)
+CC  = /opt/lsb/bin/lsbcc $(LSB_INCLUDE_AUX)
+
+# Don't link standard libs statically -- LSB takes care of stability
+STATIC_STDCXX= 
+STATIC_LIBGCC= 
+endif
+
diff --git openjdk-orig/hotspot/make/linux/makefiles/launcher.make openjdk/hotspot/make/linux/makefiles/launcher.make
index e367409..091e72c 100644
--- openjdk-orig/hotspot/make/linux/makefiles/launcher.make
+++ openjdk/hotspot/make/linux/makefiles/launcher.make
@@ -71,3 +71,9 @@ $(LAUNCHER): $(LAUNCHER.o) $(LIBJVM) $(LAUNCHER_MAPFILE)
 	    $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(LAUNCHER.o) $(LIBS_LAUNCHER); \
 	    $(LINK_LAUNCHER/POST_HOOK) \
         }
+
+ifdef OPENJDK_LSB_VERSION
+# It's in the draft, TODO: is it needed? Probably, to compile C++ code with gcc.
+LIBS_LAUNCHER += -lstdc++ -lrt -lgcc_s
+endif
+
diff --git openjdk-orig/hotspot/make/linux/makefiles/lsb.make openjdk/hotspot/make/linux/makefiles/lsb.make
new file mode 100644
index 0000000..2bc51ff
--- /dev/null
+++ openjdk/hotspot/make/linux/makefiles/lsb.make
@@ -0,0 +1,72 @@
+#
+# Copyright 2005-2008 Sun Microsystems, Inc.  All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#  
+#
+
+# Rules to build LSB compatibility helpers
+
+ifndef OPENJDK_LSB_VERSION
+# If we're not making LSB build, do nothing
+.PHONY: all
+all:
+	@echo Not LSB build: OPENJDK_LSB_VERSION=$(OPENJDK_LSB_VERSION)
+
+else
+
+LIBLSB = liblsb_helper_hotspot7.a
+LSBSRCDIR = $(GAMMADIR)/lsb
+LSB_INCLUDE_AUX = -I$(LSBSRCDIR)/include -I$(LSBSRCDIR)
+DEST_LSB  = $(JDK_LIBDIR)/$(LIBLSB)
+
+LSB_SRC_FILES = lsb_helpers.c \
+    lsb_wrappers.c \
+    static/syscall_impl.c 
+
+#$(LIBLSB): $(addprefix $(LSBSRCDIR)/,$(patsubst %.c,%.o,$(LSB_SRC_FILES)))
+$(LIBLSB): $(patsubst %.c,%.o,$(notdir $(LSB_SRC_FILES)))
+	@echo Making LSB compatibility helper library...
+	ar rcs liblsb_helper_hotspot7.a $^
+
+# implicit rules to make object files out of $(LSB_SRC_FILS)
+%.o: %.c
+	$(QUIETLY) $(CC) -c $< $(LSB_INCLUDE_AUX)
+vpath %.c $(LSBSRCDIR)
+vpath %.c $(LSBSRCDIR)/static
+
+install_lsb: $(LIBLSB)
+	@echo "Copying $(LIBLSB) to $(DEST_LSB)"
+	$(QUIETLY) cp -f $(LIBLSB) $(DEST_LSB) && echo "Done"
+
+.PHONY: install_lsb
+
+# We also add dependencies on LSB helpers here in sake of easier merges!
+
+# Serviceability agent needs helpers
+$(LIBJVM_DB): $(LIBLSB)
+# Launcher also needs them
+LIBS_LAUNCHER+= -llsb_helper_hotspot7
+
+# Common targets
+build: $(LIBLSB)
+install: install_lsb
+
+endif
diff --git openjdk-orig/hotspot/make/linux/makefiles/saproc.make openjdk/hotspot/make/linux/makefiles/saproc.make
index 84b8dc6..d6d22d1 100644
--- openjdk-orig/hotspot/make/linux/makefiles/saproc.make
+++ openjdk/hotspot/make/linux/makefiles/saproc.make
@@ -53,6 +53,8 @@ checkAndBuildSA:
 
 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
 
+SA_LIBTHREAD_DB = -lthread_db
+
 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
 	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
@@ -68,7 +70,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
 	           $(SASRCFILES)                                        \
 	           $(SA_LFLAGS)                                         \
 	           -o $@                                                \
-	           -lthread_db
+	           $(SA_LIBTHREAD_DB)
 
 install_saproc: checkAndBuildSA
 	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
@@ -76,4 +78,8 @@ install_saproc: checkAndBuildSA
 	  cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
 	fi
 
+ifdef OPENJDK_LSB_VERSION
+SA_LIBTHREAD_DB= -L `pwd` -llsb_helper_hotspot7 -I$(GAMMADIR)/lsb/include -I$(GAMMADIR)/lsb
+endif
+
 .PHONY: checkAndBuildSA install_saproc
diff --git openjdk-orig/hotspot/make/linux/makefiles/vm.make openjdk/hotspot/make/linux/makefiles/vm.make
index 01e2afe..cfbea2f 100644
--- openjdk-orig/hotspot/make/linux/makefiles/vm.make
+++ openjdk/hotspot/make/linux/makefiles/vm.make
@@ -240,6 +240,17 @@ include $(MAKEFILES_DIR)/jsig.make
 # Serviceability agent
 include $(MAKEFILES_DIR)/saproc.make
 
+# LSB compatibility helpers
+include $(MAKEFILES_DIR)/lsb.make
+
+# Also, let's spit out a couple of LSB defs
+ifdef OPENJDK_LSB_VERSION
+STATIC_CXX=false
+LIBS_VM+= -lgcc_s -lstdc++ -lrt
+# Linking lsb helper statically
+LIBS_VM+= -L `pwd` -Wl,-Bstatic -llsb_helper_hotspot7 -Wl,-Bdynamic
+endif
+
 #----------------------------------------------------------------------
 
 build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) checkAndBuildSA
diff --git openjdk-orig/hotspot/src/os/linux/vm/attachListener_linux.cpp openjdk/hotspot/src/os/linux/vm/attachListener_linux.cpp
index f40ac8e..7381637 100644
--- openjdk-orig/hotspot/src/os/linux/vm/attachListener_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/attachListener_linux.cpp
@@ -316,6 +316,7 @@ LinuxAttachOperation* LinuxAttachListener::read_request(int s) {
 // In the Linux implementation there is only a single operation and clients
 // cannot queue commands (except at the socket level).
 //
+#include <lsb_flags.h>
 LinuxAttachOperation* LinuxAttachListener::dequeue() {
   for (;;) {
     int s;
diff --git openjdk-orig/hotspot/src/os/linux/vm/hpi_linux.hpp openjdk/hotspot/src/os/linux/vm/hpi_linux.hpp
index b671a4e..6d64cd1 100644
--- openjdk-orig/hotspot/src/os/linux/vm/hpi_linux.hpp
+++ openjdk/hotspot/src/os/linux/vm/hpi_linux.hpp
@@ -28,8 +28,8 @@
 //
 
 #include <unistd.h>
+#include <poll.h>
 #include <sys/socket.h>
-#include <sys/poll.h>
 #include <sys/ioctl.h>
 #include <netdb.h>
 
diff --git openjdk-orig/hotspot/src/os/linux/vm/os_linux.cpp openjdk/hotspot/src/os/linux/vm/os_linux.cpp
index e2e7347..1b3f03a 100644
--- openjdk-orig/hotspot/src/os/linux/vm/os_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
@@ -26,6 +26,7 @@
 # include "incls/_os_linux.cpp.incl"
 
 // put OS-includes here
+# include <alloca.h>
 # include <sys/types.h>
 # include <sys/mman.h>
 # include <pthread.h>
@@ -53,6 +54,7 @@
 # include <sys/ipc.h>
 # include <sys/shm.h>
 # include <link.h>
+# include <elf.h>
 
 #define MAX_PATH    (2 * K)
 
@@ -60,6 +62,15 @@
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 #define SEC_IN_NANOSECS  1000000000LL
 
+// This file is lsb-dependent
+#include <lsb_config.h>
+#include <lsb_wrappers.h>
+// Also include LSB flags overrides
+#include <lsb_flags.h>
+#ifdef __LSB_VERSION__
+#include <libgen.h>
+#endif
+
 ////////////////////////////////////////////////////////////////////////////////
 // global variables
 julong os::Linux::_physical_memory = 0;
@@ -202,7 +213,17 @@ static char cpu_arch[] = "sparc";
 // on NPTL, it returns the same pid for all threads, as required by POSIX.)
 //
 pid_t os::Linux::gettid() {
+#ifdef __LSB_PROVIDES_syscall_gettid
   int rslt = syscall(SYS_gettid);
+#else
+  int rslt = -1;
+  if (syscall_gettid_available()){
+      rslt = syscall_gettid();
+  }
+  if (rslt = -1){ //we still haven't gotten tid? I guess, syscall hasn't succeeded.
+      rslt = pthread_self();
+  }
+#endif
   if (rslt == -1) {
      // old kernel, no NPTL support
      return getpid();
@@ -223,7 +244,12 @@ static const char *unstable_chroot_error = "/proc file system not found.\n"
 void os::Linux::initialize_system_info() {
   _processor_count = sysconf(_SC_NPROCESSORS_CONF);
   if (_processor_count == 1) {
-    pid_t pid = os::Linux::gettid();
+    pid_t pid;
+    if (syscall_gettid_available()){
+       pid = os::Linux::gettid();
+    }else{
+       pid = getpid();
+    }
     char fname[32];
     jio_snprintf(fname, sizeof(fname), "/proc/%d", pid);
     FILE *fp = fopen(fname, "r");
@@ -548,8 +574,15 @@ void os::Linux::libpthread_init() {
   } else {
      // _CS_GNU_LIBC_VERSION is not supported, try gnu_get_libc_version()
      static char _gnu_libc_version[32];
+#ifndef __LSB_VERSION__
      jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version),
               "glibc %s %s", gnu_get_libc_version(), gnu_get_libc_release());
+#else
+#define __OPENJDK_MACRO_STRINGIFY__(xxx) #xxx
+     jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version),
+              "glibc is provided by LSBv%s", __OPENJDK_MACRO_STRINGIFY__(__LSB_VERSION__) );
+#undef __OPENJDK_MACRO_STRINGIFY__
+#endif
      os::Linux::set_glibc_version(_gnu_libc_version);
   }
 
@@ -1339,7 +1372,7 @@ void os::Linux::clock_init() {
 
 #endif
 
-#define sys_clock_getres(x,y)  ::syscall(SYS_clock_getres, x, y)
+#define sys_clock_getres(x,y)  ::clock_getres(x, y)
 
 void os::Linux::fast_thread_clock_init() {
   if (!UseLinuxPosixThreadCPUClocks) {
@@ -1579,6 +1612,10 @@ struct _address_to_library_name {
   address base;          //         library base addr
 };
 
+/* A copuple of noted on the fixes below.  OpenJDK uses non-lsb function
+dl_iterate_phdr to workaround bug in dlopen.  LSB 4.1 will contain test
+for this bug and no workaround wil be needed */
+#ifndef __LSB_VERSION__
 static int address_to_library_name_callback(struct dl_phdr_info *info,
                                             size_t size, void *data) {
   int i;
@@ -1615,10 +1652,12 @@ static int address_to_library_name_callback(struct dl_phdr_info *info,
   }
   return 0;
 }
+#endif
 
 bool os::dll_address_to_library_name(address addr, char* buf,
                                      int buflen, int* offset) {
   Dl_info dlinfo;
+#ifndef __LSB_VERSION__
   struct _address_to_library_name data;
 
   // There is a bug in old glibc dladdr() implementation that it could resolve
@@ -1631,12 +1670,18 @@ bool os::dll_address_to_library_name(address addr, char* buf,
   data.buflen = buflen;
   data.base = NULL;
   int rslt = dl_iterate_phdr(address_to_library_name_callback, (void *)&data);
-
   if (rslt) {
      // buf already contains library name
      if (offset) *offset = addr - data.base;
      return true;
-  } else if (dladdr((void*)addr, &dlinfo)){
+  } else  //that's NOT a typo--see below!
+#else
+  // LSB 4.1 compatible distribution shall pass a test that prevents us from
+  // encountering a bug described above.
+  int rslt = 0;
+#endif
+  // IF should be the first statement here--see above!
+  if (dladdr((void*)addr, &dlinfo)){
      if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname);
      if (offset) *offset = addr - (address)dlinfo.dli_fbase;
      return true;
@@ -1651,9 +1696,34 @@ bool os::dll_address_to_library_name(address addr, char* buf,
   // in case of error it checks if .dll/.so was built for the
   // same architecture as Hotspot is running on
 
+#ifdef __LSB_VERSION__
+// Libs that are loaded with RTLD_NOW
+// must end with NULL
+// Each library's name should contain `lib' prefix, but no .so or suffixes like this.
+char const* load_now_libs[] = {
+    "libjsound",
+NULL};
+#endif
+
 void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
 {
+#ifndef __LSB_VERSION__
   void * result= ::dlopen(filename, RTLD_LAZY);
+#else
+  // Some libraries are loaded with RTLD_NOW.  Check if it's the case.
+  void * result;
+  char const*const* i;  //pointer to the library
+  for (i = load_now_libs; *i ; i++){
+    // We compare only common prefix starting from the file name of filename
+    if (strncmp(basename(strdup(filename)),*i,strlen(*i)) == 0) break;
+  }
+  if (*i){
+    result= ::dlopen(filename, RTLD_NOW);
+  }else{
+    result= ::dlopen(filename, RTLD_LAZY);
+  }
+#endif
+
   if (result != NULL) {
     // Successful loading
     return result;
@@ -1849,7 +1919,12 @@ void os::print_dll_info(outputStream *st) {
    st->print_cr("Dynamic libraries:");
 
    char fname[32];
-   pid_t pid = os::Linux::gettid();
+   pid_t pid;
+   if (syscall_gettid_available()){
+      pid = os::Linux::gettid();
+   }else{
+      pid = getpid();
+   }
 
    jio_snprintf(fname, sizeof(fname), "/proc/%d/maps", pid);
 
@@ -2927,8 +3002,13 @@ static int prio_init() {
 OSReturn os::set_native_priority(Thread* thread, int newpri) {
   if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
 
-  int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
-  return (ret == 0) ? OS_OK : OS_ERR;
+  if (syscall_gettid_available()){
+    int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
+    return (ret == 0) ? OS_OK : OS_ERR;
+  }else{
+    // If we didn't syscall, then always return error.
+    return OS_ERR;
+  }
 }
 
 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
@@ -2937,9 +3017,14 @@ OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr)
     return OS_OK;
   }
 
-  errno = 0;
-  *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id());
-  return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR);
+  if (syscall_gettid_available()){
+    errno = 0;
+    *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id());
+    return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR);
+  }else{
+    // If we didn't syscall, then always return error.
+    return OS_ERR;
+  }
 }
 
 // Hint to the underlying OS that a task switch would not be good.
@@ -3048,7 +3133,7 @@ static int SR_initialize() {
   /* Get signal number to use for suspend/resume */
   if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) {
     int sig = ::strtol(s, 0, 10);
-    if (sig > 0 || sig < _NSIG) {
+    if (sig > 0 && sig < NSIG) {
         SR_signum = sig;
     }
   }
@@ -4084,7 +4169,11 @@ static clockid_t thread_cpu_clockid(Thread* thread) {
 
 jlong os::current_thread_cpu_time() {
   if (os::Linux::supports_fast_thread_cpu_time()) {
-    return os::Linux::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID);
+    clockid_t clockid;
+    if (clock_getcpuclockid(0,&clockid) != 0){
+        return -1;
+    }
+    return os::Linux::fast_thread_cpu_time(clockid);
   } else {
     // return user + sys since the cost is the same
     return slow_thread_cpu_time(Thread::current(), true /* user + sys */);
@@ -4102,7 +4191,11 @@ jlong os::thread_cpu_time(Thread* thread) {
 
 jlong os::current_thread_cpu_time(bool user_sys_cpu_time) {
   if (user_sys_cpu_time && os::Linux::supports_fast_thread_cpu_time()) {
-    return os::Linux::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID);
+    clockid_t clockid;
+    if (clock_getcpuclockid(0,&clockid) != 0){
+        return -1;
+    }
+    return os::Linux::fast_thread_cpu_time(clockid);
   } else {
     return slow_thread_cpu_time(Thread::current(), user_sys_cpu_time);
   }
@@ -4735,8 +4828,23 @@ int os::fork_and_exec(char* cmd) {
   // separate process to execve. Make a direct syscall to fork process.
   // On IA64 there's no fork syscall, we have to use fork() and hope for
   // the best...
+#if (!defined __LSB_PROVIDES_syscall_fork) || (!defined __LSB_PROVIDES_syscall_exevce)
+  // Notes from LSB-OpenJDK project:
+  // This procedure is used only in emergency -- when calling gdb for a 
+  // crashing VM.  For other purposes the usual fork/exec calls are used.
+  // Async-safe messup described above and below is just not true -- it's 
+  // widely known that immediate exec() after fork() is totally async-safe.
+  //
+  // The reason for syscalls might be that calling atfork_handlers in a 
+  // _crashing_ program may arise even more crashing stuff and mess things
+  // up completely.  I don't see any comment on this.  So, I suppose, that
+  // is not the case, and just replace syscall with usual fork()/exec()
+  // calls.
+  pid_t pid = fork();
+#else
   pid_t pid = NOT_IA64(syscall(__NR_fork);)
               IA64_ONLY(fork();)
+#endif
 
   if (pid < 0) {
     // fork failed
@@ -4752,8 +4860,13 @@ int os::fork_and_exec(char* cmd) {
     // in the new process, so make a system call directly.
     // IA64 should use normal execve() from glibc to match the glibc fork()
     // above.
+#if (!defined __LSB_PROVIDES_syscall_fork) || (!defined __LSB_PROVIDES_syscall_exevce)
+    // See notes above
+    execve("/bin/sh", (char* const*)argv, environ);
+#else
     NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);)
     IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);)
+#endif
 
     // execve failed
     _exit(-1);
diff --git openjdk-orig/hotspot/src/os/linux/vm/os_linux.inline.hpp openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
index 6f6d608..1de8128 100644
--- openjdk-orig/hotspot/src/os/linux/vm/os_linux.inline.hpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
@@ -83,7 +83,7 @@ inline DIR* os::opendir(const char* dirname)
 
 inline int os::readdir_buf_size(const char *path)
 {
-  return NAME_MAX + sizeof(dirent) + 1;
+  return pathconf(path,_PC_NAME_MAX) + sizeof(dirent) + 1;
 }
 
 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
diff --git openjdk-orig/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index 174c1df..33d09bf 100644
--- openjdk-orig/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -47,6 +47,11 @@
 # include <ucontext.h>
 # include <fpu_control.h>
 
+// Registers are not specified in LSB's ucontext and are unlikely to be in LSB
+#include <lsb_flags.h>
+// For pthread_getattr_np
+#include <lsb_wrappers.h>
+
 #ifdef AMD64
 #define REG_SP REG_RSP
 #define REG_PC REG_RIP
diff --git openjdk-orig/hotspot/src/share/vm/libadt/dict.cpp openjdk/hotspot/src/share/vm/libadt/dict.cpp
index 3ac20d6..dbc9519 100644
--- openjdk-orig/hotspot/src/share/vm/libadt/dict.cpp
+++ openjdk/hotspot/src/share/vm/libadt/dict.cpp
@@ -33,7 +33,8 @@
 //IMPLEMENTATION
 // #include "dict.hpp"
 
-#include <assert.h>
+// not used
+//#include <assert.h>
 
 // The iostream is not needed and it gets confused for gcc by the
 // define of bool.
diff --git openjdk-orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
index 417978f..2f3f072 100644
--- openjdk-orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
@@ -227,7 +227,7 @@ inline int g_isnan(float  f) { return isnand(f); }
 #endif
 inline int g_isnan(double f) { return isnand(f); }
 #elif LINUX
-inline int g_isnan(float  f) { return isnanf(f); }
+inline int g_isnan(float  f) { return isnan(f); }
 inline int g_isnan(double f) { return isnan(f); }
 #else
 #error "missing platform-specific definition here"
@@ -235,8 +235,8 @@ inline int g_isnan(double f) { return isnan(f); }
 
 // Checking for finiteness
 
-inline int g_isfinite(jfloat  f)                 { return finite(f); }
-inline int g_isfinite(jdouble f)                 { return finite(f); }
+inline int g_isfinite(jfloat  f)                 { return isfinite(f); }
+inline int g_isfinite(jdouble f)                 { return isfinite(f); }
 
 
 // Wide characters
diff --git openjdk-orig/investigation/_thread_id.txt openjdk/investigation/_thread_id.txt
new file mode 100644
index 0000000..1d4c781
--- /dev/null
+++ openjdk/investigation/_thread_id.txt
@@ -0,0 +1,22 @@
+hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp:  nonstatic_field(OSThread,                      _thread_id,                                      pid_t)                             \
+hotspot/src/os/linux/vm/osThread_linux.cpp:  _thread_id        = 0;
+hotspot/src/os/linux/vm/osThread_linux.hpp:  // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
+hotspot/src/os/linux/vm/osThread_linux.hpp:  pid_t     _thread_id;
+hotspot/src/os/linux/vm/osThread_linux.hpp:    return _thread_id;
+hotspot/src/os/linux/vm/osThread_linux.hpp:  int thread_identifier() const   { return _thread_id; }
+hotspot/src/os/linux/vm/osThread_linux.hpp:    _thread_id = id;
+hotspot/src/share/vm/compiler/compileLog.cpp:  _thread_id = thread_id;
+hotspot/src/share/vm/compiler/compileLog.hpp:  intx          _thread_id;      // which compile thread
+hotspot/src/share/vm/compiler/compileLog.hpp:  intx          thread_id()                      { return _thread_id; }
+//  No, events.cpp is for posix ID.
+hotspot/src/share/vm/utilities/events.cpp:  intx        _thread_id;
+hotspot/src/share/vm/utilities/events.cpp:    _thread_id = os::current_thread_id();
+hotspot/src/share/vm/utilities/events.cpp:    st->print("  %d", _thread_id);
+hotspot/agent/src/os/linux/libproc.h:::getpid() call in OSThread::_thread_id. This way uniqueness of OSThread::_thread_id
+hotspot/agent/src/os/linux/libproc.h:OSThread::_thread_id. Because gettid returns actual pid of thread (lwp id), this is
+hotspot/agent/src/os/linux/libproc.h:unique again. We therefore use OSThread::_thread_id as unique identifier.
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThread.java:    /** The address argument must be the address of the _thread_id in the
+hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_amd64/LinuxAMD64JavaThreadPDAccess.java:    osThreadThreadIDField   = osThreadType.getCIntegerField("_thread_id");
+hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_amd64/LinuxAMD64JavaThreadPDAccess.java:    // Get the address of the _thread_id from the OSThread
+hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_x86/LinuxX86JavaThreadPDAccess.java:    osThreadThreadIDField   = osThreadType.getCIntegerField("_thread_id");
+hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_x86/LinuxX86JavaThreadPDAccess.java:    // Get the address of the _thread_id from the OSThread
diff --git openjdk-orig/investigation/alsasound.txt openjdk/investigation/alsasound.txt
new file mode 100644
index 0000000..9d20884
--- /dev/null
+++ openjdk/investigation/alsasound.txt
@@ -0,0 +1,7 @@
+
+ALSA report
+
+So, LSB doesn't define alsa, just in trial use.  That's no problem.
+
+OpenJDK can run without alsa as well.  Although libjsoundalsa.so depends on alsa library and interfaces, actually, it's not statically included into VM.  This library is opened dynamically when java application tries to use Java(tm) sound capabilities.  If dynamic loading of this library fails, then Java throws the exception, that may be caught, but doesn't fail critically.  If alsa library is absent in the system, or one of its interfaces is missing (and they're referenced statically!), its dynamic loading fails and 
+
diff --git openjdk-orig/investigation/gettid_flow.txt openjdk/investigation/gettid_flow.txt
new file mode 100644
index 0000000..8f387a8
--- /dev/null
+++ openjdk/investigation/gettid_flow.txt
@@ -0,0 +1,52 @@
+
+It seems that gettid is used somewhere in the way pathread_self could be used.  So, we replace such places with pthread_self values.  Let alone that java stores this value as well in its thread objects.
+Note that, although LSB and manpages specify pthread_t as opaque, it's used in OpenJDK's code as mere integer.  And it is a mere integer in glibc for all archs.  Well, let's leave this for OpenJDK guys' consideration--they're more experienced devs than I.
+
+os::Linux::gettid
+  to os::Linux::initialize_system_info.  Get processors count and if sysconf returns 1, suspect that it's wrong and check /proc.  Issue a warning.  Not very useful, thus.   See section about processors for more info.
+  osthread->set_thread_id(os::Linux::gettid()) in java_start -- Thread start routine for all newly created threads, and in create_attached_thread
+    sets OSThread::_thread_id.  Is read by:
+      in agent/src/share/classes/sun/jvm/hotspot/runtime/*/*JavaThreadPDAccess.java
+        (on some archs pthread_id is used)
+        osThreadThreadIDField
+          to getThreadForIdentifierAddress in LinuxDebugger classes
+            to create new LinuxThread( . , addr) in hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThread.java
+              there the address is sucked into lwp_id and no difference is then between gettid and pthread_self -- they both gotten converted to lwp.
+      thread_identifier() in osThread.hpp
+        not used anywhere!!!
+      that's all.
+      OSThread::thread_id()
+        os::set_native_priority -- supplied to setpriority call.  Comment says that it can be applied to threads only under root and when -XX:ThreadPriorityPolicy is set
+        os::get_native_priority
+        to dig proc and get clock resolution (slow_thread_cpu_time)
+          That's a cumbersome thing.  It's only needed if the glibc wrapper is not found (Specified by lsb, so it is) and if it returns clock resolution in seconds.  Glibc comments say that `any sane implementation' will not.  So, we just ignore this thing and let the code, that digs it, alone--it won't be called anyway.
+  from java_lang_Thread::thread_id
+        many files just for printing.
+  print_dll_info - print /proc/<tid>/maps.  Can be replaced by pid -- brief experiments show that dlopen in one thread affects others
+
+
+
+From the other side: 
+
+  sys_thread_t->sys_thread of type thread_t --- is `The native thread id' in jdk/src/solaris/hpi/native_threads/include/threads_md.h.
+    | In the same file, line 235 it's used as an argument to pthread_kill.  So we count it as pthread_self() value.
+    | line 352 --- lwp_id is pid, as it should be
+    |
+    | sys_thread_t *tid = sysThreadSelf();  --- file jdk/src/solaris/hpi/native_threads/src/threads_md.c, line 161
+    |   sysThreadSelf() -- line 782
+    so, the sys_thread_t is TOTALLY POSIX!!!  cool
+
+  os_current_thread_id()
+    takes from thr_self()
+      is alias for pthread_self() -- jdk/src/solaris/hpi/native_threads/include/porting.h, line 73, the file has __linux__ ifdefs, so it's linux as well
+
+GDB knows about posix's thread id.  Moreover, the value returned by pthread_self (under NTPL, at least, but not under NTPL gettid returns -1) is referred to as thread ID in gdb's hints, the gettid(2) value being referred to as LWP (as noticed above, yes).  I guess, there are solaris' roots here, but whatever.
+
+
+WHY PROCESSOR COUNT IS IMPORTANT?
+
+On system with several processors OpenJDK VM needs to insert some kind of locks to protect user's volatile data.  These are not software locks, but hardware locks, applied with assembler instructions, and they are supposed to protect data on a deeper layer, than that of threads.  So, this kind of locks is totally useless on a single-processor systems.  However, in chroot without /proc system most likely will report number of processors as 1.
+Why thread id(lwp) is needed here?  I guess, it may be replaced with pid.  That's what I replaced the code with.
+
+
+
diff --git openjdk-orig/investigation/initAlsaSupport_where.txt openjdk/investigation/initAlsaSupport_where.txt
new file mode 100644
index 0000000..24bbf80
--- /dev/null
+++ openjdk/investigation/initAlsaSupport_where.txt
@@ -0,0 +1,11 @@
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c:void initAlsaSupport() {
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.h:void initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_Ports.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    initAlsaSupport();
+jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    initAlsaSupport();
diff --git openjdk-orig/investigation/libjsoundalsa.txt openjdk/investigation/libjsoundalsa.txt
new file mode 100644
index 0000000..d207407
--- /dev/null
+++ openjdk/investigation/libjsoundalsa.txt
@@ -0,0 +1,8 @@
+jdk/src/share/classes/com/sun/media/sound/Platform.java:    private static final String libNameALSA     = "jsoundalsa";
+jdk/.hg/store/fncache:data/make/javax/sound/jsoundalsa/Makefile.i
+jdk/.hg/store/fncache:data/make/javax/sound/jsoundalsa/mapfile-vers.i
+Binary file jdk/.hg/dirstate matches
+Binary file jdk/.hg/undo.dirstate matches
+jdk/make/javax/sound/jsoundalsa/Makefile:LIBRARY = jsoundalsa
+jdk/make/javax/sound/Makefile:  SUBDIRS += jsoundalsa
+jdk/make/javax/sound/Makefile:  EXTRA_SOUND_JNI_LIBS += jsoundalsa
diff --git openjdk-orig/investigation/snd_funcs.txt openjdk/investigation/snd_funcs.txt
new file mode 100644
index 0000000..0093f4c
--- /dev/null
+++ openjdk/investigation/snd_funcs.txt
@@ -0,0 +1,382 @@
+all files in jdk/src/solaris/native/com/sun/media/sound/
+
+PLATFORM_API_LinuxOS_ALSA_MidiOut.c:    err = snd_rawmidi_write((snd_rawmidi_t*) handle->deviceHandle, buffer, getShortMessageLength(status));
+PLATFORM_API_LinuxOS_ALSA_MidiOut.c:        ERROR1("  ERROR: MIDI_OUT_SendShortMessage(): snd_rawmidi_write() returned %d\n", err);
+PLATFORM_API_LinuxOS_ALSA_MidiOut.c:    err = snd_rawmidi_write((snd_rawmidi_t*) handle->deviceHandle,
+PLATFORM_API_LinuxOS_ALSA_MidiOut.c:        ERROR1("  ERROR: MIDI_OUT_SendLongMessage(): snd_rawmidi_write() returned %d\n", err);
+PLATFORM_API_LinuxOS_ALSA_CommonUtils.c:    printf("%s:%d function %s: error %d: %s\n", file, line, function, err, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_CommonUtils.c:        snd_lib_error_set_handler(&alsaDebugOutput);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:typedef int (*DeviceIteratorPtr)(UINT32 deviceID, snd_pcm_info_t* pcminfo,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                             snd_ctl_card_info_t* cardinfo, void *userData);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_ctl_t *handle;
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_pcm_t *pcm;
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_pcm_info_t* pcminfo;
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_ctl_card_info_t *cardinfo, *defcardinfo = NULL;
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_pcm_info_malloc(&pcminfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_ctl_card_info_malloc(&cardinfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    err = snd_pcm_open(&pcm, ALSA_DEFAULT_DEVICE_NAME,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        err = snd_pcm_open(&pcm, ALSA_DEFAULT_DEVICE_NAME,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        ERROR1("ERROR: snd_pcm_open (\"default\"): %s\n", snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        err = snd_pcm_info(pcm, pcminfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        snd_pcm_close(pcm);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:            ERROR1("ERROR: snd_pcm_info (\"default\"): %s\n",
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:            card = snd_pcm_info_get_card(pcminfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                if (snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK) >= 0) {
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    if (snd_ctl_card_info(handle, cardinfo) >= 0) {
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    snd_ctl_close(handle);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        if (snd_card_next(&card) < 0) {
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        err = snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:            ERROR2("ERROR: snd_ctl_open, card=%d: %s\n",
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    card, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:            err = snd_ctl_card_info(handle, cardinfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                ERROR2("ERROR: snd_ctl_card_info, card=%d: %s\n",
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                        card, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    if (snd_ctl_pcm_next_device(handle, &dev) < 0) {
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                        ERROR0("snd_ctl_pcm_next_device\n");
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    snd_pcm_info_set_device(pcminfo, dev);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    snd_pcm_info_set_subdevice(pcminfo, 0);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    snd_pcm_info_set_stream(pcminfo, SND_PCM_STREAM_PLAYBACK);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    err = snd_ctl_pcm_info(handle, pcminfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                        snd_pcm_info_set_stream(pcminfo, SND_PCM_STREAM_CAPTURE);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                        err = snd_ctl_pcm_info(handle, pcminfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                            ERROR2("ERROR: snd_ctl_pcm_info, card=%d: %s",
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                                    card, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                            snd_pcm_info_get_subdevices_count(pcminfo) : 1;
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:            snd_ctl_close(handle);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_ctl_card_info_free(cardinfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    snd_pcm_info_free(pcminfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:int deviceInfoIterator(UINT32 deviceID, snd_pcm_info_t* pcminfo,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                       snd_ctl_card_info_t* cardinfo, void* userData) {
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                1 : snd_pcm_info_get_subdevices_count(pcminfo);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    ? snd_ctl_card_info_get_id(cardinfo)
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    : snd_pcm_info_get_id(pcminfo),
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    ? snd_ctl_card_info_get_name(cardinfo)
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:                    : snd_pcm_info_get_name(pcminfo),
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        strncat(desc->description, snd_pcm_info_get_id(pcminfo), desc->strLen - strlen(desc->description));
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        strncat(desc->description, snd_pcm_info_get_name(pcminfo), desc->strLen - strlen(desc->description));
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:int openPCMfromDeviceID(int deviceID, snd_pcm_t** handle, int isSource, int hardware) {
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    ret = snd_pcm_open(handle, buffer,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        ERROR1("snd_pcm_open returned error code %d \n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:int getFormatFromAlsaFormat(snd_pcm_format_t alsaFormat,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    *sampleSizeInBytes = (snd_pcm_format_physical_width(alsaFormat) + 7) / 8;
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    *significantBits = snd_pcm_format_width(alsaFormat);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    *isSigned = (snd_pcm_format_signed(alsaFormat) > 0);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    *isBigEndian = (snd_pcm_format_big_endian(alsaFormat) > 0);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:    else if (snd_pcm_format_linear(alsaFormat) < 1) {
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:int getAlsaFormatFromFormat(snd_pcm_format_t* alsaFormat,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:        *alsaFormat = snd_pcm_build_linear_format(significantBits,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.h:int openPCMfromDeviceID(int deviceID, snd_pcm_t** handle, int isSource, int hardware);
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.h:int getFormatFromAlsaFormat(snd_pcm_format_t alsaFormat,
+PLATFORM_API_LinuxOS_ALSA_PCMUtils.h:int getAlsaFormatFromFormat(snd_pcm_format_t* alsaFormat,
+PLATFORM_API_LinuxOS_ALSA_PCM.c:// GetPosition method 3: use snd_pcm_avail() call - not yet in official ALSA
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_t* handle;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_format_mask_t* formatMask;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_format_t format;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_hw_params_t* hwParams;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_format_mask_malloc(&formatMask);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("snd_pcm_format_mask_malloc returned error %d\n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_hw_params_malloc(&hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("snd_pcm_hw_params_malloc returned error %d\n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ret = snd_pcm_hw_params_any(handle, hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                ERROR1("snd_pcm_hw_params_any returned error %d\n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_pcm_hw_params_get_format_mask(hwParams, formatMask);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ret = snd_pcm_hw_params_get_channels_min(hwParams, &minChannels);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                ERROR1("snd_pcm_hw_params_get_channels_min returned error %d\n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ret = snd_pcm_hw_params_get_channels_max(hwParams, &maxChannels);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                ERROR1("snd_pcm_hw_params_get_channels_max returned error %d\n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        minChannels = snd_pcm_hw_params_get_channels_min(hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        maxChannels = snd_pcm_hw_params_get_channels_max(hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                if (snd_pcm_format_mask_test(formatMask, format)) {
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            snd_pcm_hw_params_free(hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_pcm_format_mask_free(formatMask);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_close(handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_t* handle;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_hw_params_t* hwParams;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_sw_params_t* swParams;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_uframes_t periodSize;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_status_t* positionStatus;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_sw_params_set_start_threshold(info->handle, info->swParams, threshold);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Unable to set start threshold mode: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_sw_params(info->handle, info->swParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("Unable to set sw params: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                snd_pcm_format_t format) {
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_uframes_t alsaBufferSizeInFrames = (snd_pcm_uframes_t) bufferSizeInFrames;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_any(info->handle, info->hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Broken configuration: no configurations available: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_set_access(info->handle, info->hwParams, SND_PCM_ACCESS_RW_INTERLEAVED);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("SND_PCM_ACCESS_RW_INTERLEAVED access type not available: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_set_format(info->handle, info->hwParams, format);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Sample format not available: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_set_channels(info->handle, info->hwParams, channels);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR2("Channels count (%d) not available: %s\n", channels, snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_set_rate_near(info->handle, info->hwParams, &rrate, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_set_rate_near(info->handle, info->hwParams, rrate, 0);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR2("Rate %dHz not available for playback: %s\n", (int) (sampleRate+0.5f), snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_set_buffer_size_near(info->handle, info->hwParams, &alsaBufferSizeInFrames);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params_set_buffer_size_near(info->handle, info->hwParams, alsaBufferSizeInFrames);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:               (int) alsaBufferSizeInFrames, snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_hw_params_set_period_time_near(info->handle, info->hwParams, &periodTime, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        periodTime = snd_pcm_hw_params_set_period_time_near(info->handle, info->hwParams, periodTime, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR2("Unable to set period time to %d: %s\n", DEFAULT_PERIOD_TIME, snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_hw_params_set_periods_near(info->handle, info->hwParams, &periods, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        periods = snd_pcm_hw_params_set_periods_near(info->handle, info->hwParams, periods, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR2("Unable to set period count to %d: %s\n", /*periods*/ 2, snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_hw_params(info->handle, info->hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Unable to set hw params: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_sw_params_current(info->handle, info->swParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Unable to determine current swparams: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_sw_params_set_avail_min(info->handle, info->swParams, info->periodSize);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Unable to set avail min for playback: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_sw_params_set_xfer_align(info->handle, info->swParams, 1);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Unable to set transfer align: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_sw_params(info->handle, info->swParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("Unable to set sw params: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:static snd_output_t* ALSA_OUTPUT = NULL;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_format_mask_t* formatMask;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_format_t format;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    /* snd_pcm_uframes_t is 64 bit on 64-bit systems */
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_uframes_t alsaPeriodSize = 0;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_uframes_t alsaBufferSizeInFrames = 0;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_output_stdio_attach(&ALSA_OUTPUT, stdout, 0);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_pcm_nonblock(info->handle, 0);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_hw_params_malloc(&(info->hwParams));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("  snd_pcm_hw_params_malloc returned error %d\n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                    ret = snd_pcm_hw_params_get_period_size(info->hwParams, &alsaPeriodSize, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                        ERROR1("ERROR: snd_pcm_hw_params_get_period: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                    snd_pcm_hw_params_get_periods(info->hwParams, &(info->periods), &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                    snd_pcm_hw_params_get_buffer_size(info->hwParams, &alsaBufferSizeInFrames);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                    info->periodSize = snd_pcm_hw_params_get_period_size(info->hwParams, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                    info->periods = snd_pcm_hw_params_get_periods(info->hwParams, &dir);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                    info->bufferSizeInBytes = snd_pcm_hw_params_get_buffer_size(info->hwParams) * frameSize;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ret = snd_pcm_sw_params_malloc(&(info->swParams));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                ERROR1("snd_pcm_hw_params_malloc returned error %d\n", ret);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ret = snd_pcm_prepare(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                ERROR1("ERROR: snd_pcm_prepare: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ret = snd_pcm_status_malloc(&(info->positionStatus));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                ERROR1("ERROR in snd_pcm_status_malloc: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_pcm_nonblock(info->handle, 1);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:void printState(snd_pcm_state_t state) {
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_state_t state;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_nonblock(info->handle, 0);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    state = snd_pcm_state(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_pause(info->handle, FALSE);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR2("  NOTE: error in snd_pcm_pause:%d: %s\n", ret, snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_resume(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:                ERROR2("  ERROR: error in snd_pcm_resume:%d: %s\n", ret, snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_prepare(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("ERROR: snd_pcm_prepare: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_start(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR2("  NOTE: error in snd_pcm_start: %d: %s\n", ret, snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_nonblock(info->handle, 1);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("  ERROR in snd_pcm_nonblock: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    state = snd_pcm_state(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_nonblock(info->handle, 0);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_pause(info->handle, 1);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_nonblock(info->handle, 1);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("ERROR in snd_pcm_pause: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            snd_pcm_close(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            snd_pcm_hw_params_free(info->hwParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            snd_pcm_sw_params_free(info->swParams);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            snd_pcm_status_free(info->positionStatus);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_prepare(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("Can't recover from underrun/overflow, prepare failed: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_resume(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_prepare(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("Can't recover from underrun/overflow, prepare failed: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    TRACE2("xrun_recovery: unexpected error %d: %s\n", err, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_sframes_t frameSize, writtenFrames;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    //frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        writtenFrames = snd_pcm_writei(info->handle, (const void*) data, (snd_pcm_uframes_t) frameSize);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    //ret =  snd_pcm_frames_to_bytes(info->handle, writtenFrames);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_sframes_t frameSize, readFrames;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    //frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        readFrames = snd_pcm_readi(info->handle, (void*) data, (snd_pcm_uframes_t) frameSize);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    //ret =  snd_pcm_frames_to_bytes(info->handle, readFrames);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_state_t state;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    state = snd_pcm_state(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    ret = snd_pcm_drop(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ERROR1("ERROR in snd_pcm_drop: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_sframes_t availableInFrames;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_state_t state;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    state = snd_pcm_state(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        availableInFrames = snd_pcm_avail_update(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            //ret = snd_pcm_frames_to_bytes(info->handle, availableInFrames);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    snd_pcm_state_t state;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:    state = snd_pcm_state(info->handle);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_timestamp_t* ts;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_pcm_uframes_t framesAvail;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_status(info->handle, info->positionStatus);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("ERROR in snd_pcm_status: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            framesAvail = snd_pcm_status_get_avail(info->positionStatus);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        snd_pcm_uframes_t framesAvail;
+PLATFORM_API_LinuxOS_ALSA_PCM.c:        ret = snd_pcm_avail(info->handle, &framesAvail);
+PLATFORM_API_LinuxOS_ALSA_PCM.c:            ERROR1("ERROR in snd_pcm_avail: %s\n", snd_strerror(ret));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_elem_t* elem;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_t* mixer_handle;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_elem_t** elems;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_t *handle;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_card_info_t* info;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_card_info_malloc(&info);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    if (snd_card_next(&card) >= 0) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:            err = snd_ctl_open(&handle, devname, 0);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                ERROR2("ERROR: snd_ctl_open, card=%d: %s\n", card, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                snd_ctl_close(handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:            if (snd_card_next(&card) < 0) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_card_info_free(info);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_t* handle;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_card_info_t* card_info;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_card_info_malloc(&card_info);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    err = snd_ctl_open(&handle, devname, 0);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        ERROR2("ERROR: snd_ctl_open, card=%d: %s\n", (int) mixerIndex, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    err = snd_ctl_card_info(handle, card_info);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        ERROR2("ERROR: snd_ctl_card_info, card=%d: %s\n", (int) mixerIndex, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    strncpy(description->name, snd_ctl_card_info_get_id(card_info), PORT_STRING_LENGTH - 1);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    strncpy(description->description, snd_ctl_card_info_get_name(card_info), PORT_STRING_LENGTH - 1);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    strncat(description->description, snd_ctl_card_info_get_mixername(card_info), PORT_STRING_LENGTH - 1 - strlen(description->description));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_close(handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_ctl_card_info_free(card_info);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_t* mixer_handle;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    if ((err = snd_mixer_open(&mixer_handle, 0)) < 0) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        ERROR2("Mixer %s open error: %s", devname, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    if ((err = snd_mixer_attach(mixer_handle, devname)) < 0) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        ERROR2("Mixer attach %s error: %s", devname, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_close(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    if ((err = snd_mixer_selem_register(mixer_handle, NULL, NULL)) < 0) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        ERROR1("Mixer register error: %s", snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_close(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    err = snd_mixer_load(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        ERROR2("Mixer %s load error: %s", devname, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_close(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_close(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    handle->elems = (snd_mixer_elem_t**) calloc(MAX_ELEMS, sizeof(snd_mixer_elem_t*));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_close(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_close(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_close(mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:            snd_mixer_close(handle->mixer_handle);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_elem_t *elem;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        for (elem = snd_mixer_first_elem(portMixer->mixer_handle); elem; elem = snd_mixer_elem_next(elem)) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:            if (!snd_mixer_selem_is_active(elem))
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                   snd_mixer_selem_get_name(elem),
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                   snd_mixer_selem_get_index(elem));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:            if (snd_mixer_selem_has_playback_volume(elem)) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:            if (snd_mixer_selem_has_capture_volume(elem)) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    nam = snd_mixer_selem_get_name(portMixer->elems[portIndex]);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                                 snd_mixer_elem_t* elem, int isPlayback) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_capture_volume_range(elem, &min, &max);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_elem_t* elem;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_selem_channel_id_t channel;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    if (snd_mixer_selem_has_playback_volume(elem) || snd_mixer_selem_has_capture_volume(elem)) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        isMono = (isPlayback && snd_mixer_selem_is_playback_mono(elem)) ||
+PLATFORM_API_LinuxOS_ALSA_Ports.c:            (!isPlayback && snd_mixer_selem_is_capture_mono(elem));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                    snd_mixer_selem_has_playback_channel(elem, SND_MIXER_SCHN_FRONT_LEFT) &&
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                    snd_mixer_selem_has_playback_channel(elem, SND_MIXER_SCHN_FRONT_RIGHT)) ||
+PLATFORM_API_LinuxOS_ALSA_Ports.c:             snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_FRONT_LEFT) &&
+PLATFORM_API_LinuxOS_ALSA_Ports.c:             snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_FRONT_RIGHT));
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                if (isPlayback && snd_mixer_selem_has_playback_channel(elem, channel) ||
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                    !isPlayback && snd_mixer_selem_has_capture_channel(elem, channel)) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                            control = (creator->newCompoundControl)(creator, (char*) snd_mixer_selem_channel_name(channel), &control, 1);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    if (snd_mixer_selem_has_playback_switch(elem) || snd_mixer_selem_has_capture_switch(elem)) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    portName = (char*) snd_mixer_selem_get_name(elem);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_selem_channel_id_t channel;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                snd_mixer_selem_get_playback_switch(portControl->elem, channel, &value);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                snd_mixer_selem_get_capture_switch(portControl->elem, channel, &value);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:    snd_mixer_selem_channel_id_t channel;
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                snd_mixer_selem_set_playback_switch_all(portControl->elem, value);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                snd_mixer_selem_set_capture_switch_all(portControl->elem, value);
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                    snd_mixer_selem_channel_id_t channel) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_playback_volume_range(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_playback_volume(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_capture_volume_range(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_capture_volume(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_Ports.c:                   snd_mixer_selem_channel_id_t channel, float value) {
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_playback_volume_range(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_set_playback_volume(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_get_capture_volume_range(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_Ports.c:        snd_mixer_selem_set_capture_volume(portControl->elem,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        return snd_strerror((int) err);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                                 snd_rawmidi_info_t* rawmidi_info,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                                 snd_ctl_card_info_t* cardinfo,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:static int iterateRawmidiDevices(snd_rawmidi_stream_t direction,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_ctl_t *handle;
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_rawmidi_t *rawmidi;
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_rawmidi_info_t *rawmidi_info;
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_ctl_card_info_t *card_info, *defcardinfo = NULL;
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_rawmidi_info_malloc(&rawmidi_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_ctl_card_info_malloc(&card_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        err = snd_rawmidi_open(&rawmidi, NULL, ALSA_DEFAULT_DEVICE_NAME,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        err = snd_rawmidi_open(NULL, &rawmidi, ALSA_DEFAULT_DEVICE_NAME,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        ERROR1("ERROR: snd_rawmidi_open (\"default\"): %s\n",
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:               snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        err = snd_rawmidi_info(rawmidi, rawmidi_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        snd_rawmidi_close(rawmidi);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            ERROR1("ERROR: snd_rawmidi_info (\"default\"): %s\n",
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                    snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            card = snd_rawmidi_info_get_card(rawmidi_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                if (snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK) >= 0) {
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                    if (snd_ctl_card_info(handle, card_info) >= 0) {
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                    snd_ctl_close(handle);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    if (snd_card_next(&card) >= 0) {
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            err = snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                ERROR2("ERROR: snd_ctl_open, card=%d: %s\n", card, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                TRACE0("snd_ctl_open() SUCCESS\n");
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                err = snd_ctl_card_info(handle, card_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                    ERROR2("ERROR: snd_ctl_card_info, card=%d: %s\n", card, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                    TRACE0("snd_ctl_card_info() SUCCESS\n");
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                        if (snd_ctl_rawmidi_next_device(handle, &dev) < 0) {
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                            ERROR0("snd_ctl_rawmidi_next_device\n");
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                        TRACE0("snd_ctl_rawmidi_next_device() SUCCESS\n");
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                        snd_rawmidi_info_set_device(rawmidi_info, dev);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                        snd_rawmidi_info_set_subdevice(rawmidi_info, 0);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                        snd_rawmidi_info_set_stream(rawmidi_info, direction);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                        err = snd_ctl_rawmidi_info(handle, rawmidi_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                        TRACE0("after snd_ctl_rawmidi_info()\n");
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                                ERROR2("ERROR: snd_ctl_rawmidi_info, card=%d: %s", card, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                            TRACE0("snd_ctl_rawmidi_info() SUCCESS\n");
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                                ? snd_rawmidi_info_get_subdevices_count(rawmidi_info)
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                snd_ctl_close(handle);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            if (snd_card_next(&card) < 0) {
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_ctl_card_info_free(card_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_rawmidi_info_free(rawmidi_info);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:int getMidiDeviceCount(snd_rawmidi_stream_t direction) {
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:static int deviceInfoIterator(UINT32 deviceID, snd_rawmidi_info_t *rawmidi_info,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                              snd_ctl_card_info_t *cardinfo, void *userData) {
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                    ? snd_ctl_card_info_get_id(cardinfo)
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:                    : snd_rawmidi_info_get_id(rawmidi_info),
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            strncpy(desc->description, snd_ctl_card_info_get_name(cardinfo),
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        strncat(desc->description, snd_rawmidi_info_get_id(rawmidi_info),
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        strncat(desc->description, snd_rawmidi_info_get_name(rawmidi_info),
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:static int getMIDIDeviceDescriptionByIndex(snd_rawmidi_stream_t direction,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:int getMidiDeviceName(snd_rawmidi_stream_t direction, int index, char *name,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:int getMidiDeviceDescription(snd_rawmidi_stream_t direction,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:static int getMidiDeviceID(snd_rawmidi_stream_t direction, int index,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:INT32 openMidiDevice(snd_rawmidi_stream_t direction, INT32 deviceIndex,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_rawmidi_t* native_handle;
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    snd_midi_event_t* event_parser = NULL;
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        err = snd_rawmidi_open(&native_handle, NULL, devicename,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        err = snd_rawmidi_open(NULL, &native_handle, devicename,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        ERROR1("<  ERROR: openMidiDevice(): snd_rawmidi_open() returned %d\n", err);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        err = snd_rawmidi_nonblock(native_handle, 0);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            ERROR1("  ERROR: openMidiDevice(): snd_rawmidi_nonblock() returned %d\n", err);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            snd_rawmidi_close(native_handle);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        err = snd_midi_event_new(EVENT_PARSER_BUFSIZE, &event_parser);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            ERROR1("  ERROR: openMidiDevice(): snd_midi_event_new() returned %d\n", err);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:            snd_rawmidi_close(native_handle);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    err = snd_rawmidi_close((snd_rawmidi_t*) handle->deviceHandle);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:    TRACE1("  snd_rawmidi_close() returns %d\n", err);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.c:        snd_midi_event_free((snd_midi_event_t*) handle->platformData);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.h:int getMidiDeviceCount(snd_rawmidi_stream_t direction);
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.h:int getMidiDeviceName(snd_rawmidi_stream_t direction, int index,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.h:int getMidiDeviceDescription(snd_rawmidi_stream_t direction, int index,
+PLATFORM_API_LinuxOS_ALSA_MidiUtils.h:INT32 openMidiDevice(snd_rawmidi_stream_t direction, INT32 deviceIndex,
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:    snd_seq_event_t alsa_message;
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:       no data from the device, snd_rawmidi_read() returns with -11 (EAGAIN).
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:        TRACE0("before snd_rawmidi_read()\n");
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:        err = snd_rawmidi_read((snd_rawmidi_t*) handle->deviceHandle, buffer, 1);
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:        TRACE0("after snd_rawmidi_read()\n");
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:            ERROR2("< ERROR: MIDI_IN_GetMessage(): snd_rawmidi_read() returned %d : %s\n", err, snd_strerror(err));
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:        err = snd_midi_event_encode_byte((snd_midi_event_t*) handle->platformData,
+PLATFORM_API_LinuxOS_ALSA_MidiIn.c:            ERROR1("< ERROR: MIDI_IN_GetMessage(): snd_midi_event_encode_byte() returned %d\n", err);
diff --git openjdk-orig/investigation/sysinfo.txt openjdk/investigation/sysinfo.txt
new file mode 100644
index 0000000..9034108
--- /dev/null
+++ openjdk/investigation/sysinfo.txt
@@ -0,0 +1,90 @@
+hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp:  size_t bufsize = sysinfo(si, &tmp, 1);
+hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp:  if (sysinfo(si, buf, bufsize) == bufsize) {
+hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp:    size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1);
+hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp:      if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) {
+hotspot/src/os/windows/vm/os_windows.cpp:    //   default.asp?url=/library/en-us/sysinfo/base/
+hotspot/src/os/windows/vm/os_windows.cpp:    //   /library/en-us/sysinfo/base/settimezoneinformation.asp
+hotspot/src/os/solaris/launcher/java_md.c:    sysinfo(SI_ARCHITECTURE, buf, sizeof(buf));
+hotspot/src/os/solaris/launcher/java_md.c:       * sysinfo.  This case cannot occur on 64-bit hardware and thus
+hotspot/src/os/solaris/launcher/java_md.c:        char buf[257];  /* recommended buffer size from sysinfo man
+hotspot/src/os/solaris/launcher/java_md.c:        length = sysinfo(SI_ISALIST, buf, 257);
+hotspot/src/os/solaris/vm/os_solaris.cpp:  sysinfo(SI_ARCHITECTURE, arch, sizeof(arch));
+hotspot/src/os/solaris/vm/os_solaris.cpp:      sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch));
+hotspot/src/os/solaris/vm/os_solaris.cpp:        sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch));
+hotspot/src/os/linux/launcher/java_md.c:    sysinfo(SI_ARCHITECTURE, buf, sizeof(buf));
+hotspot/src/os/linux/launcher/java_md.c:       * sysinfo.  This case cannot occur on 64-bit hardware and thus
+hotspot/src/os/linux/launcher/java_md.c:        char buf[257];  /* recommended buffer size from sysinfo man
+hotspot/src/os/linux/launcher/java_md.c:        length = sysinfo(SI_ISALIST, buf, 257);
+hotspot/src/os/linux/vm/os_linux.cpp:# include <sys/sysinfo.h>
+hotspot/src/os/linux/vm/os_linux.cpp:  // values in struct sysinfo are "unsigned long"
+hotspot/src/os/linux/vm/os_linux.cpp:  struct sysinfo si;
+hotspot/src/os/linux/vm/os_linux.cpp:  sysinfo(&si);
+hotspot/src/os/linux/vm/os_linux.cpp://  sysinfo(SI_ARCHITECTURE, arch, sizeof(arch));
+hotspot/src/os/linux/vm/os_linux.cpp:  // values in struct sysinfo are "unsigned long"
+hotspot/src/os/linux/vm/os_linux.cpp:  struct sysinfo si;
+hotspot/src/os/linux/vm/os_linux.cpp:  sysinfo(&si);
+hotspot/lsb/lsb_wrappers.c:#include <sys/sysinfo.h>
+hotspot/lsb/lsb_wrappers.c:LSB_CHECKER(DEFAULT,sysinfo);
+hotspot/lsb/lsb_wrappers.c:int sysinfo (struct sysinfo *__info)
+hotspot/lsb/lsb_wrappers.c:    LSB_WRAPPER_CALL(sysinfo,__info);
+hotspot/lsb/lsb_config.h:// sysinfo (bug #2163)
+hotspot/lsb/lsb_config.h:LSB_AVAIL_RUNTIME(sysinfo);
+hotspot/lsb/include/sys/sysinfo.h:/* struct sysinfo from linux/kernel.h.  Complies to sysinfo manpage */
+hotspot/lsb/include/sys/sysinfo.h:struct sysinfo {
+hotspot/lsb/include/sys/sysinfo.h:extern int sysinfo (struct sysinfo *__info);
+hotspot/lsb/include/sys/sysinfo.h:#endif	/* sys/sysinfo.h */
+hotspot/lsb/include/elf.h:#define NT_PLATFORM	5		/* String from sysinfo(SI_PLATFORM) */
+Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libfreebl_hybrid_3.so matches
+Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libsoftokn3.so matches
+Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libsoftokn3.so matches
+Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libfreebl3.so matches
+Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libsoftokn3.so matches
+jdk/src/windows/hpi/src/threads_md.c:        SYSTEM_INFO sysinfo;
+jdk/src/windows/hpi/src/threads_md.c:        GetSystemInfo(&sysinfo);
+jdk/src/windows/hpi/src/threads_md.c:        info.isMP = sysinfo.dwNumberOfProcessors > 1;
+jdk/src/solaris/bin/java_md.c:       * sysinfo.  This case cannot occur on 64-bit hardware and thus
+jdk/src/solaris/bin/java_md.c:        char buf[257];  /* recommended buffer size from sysinfo man
+jdk/src/solaris/bin/java_md.c:        length = sysinfo(SI_ISALIST, buf, 257);
+jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c:     * in /etc/resolv.conf then sysinfo or gethostname is used to
+jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c:        int ret = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf));
+jdk/src/solaris/native/sun/awt/fontpath.c:        if (sysinfo(SI_RELEASE, sysinfobuf, SYSINFOBUFSZ) == 4) {
+jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c:    struct utsname sysinfo;
+jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c:    if (uname(&sysinfo) == 0) {
+jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c:        sysinfo.release[3] = '\0';
+jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c:        isOldKernel = (strcmp(sysinfo.release, "2.2") == 0);
+jdk/src/solaris/native/java/net/net_util_md.c:        struct utsname sysinfo;
+jdk/src/solaris/native/java/net/net_util_md.c:        if (uname(&sysinfo) == 0) {
+jdk/src/solaris/native/java/net/net_util_md.c:            sysinfo.release[3] = '\0';
+jdk/src/solaris/native/java/net/net_util_md.c:            if (strcmp(sysinfo.release, "2.2") == 0) {
+jdk/src/solaris/native/java/net/net_util_md.c:        struct utsname sysinfo;
+jdk/src/solaris/native/java/net/net_util_md.c:        if (uname(&sysinfo) == 0) {
+jdk/src/solaris/native/java/net/net_util_md.c:            sysinfo.release[3] = '\0';
+jdk/src/solaris/native/java/net/net_util_md.c:            if (strcmp(sysinfo.release, "2.4") == 0) {
+jdk/src/solaris/native/java/lang/java_props_md.c:        sysinfo(SI_ISALIST, list, sizeof(list));
+jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c:#include <sys/sysinfo.h>
+jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c:    struct sysinfo si;
+jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c:    ret = sysinfo(&si);
+jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c:        throw_internal_error(env, "sysinfo failed to get swap size");
+jdk/src/linux/lsb/lsb_wrappers.c:#include <sys/sysinfo.h>
+jdk/src/linux/lsb/lsb_wrappers.c:LSB_CHECKER(DEFAULT,sysinfo);
+jdk/src/linux/lsb/lsb_wrappers.c:int sysinfo (struct sysinfo *__info)
+jdk/src/linux/lsb/lsb_wrappers.c:    LSB_WRAPPER_CALL(sysinfo,__info);
+jdk/src/linux/lsb/lsb_config.h:// sysinfo (bug #2163)
+jdk/src/linux/lsb/lsb_config.h:LSB_AVAIL_RUNTIME(sysinfo);
+jdk/src/linux/lsb/include/sys/sysinfo.h:/* struct sysinfo from linux/kernel.h.  Complies to sysinfo manpage */
+jdk/src/linux/lsb/include/sys/sysinfo.h:struct sysinfo {
+jdk/src/linux/lsb/include/sys/sysinfo.h:extern int sysinfo (struct sysinfo *__info);
+jdk/src/linux/lsb/include/sys/sysinfo.h:#endif	/* sys/sysinfo.h */
+jdk/src/linux/lsb/include/elf.h:#define NT_PLATFORM	5		/* String from sysinfo(SI_PLATFORM) */
+jdk/make/sun/cmm/kcms/FILES_c_windows.gmk:	sysinfo.c \
+jdk/lsb/lsb_wrappers.c:#include <sys/sysinfo.h>
+jdk/lsb/lsb_wrappers.c:LSB_CHECKER(DEFAULT,sysinfo);
+jdk/lsb/lsb_wrappers.c:int sysinfo (struct sysinfo *__info)
+jdk/lsb/lsb_wrappers.c:    LSB_WRAPPER_CALL(sysinfo,__info);
+jdk/lsb/lsb_config.h:// sysinfo (bug #2163)
+jdk/lsb/lsb_config.h:LSB_AVAIL_RUNTIME(sysinfo);
+jdk/lsb/include/sys/sysinfo.h:/* struct sysinfo from linux/kernel.h.  Complies to sysinfo manpage */
+jdk/lsb/include/sys/sysinfo.h:struct sysinfo {
+jdk/lsb/include/sys/sysinfo.h:extern int sysinfo (struct sysinfo *__info);
+jdk/lsb/include/sys/sysinfo.h:#endif	/* sys/sysinfo.h */
+jdk/lsb/include/elf.h:#define NT_PLATFORM	5		/* String from sysinfo(SI_PLATFORM) */
diff --git openjdk-orig/investigation/thr_sefl.txt openjdk/investigation/thr_sefl.txt
new file mode 100644
index 0000000..79b5e37
--- /dev/null
+++ openjdk/investigation/thr_sefl.txt
@@ -0,0 +1,29 @@
+jdk/src/solaris/hpi/native_threads/src/threads_solaris.c:    thr_getprio(thr_self(), &gcprio);
+jdk/src/solaris/hpi/native_threads/src/threads_solaris.c:    thr_setprio(thr_self(), 2147483647);  /* #define INT_MAX 2147483647 */
+jdk/src/solaris/hpi/native_threads/src/threads_solaris.c:    thr_setprio(thr_self(), gcprio);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->sys_thread = thr_self();
+jdk/src/solaris/hpi/native_threads/src/interrupt_md.c:    thread_t self = thr_self();
+jdk/src/solaris/hpi/native_threads/src/interrupt_md.c:    thread_t self = thr_self();
+jdk/src/solaris/hpi/native_threads/src/interrupt_md.c:    thread_t self = thr_self();
+jdk/src/solaris/hpi/native_threads/src/interrupt_md.c:    thread_t self = thr_self();
+
+                               TADAAAAAM!                  -------------------------------V
+
+jdk/src/solaris/hpi/native_threads/include/porting.h:#define thr_self                pthread_self
+
+
+hotspot/src/os/solaris/vm/jsig.c:    if (tid != thr_self()) {
+hotspot/src/os/solaris/vm/jsig.c:  tid = thr_self();
+hotspot/src/os/solaris/vm/os_solaris.cpp:  OSThread* osthread = create_os_thread(thread, thr_self());
+hotspot/src/os/solaris/vm/os_solaris.cpp:  return (intx)thr_self();
+hotspot/src/os/solaris/vm/os_solaris.cpp:  // %%%       In current versions of Solaris, thr_self and TSD can
+hotspot/src/os/solaris/vm/os_solaris.cpp:  //           The value of thr_self is available as %g7(36).
+hotspot/src/os/solaris/vm/os_solaris.cpp:  main_thread = thr_self();
+hotspot/src/os/solaris/vm/os_solaris.cpp:      record_synch_thread[record_synch_count] = thr_self();
+hotspot/src/os/solaris/vm/threadCritical_solaris.cpp:    thread_t owner = thr_self();
+hotspot/src/os/solaris/vm/threadCritical_solaris.cpp:    assert(global_mut_owner == thr_self(), "must have correct owner");
+hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp:  Thread* thr_self = Thread::current();
+hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp:        to_fill->set_zero_fill_in_progress(thr_self);
+hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp:            && to_fill->zero_filler() == thr_self) {
+hotspot/src/share/vm/utilities/workgroup.cpp:  thread_t tslf = thr_self();
+hotspot/src/share/vm/utilities/workgroup.cpp:             thr_self(), id, _waiters, _claimed);
diff --git openjdk-orig/investigation/thread_id.txt openjdk/investigation/thread_id.txt
new file mode 100644
index 0000000..f1f075f
--- /dev/null
+++ openjdk/investigation/thread_id.txt
@@ -0,0 +1,62 @@
+hotspot/src/os/linux/vm/os_linux.cpp:  // thread_id is kernel thread id (similar to Solaris LWP id)
+hotspot/src/os/linux/vm/os_linux.cpp:  // OSThread::thread_id() method in osThread_linux.hpp file
+hotspot/src/os/linux/vm/os_linux.cpp:  int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
+hotspot/src/os/linux/vm/os_linux.cpp:  *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id());
+hotspot/src/os/linux/vm/os_linux.cpp:  pid_t  tid = thread->osthread()->thread_id();
+hotspot/src/os/linux/vm/osThread_linux.hpp:  // thread has a unique thread_id (LinuxThreads or NPTL). It can be used
+hotspot/src/os/linux/vm/osThread_linux.hpp:  pid_t thread_id() const {
+hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp:                          myThread(), myThread()->osthread()->thread_id(),
+hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp:                      tag, thrd, thrd->osthread()->thread_id(),
+hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp:                        "slow", thrd, thrd->osthread()->thread_id(),
+ /// ????
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:  reference_info.stack_local.thread_id = tid;
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:  jlong tid = java_lang_Thread::thread_id(threadObj);
+
+    // posix
+hotspot/src/share/vm/compiler/compileLog.cpp:CompileLog::CompileLog(const char* file, FILE* fp, intx thread_id)
+hotspot/src/share/vm/compiler/compileLog.cpp:  _thread_id = thread_id;
+hotspot/src/share/vm/compiler/compileLog.cpp:      jio_snprintf(buf, buflen, UINTX_FORMAT, log->thread_id());
+hotspot/src/share/vm/compiler/compileLog.hpp:  CompileLog(const char* file, FILE* fp, intx thread_id);
+hotspot/src/share/vm/compiler/compileLog.hpp:  intx          thread_id()                      { return _thread_id; }
+hotspot/src/share/vm/compiler/compileBroker.cpp:    intx thread_id = os::current_thread_id();
+hotspot/src/share/vm/compiler/compileBroker.cpp:              dir, thread_id, os::current_process_id());
+hotspot/src/share/vm/compiler/compileBroker.cpp:      CompileLog* log = new(ResourceObj::C_HEAP) CompileLog(file, fp, thread_id);
+hotspot/src/share/vm/compiler/compileBroker.cpp:        xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file);
+
+hotspot/src/share/vm/interpreter/bytecodeTracer.cpp:      st->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
+hotspot/src/share/vm/interpreter/bytecodeTracer.cpp:    st->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
+hotspot/src/share/vm/services/jmm.h:  jlong        (JNICALL *GetThreadCpuTime)       (JNIEnv *env, jlong thread_id);
+hotspot/src/share/vm/services/jmm.h:                                                    jlong thread_id,
+hotspot/src/share/vm/services/management.cpp:static JavaThread* find_java_thread_from_id(jlong thread_id) {
+hotspot/src/share/vm/services/management.cpp:        thread_id == java_lang_Thread::thread_id(tobj)) {
+hotspot/src/share/vm/services/management.cpp:// If thread_id == 0, return CPU time for the current thread.
+hotspot/src/share/vm/services/management.cpp:JVM_ENTRY(jlong, jmm_GetThreadCpuTime(JNIEnv *env, jlong thread_id))
+hotspot/src/share/vm/services/management.cpp:  if (thread_id < 0) {
+hotspot/src/share/vm/services/management.cpp:  if (thread_id == 0) {
+hotspot/src/share/vm/services/management.cpp:    java_thread = find_java_thread_from_id(thread_id);
+hotspot/src/share/vm/services/management.cpp:// If thread_id == 0, CPU time for the current thread is returned.
+hotspot/src/share/vm/services/management.cpp:JVM_ENTRY(jlong, jmm_GetThreadCpuTimeWithKind(JNIEnv *env, jlong thread_id, jboolean user_sys_cpu_time))
+hotspot/src/share/vm/services/management.cpp:  if (thread_id < 0) {
+hotspot/src/share/vm/services/management.cpp:  if (thread_id == 0) {
+hotspot/src/share/vm/services/management.cpp:    java_thread = find_java_thread_from_id(thread_id);
+hotspot/src/share/vm/runtime/osThread.cpp:  st->print("nid=0x%lx ", thread_id());
+hotspot/src/share/vm/runtime/thread.cpp:      java_lang_Thread::thread_id((javathread)->threadObj()),              \
+hotspot/src/share/vm/runtime/thread.cpp:      (javathread)->osthread()->thread_id(),                               \
+hotspot/src/share/vm/runtime/thread.cpp:  tty->print_cr("Thread::%s " INTPTR_FORMAT " [%lx] %s (prio: %d)", msg, thread, thread->osthread()->thread_id(), name, prio);
+hotspot/src/share/vm/runtime/thread.cpp:    st->print(" [id=%d]", osthread()->thread_id());
+hotspot/src/share/vm/runtime/thread.cpp:    st->print(", id=%d", osthread()->thread_id());
+hotspot/src/share/vm/runtime/deoptimization.cpp:        tty->print_cr("  Thread = " INTPTR_FORMAT ", thread ID = " UINTX_FORMAT, thread, thread->osthread()->thread_id());
+hotspot/src/share/vm/runtime/safepoint.cpp:               _thread, _thread->osthread()->thread_id(), s, _has_called_back,
+hotspot/src/share/vm/runtime/sharedRuntime.cpp:      return (obj == NULL) ? 0 : java_lang_Thread::thread_id(obj);
+hotspot/src/share/vm/utilities/defaultStream.hpp:  intx _writer;    // thread_id with current rights to output
+hotspot/src/share/vm/utilities/ostream.cpp:  intx thread_id = os::current_thread_id();
+hotspot/src/share/vm/utilities/ostream.cpp:  intx holder = hold(thread_id);
+hotspot/src/share/vm/utilities/ostream.cpp:  intx thread_id = os::current_thread_id();
+hotspot/src/share/vm/utilities/ostream.cpp:  return defaultStream::instance->hold(thread_id);
+jdk/src/solaris/sample/dtrace/hotspot/monitors.d:    /* (uintptr_t thread_id, uintptr_t monitor_id,
+jdk/src/solaris/sample/dtrace/hotspot/monitors.d:    /* (uintptr_t thread_id, uintptr_t monitor_id, char* obj_class_name,
+jdk/src/share/javavm/export/jmm.h:  jlong        (JNICALL *GetThreadCpuTime)       (JNIEnv *env, jlong thread_id);
+jdk/src/share/javavm/export/jmm.h:                                                    jlong thread_id,
+jdk/src/share/javavm/export/jvmti.h:    jlong thread_id;
+jdk/src/share/javavm/export/jvmti.h:    jlong thread_id;
+jdk/src/share/demo/jvmti/hprof/hprof_io.h:void io_heap_root_thread_object(ObjectIndex thread_id,
diff --git openjdk-orig/investigation/thread_identifier.txt openjdk/investigation/thread_identifier.txt
new file mode 100644
index 0000000..8457059
--- /dev/null
+++ openjdk/investigation/thread_identifier.txt
@@ -0,0 +1,3 @@
+hotspot/src/os/windows/vm/osThread_windows.hpp:  int thread_identifier() const                    { return _thread_id; }
+hotspot/src/os/solaris/vm/osThread_solaris.hpp:  int thread_identifier() const   { return _thread_id; }
+hotspot/src/os/linux/vm/osThread_linux.hpp:  int thread_identifier() const   { return _thread_id; }
diff --git openjdk-orig/investigation/tids.txt openjdk/investigation/tids.txt
new file mode 100644
index 0000000..1ff610c
--- /dev/null
+++ openjdk/investigation/tids.txt
@@ -0,0 +1,421 @@
+jdk/src/solaris/bin/java_md.c:    pthread_t tid;
+jdk/src/solaris/bin/java_md.c:    if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
+jdk/src/solaris/bin/java_md.c:      pthread_join(tid, &tmp);
+jdk/src/solaris/bin/java_md.c:    thread_t tid;
+jdk/src/solaris/bin/java_md.c:    if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
+jdk/src/solaris/bin/java_md.c:      thr_join(tid, NULL, &tmp);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:   of getting the tid more efficient */
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid = sysThreadSelf();
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        (char *)(tid)->stack_bottom - (char *)&(tid) + STACK_REDZONE <
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:            tid->stack_size) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid = allocThreadBlock();
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (tid == NULL) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    memset((char *)tid, 0, sizeof(sys_thread_t));
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        np_profiler_init(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (np_stackinfo(&tid->stack_bottom, &tid->stack_size) == SYS_ERR) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->stack_top = tid->stack_bottom - tid->stack_size;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->stack_top = (void *)((char *)(tid->stack_bottom) - tid->stack_size);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->primordial_thread = 0;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->interrupted = tid->pending_interrupt = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->interrupted = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->onproc = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->sys_thread = thr_self();
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_initialize_thread(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = thr_setspecific(tid_key, tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->next = ThreadQueue;    /* Chain all threads */
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    ThreadQueue = tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    *tidP = tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadStackPointer(sys_thread_t * tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (tid == sysThreadSelf()) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        return (void *) tid->sp;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadStackTop(sys_thread_t *tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    return tid->stack_top;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadRegs(sys_thread_t * tid, int *nregs)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    return tid->regs;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid = (sys_thread_t *)tid_;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_initialize_thread(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->sp = 0;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    thr_setspecific(tid_key, tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_stackinfo(&tid->stack_bottom, &tid->stack_size);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->stack_top = (void *)((char *)(tid->stack_bottom) - tid->stack_size);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_initial_suspend(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sem_wait(&tid->sem);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sem_destroy(&tid->sem);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_mutex_lock(&tid->ntcond.m);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->ntcond.state = NEW_THREAD_REQUESTED_SUSPEND;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_cond_signal(&tid->ntcond.c);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    while (tid->ntcond.state != NEW_THREAD_SUSPENDED)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        pthread_cond_wait(&tid->ntcond.c, &tid->ntcond.m);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_mutex_unlock(&tid->ntcond.m);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        np_profiler_init(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->sp = 0;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    thr_setspecific(tid_key, tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->state = RUNNABLE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_stackinfo(&tid->stack_bottom, &tid->stack_size);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->stack_top = (void *)((char *)(tid->stack_bottom) - tid->stack_size);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->start_proc(tid->start_parm);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid = allocThreadBlock();
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (tid == NULL) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    *tidP = tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    memset((char *)tid, 0, sizeof(sys_thread_t));
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->interrupted = tid->pending_interrupt = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->interrupted = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->onproc = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->next = ThreadQueue;    /* Chain all threads */
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    ThreadQueue = tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->start_proc = start;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->start_parm = arg;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->state = SUSPENDED;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->primordial_thread = 0;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = sem_init(&tid->sem_suspended, 0, 0);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = pthread_create(&tid->sys_thread, &attr, _start, (void *)tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        err = sem_wait(&tid->sem_suspended);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:            sem_destroy(&tid->sem_suspended);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->next = ThreadQueue;    /* Chain all threads */
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    ThreadQueue = tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = sem_init(&tid->sem, 0, 0);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_mutex_init(&tid->ntcond.m, NULL);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_cond_init(&tid->ntcond.c, NULL);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->ntcond.state = NEW_THREAD_MUST_REQUEST_SUSPEND;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_mutex_lock(&tid->ntcond.m);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = pthread_create(&tid->sys_thread, &attr, _start, (void *)tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:       err = np_suspend(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:           err = sem_post(&tid->sem);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    while (tid->ntcond.state != NEW_THREAD_REQUESTED_SUSPEND)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        pthread_cond_wait(&tid->ntcond.c, &tid->ntcond.m);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_suspend(tid->sys_thread);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->ntcond.state = NEW_THREAD_SUSPENDED;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_cond_signal(&tid->ntcond.c);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_mutex_unlock(&tid->ntcond.m);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = thr_create(NULL, stack_size, _start, (void *)tid,
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:                     &tid->sys_thread);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->state = SUSPENDED;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid = sysThreadSelf();
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    SYS_QUEUE_LOCK(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    removeFromActiveQ(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    SYS_QUEUE_UNLOCK(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_free_thread(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    freeThreadBlock(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadGetPriority(sys_thread_t * tid, int *pri)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    return pthread_getschedparam(tid->sys_thread, &policy, &param);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    return thr_getprio(tid->sys_thread, pri);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadSetPriority(sys_thread_t * tid, int pri)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = pthread_setschedparam(tid->sys_thread, SCHED_OTHER, &param);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    err = thr_setprio(tid->sys_thread, pri);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadSuspend(sys_thread_t * tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (tid == self) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        mutexLock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        switch(tid->state) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:                tid->state = SUSPENDED;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:                tid->state = SUSPENDED;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:                tid->cpending_suspend = 1;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        mutexUnlock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        err2 = np_suspend(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadResume(sys_thread_t * tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    mutexLock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (tid->cpending_suspend) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        tid->cpending_suspend = 0;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        tid->state = CONDVAR_WAIT;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        switch(tid->state) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:                tid->state = RUNNABLE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    mutexUnlock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        err2 = np_continue(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t * tid=NULL;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    int err = thr_getspecific(tid_key, (void *) &tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        return tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid = ThreadQueue;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    for (i = 0; i < ActiveThreadCount && tid != 0; i++) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        if ((err = (*func)(tid, arg)) != SYS_OK) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        tid = tid->next;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadNativeID(sys_thread_t *tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    return (void *) tid->sys_thread;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid = ThreadQueue;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    while (tid) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        if (tid == t) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:                prev->next = tid->next;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:                ThreadQueue = tid->next;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:            tid->next = 0;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        prev = tid;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        tid = tid->next;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadPostException(sys_thread_t *tid, void *exc)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    /* thr_kill(tid->sys_thread, SIGUSR1); */
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadInterrupt(sys_thread_t *tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->pending_interrupt = TRUE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    pthread_cancel(tid->sys_thread);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    mutexLock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    tid->interrupted = TRUE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    mutexUnlock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    thr_kill(tid->sys_thread, SIGUSR1);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadIsInterrupted(sys_thread_t *tid, int ClearInterrupted)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    mutexLock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    interrupted = tid->pending_interrupt || tid->interrupted;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (ClearInterrupted == 1 && tid->pending_interrupt) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        if (self == tid && pthread_getspecific(intrJmpbufkey) == NULL) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:      tid->interrupted = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    interrupted = tid->interrupted;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        tid->interrupted = FALSE;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:        mutexUnlock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:       mutexUnlock(&tid->mutex);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    sys_thread_t *tid = sysThreadSelf();
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    if (tid->interrupted) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:sysThreadGetStatus(sys_thread_t *tid, sys_mon_t **monitorPtr)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    switch (tid->state) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:          if (tid->mon_enter) {
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:          if (tid->mon_enter)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:          else if (tid->cpending_suspend)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:            *monitorPtr = tid->mon_enter;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:            *monitorPtr = tid->mon_wait;
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:void sysThreadProfSuspend(sys_thread_t *tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_profiler_suspend(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:void sysThreadProfResume(sys_thread_t *tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    np_profiler_continue(tid);
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:bool_t sysThreadIsRunning(sys_thread_t *tid)
+jdk/src/solaris/hpi/native_threads/src/threads_md.c:    return np_profiler_thread_is_running(tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern int      np_suspend(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern int      np_continue(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern void     np_initialize_thread(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern int      np_initial_suspend(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern void   np_free_thread(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern void     np_profiler_init(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern int      np_profiler_suspend(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern int      np_profiler_continue(sys_thread_t *tid);
+jdk/src/solaris/hpi/native_threads/include/np.h:extern bool_t   np_profiler_thread_is_running(sys_thread_t *tid);
+jdk/src/share/sample/scripting/scriptpad/src/resources/conc.js: * @param tid timeout ID returned from setTimeout
+jdk/src/share/sample/scripting/scriptpad/src/resources/conc.js:function clearTimeout(tid) {
+jdk/src/share/sample/scripting/scriptpad/src/resources/conc.js:    tid.interrupt();
+jdk/src/share/native/sun/management/ThreadImpl.c:  (JNIEnv *env, jclass cls, jlong tid)
+jdk/src/share/native/sun/management/ThreadImpl.c:    return jmm_interface->GetThreadCpuTimeWithKind(env, tid, JNI_TRUE /* user+sys */);
+jdk/src/share/native/sun/management/ThreadImpl.c:  (JNIEnv *env, jclass cls, jlong tid)
+jdk/src/share/native/sun/management/ThreadImpl.c:    return jmm_interface->GetThreadCpuTimeWithKind(env, tid, JNI_FALSE /* user */);
+jdk/src/share/native/sun/management/ThreadImpl.c:  (JNIEnv *env, jobject dummy, jlong tid)
+jdk/src/share/native/sun/management/ThreadImpl.c:    value.j = tid;
+jdk/src/share/native/sun/awt/debug/debug_trace.c:static p_dtrace_info DTrace_GetInfo(dtrace_id tid) {
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    DASSERT(tid < MAX_TRACES);
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    return &DTraceInfo[tid];
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    dtrace_id           tid = NumTraces++;
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    p_dtrace_info       info = &DTraceInfo[tid];
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    return tid;
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    dtrace_id           tid;
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    for ( tid = 0; tid < NumTraces; tid++ ) {
+jdk/src/share/native/sun/awt/debug/debug_trace.c:        info = DTrace_GetInfo(tid);
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    tid = DTrace_CreateTraceId(file, line, scope);
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    return tid;
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    dtrace_id tid;
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    tid = DTrace_GetTraceId(file, -1, DTRACE_FILE);
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    info = DTrace_GetInfo(tid);
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    dtrace_id tid;
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    tid = DTrace_GetTraceId(file, line, DTRACE_LINE);
+jdk/src/share/native/sun/awt/debug/debug_trace.c:    info = DTrace_GetInfo(tid);
+jdk/src/share/native/java/util/zip/zlib-1.1.3/ChangeLog:   contrib/untgz/  by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
+jdk/src/share/classes/sun/management/ThreadImpl.java:    // tid == 0 to reset contention times for all threads
+jdk/src/share/classes/sun/management/ThreadImpl.java:    private static native void resetContentionTimes0(long tid);
+jdk/src/share/classes/sun/security/pkcs11/P11KeyStore.java:                sb.append("\tid=[null]\n");
+jdk/src/share/classes/sun/security/pkcs11/P11KeyStore.java:                sb.append("\tid=" + P11KeyStore.getID(id) + "\n");
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String CAT[] = new String[] {"Centralafrikansk tid", "CAT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String CET[] = new String[] {"Centraleuropeisk tid", "CET",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String CIT[] = new String[] {"Centralindonesisk tid", "CIT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String EAT[] = new String[] {"\u00d6stafrikansk tid", "EAT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String EET[] = new String[] {"\u00d6steuropeisk tid", "EET",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String EGT[] = new String[] {"\u00d6stgr\u00f6nl\u00e4ndsk tid", "EGT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String ICT[] = new String[] {"Indokinesisk tid", "ICT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String WAT[] = new String[] {"V\u00e4stafrikansk tid", "WAT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String WET[] = new String[] {"V\u00e4steuropeisk tid", "WET",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String WIT[] = new String[] {"V\u00e4stindonesisk tid", "WIT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String WST_SAMOA[] = new String[] {"V\u00e4stsamoansk tid", "WST",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:        String UTC[] = new String[] {"Koordinerad universell tid", "UTC",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:                                     "Koordinerad universell tid", "UTC"};
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:            {"Asia/Jayapura", new String[] {"\u00d6stindonesisk tid", "EIT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:            {"Europe/Volgograd", new String[] {"Volgograd-tid", "VOLT",
+jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java:            {"MET", new String[] {"Mellaneuropeisk tid", "MET",
+jdk/src/share/classes/java/lang/Thread.java:    private long tid;
+jdk/src/share/classes/java/lang/Thread.java:        tid = nextThreadID();
+jdk/src/share/classes/java/lang/Thread.java:        return tid;
+jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java:            final long tid = Thread.currentThread().getId();
+jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java:                if (rh == null || rh.tid != current.getId())
+jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java:                    if (rh == null || rh.tid != current.getId())
+jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java:                            if (rh == null || rh.tid != current.getId()) {
+jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java:                        if (rh == null || rh.tid != current.getId())
+jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java:                        if (rh == null || rh.tid != current.getId())
+jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java:            if (rh != null && rh.tid == current.getId())
+jdk/src/share/classes/java/util/logging/LogRecord.java:        long tid = Thread.currentThread().getId();
+jdk/src/share/classes/java/util/logging/LogRecord.java:        if (tid < MIN_SEQUENTIAL_THREAD_ID) {
+jdk/src/share/classes/java/util/logging/LogRecord.java:            return (int) tid;
+jdk/src/share/hpi/src/hpi.c:void freeThreadBlock(sys_thread_t *tid)
+jdk/src/share/hpi/src/hpi.c:    sysFree((char *)tid - nReservedBytes);
+jdk/src/share/hpi/include/hpi_impl.h:void freeThreadBlock(sys_thread_t *tid);
+jdk/src/share/hpi/include/hpi_impl.h:int threadBootstrapMD(sys_thread_t **tid, sys_mon_t **lockP, int nb);
+jdk/src/share/hpi/export/hpi.h:  int            (*ThreadSuspend)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  int            (*ThreadResume)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  int            (*ThreadSetPriority)(sys_thread_t *tid, int prio);
+jdk/src/share/hpi/export/hpi.h:  int            (*ThreadGetPriority)(sys_thread_t *tid, int *prio);
+jdk/src/share/hpi/export/hpi.h:  void *         (*ThreadStackPointer)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  void *         (*ThreadStackTop)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  long *         (*ThreadRegs)(sys_thread_t *tid, int *regs);
+jdk/src/share/hpi/export/hpi.h:  void           (*ThreadPostException)(sys_thread_t *tid, void *arg);
+jdk/src/share/hpi/export/hpi.h:  void           (*ThreadInterrupt)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  int            (*ThreadIsInterrupted)(sys_thread_t *tid, int clear);
+jdk/src/share/hpi/export/hpi.h:  int            (*ThreadGetStatus)(sys_thread_t *tid, sys_mon_t **monitor);
+jdk/src/share/hpi/export/hpi.h:  void *         (*ThreadNativeID)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  bool_t         (*ThreadIsRunning)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  void           (*ThreadProfSuspend)(sys_thread_t *tid);
+jdk/src/share/hpi/export/hpi.h:  void           (*ThreadProfResume)(sys_thread_t *tid);
+jdk/src/share/demo/scripting/jconsole-plugin/src/resources/jconsole.js: * @param tid timeout ID returned from setTimeout
+jdk/src/share/demo/scripting/jconsole-plugin/src/resources/jconsole.js:function clearTimeout(tid) {
+jdk/src/share/demo/scripting/jconsole-plugin/src/resources/jconsole.js:    tid.interrupt();
+jdk/src/share/back/error_messages.c:    THREAD_T tid = GET_THREAD_ID();
+jdk/src/share/back/error_messages.c:                    (int)(intptr_t)pid, (int)(intptr_t)tid, (int)(intptr_t)tid);
+jdk/src/share/back/log_messages.c:        THREAD_T tid;
+jdk/src/share/back/log_messages.c:            tid = GET_THREAD_ID();
+jdk/src/share/back/log_messages.c:                        (int)tid);
+jdk/make/sun/javazic/tzdata/europe:# http://www.hum.aau.dk/~poe/tid/tine/DanskTid.htm says that the law
+hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp:static int threadgetstate(thread_t tid, int *flags, lwpid_t *lwp, stack_t *ss, gregset_t rs, lwpstatus_t *lwpstatus) {
+hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp:  if (err = os::Solaris::thr_getstate(tid, flags, lwp, ss, rs))
+hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp:static int threadgetstate(thread_t tid, int *flags, lwpid_t *lwp, stack_t *ss, gregset_t rs, lwpstatus_t *lwpstatus) {
+hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp:  if (err = os::Solaris::thr_getstate(tid, flags, lwp, ss, rs))
+hotspot/src/os/solaris/vm/jsig.c:static thread_t tid = 0;
+hotspot/src/os/solaris/vm/jsig.c:    if (tid != thr_self()) {
+hotspot/src/os/solaris/vm/jsig.c:  tid = thr_self();
+hotspot/src/os/solaris/vm/os_solaris.cpp:  thread_t tid = 0;
+hotspot/src/os/solaris/vm/os_solaris.cpp:  status = thr_create(NULL, stack_size, java_start, thread, flags, &tid);
+hotspot/src/os/solaris/vm/os_solaris.cpp:  osthread->set_thread_id(tid);
+hotspot/src/os/solaris/vm/os_solaris.cpp:     thr_setprio(tid, (DefaultThreadPriority == -1) ?
+hotspot/src/os/solaris/vm/os_solaris.hpp:  static int thr_getstate(thread_t tid, int *flag, unsigned *lwp, stack_t *ss, gregset_t rs)
+hotspot/src/os/solaris/vm/os_solaris.hpp:    { return _thr_getstate(tid, flag, lwp, ss, rs); }
+hotspot/src/os/solaris/vm/os_solaris.hpp:  static int thr_setstate(thread_t tid, int flag, gregset_t rs)   { return _thr_setstate(tid, flag, rs); }
+hotspot/src/os/solaris/vm/os_solaris.hpp:  static int thr_setmutator(thread_t tid, int enabled)    { return _thr_setmutator(tid, enabled); }
+hotspot/src/os/solaris/vm/os_solaris.hpp:  static int  thr_suspend_mutator(thread_t tid)              { return _thr_suspend_mutator(tid); }
+hotspot/src/os/solaris/vm/os_solaris.hpp:  static int  thr_continue_mutator(thread_t tid)              { return _thr_continue_mutator(tid); }
+hotspot/src/os/linux/vm/jsig.c:static pthread_t tid = 0;
+hotspot/src/os/linux/vm/jsig.c:    if (tid != pthread_self()) {
+hotspot/src/os/linux/vm/jsig.c:  tid = pthread_self();
+hotspot/src/os/linux/vm/os_linux.hpp:  static int pthread_getcpuclockid(pthread_t tid, clockid_t *clock_id) {
+hotspot/src/os/linux/vm/os_linux.hpp:    return _pthread_getcpuclockid ? _pthread_getcpuclockid(tid, clock_id) : -1;
+hotspot/src/os/linux/vm/os_linux.cpp:    pthread_t tid;
+hotspot/src/os/linux/vm/os_linux.cpp:    int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
+hotspot/src/os/linux/vm/os_linux.cpp:    osthread->set_pthread_id(tid);
+hotspot/src/os/linux/vm/os_linux.cpp:  pthread_t tid = thread->osthread()->pthread_id();
+hotspot/src/os/linux/vm/os_linux.cpp:  int rc = os::Linux::pthread_getcpuclockid(tid, &clockid);
+hotspot/src/os/linux/vm/os_linux.cpp:  pid_t  tid = thread->osthread()->thread_id();
+hotspot/src/os/linux/vm/os_linux.cpp:    sprintf(proc_name, "/proc/%d/cpu", tid);
+hotspot/src/os/linux/vm/os_linux.cpp:  // The /proc/<tid>/stat aggregates per-process usage on
+hotspot/src/os/linux/vm/os_linux.cpp:  // The /proc/self/task/<tid>/stat still has the per-thread usage.
+hotspot/src/os/linux/vm/os_linux.cpp:  sprintf(proc_name, proc_stat_path, tid);
+hotspot/src/os/linux/vm/osThread_linux.hpp:  void set_pthread_id(pthread_t tid) {
+hotspot/src/os/linux/vm/osThread_linux.hpp:    _pthread_id = tid;
+hotspot/src/share/vm/classfile/javaClasses.cpp:  // The tid and thread_status fields are only present starting in 1.5, so don't go fatal.
+hotspot/src/share/vm/classfile/vmSymbols.hpp:  template(thread_id_name,                            "tid")                                      \
+hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp:  fill_to(temp_pos , filler); output()->print("tid"  );
+hotspot/src/share/vm/prims/hpi_imported.h:  int            (*ThreadSuspend)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  int            (*ThreadResume)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  int            (*ThreadSetPriority)(sys_thread_t *tid, int prio);
+hotspot/src/share/vm/prims/hpi_imported.h:  int            (*ThreadGetPriority)(sys_thread_t *tid, int *prio);
+hotspot/src/share/vm/prims/hpi_imported.h:  void *         (*ThreadStackPointer)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  void *         (*ThreadStackTop)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  long *         (*ThreadRegs)(sys_thread_t *tid, int *regs);
+hotspot/src/share/vm/prims/hpi_imported.h:  void           (*ThreadPostException)(sys_thread_t *tid, void *arg);
+hotspot/src/share/vm/prims/hpi_imported.h:  void           (*ThreadInterrupt)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  int            (*ThreadIsInterrupted)(sys_thread_t *tid, int clear);
+hotspot/src/share/vm/prims/hpi_imported.h:  int            (*ThreadGetStatus)(sys_thread_t *tid, sys_mon_t **monitor);
+hotspot/src/share/vm/prims/hpi_imported.h:  void *         (*ThreadNativeID)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  bool_t         (*ThreadIsRunning)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  void           (*ThreadProfSuspend)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/hpi_imported.h:  void           (*ThreadProfResume)(sys_thread_t *tid);
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:    (jvmtiHeapReferenceKind ref_kind, jlong thread_tag, jlong tid, int depth,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:  static inline bool report_jni_local_root(jlong thread_tag, jlong tid, jint depth,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:  static inline bool report_stack_ref_root(jlong thread_tag, jlong tid, jint depth,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:                                                                jlong tid,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:  reference_info.stack_local.thread_id = tid;
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:inline bool CallbackInvoker::report_jni_local_root(jlong thread_tag, jlong tid, jint depth, jmethodID m, oop obj) {
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:                                              thread_tag, tid,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:                                                   jlong tid,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:                                              tid,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:  void set_context(jlong thread_tag, jlong tid, jint depth, jmethodID method) {
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:    _tid = tid;
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:  jlong tid = java_lang_Thread::thread_id(threadObj);
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:              if (!CallbackInvoker::report_stack_ref_root(thread_tag, tid, depth, method,
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:          blk->set_context(thread_tag, tid, depth, method);
+hotspot/src/share/vm/prims/jvmtiTagMap.cpp:    blk->set_context(thread_tag, tid, 0, (jmethodID)NULL);
+hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp:inline void HRInto_G1RemSet::par_write_ref(HeapRegion* from, oop* p, int tid) {
+hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp:      _new_refs[tid]->push(p);
+hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp:      to->rem_set()->add_reference(p, tid);
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp:  void add_reference(oop* from, int tid);
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp:  void add_reference(oop* from, int tid) {
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp:    _other_regions.add_reference(from, tid);
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:  void add_reference(oop* from, int tid) {
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:    if (par_tables() == NULL && tid > 0 && hr()->is_gc_alloc_region()) {
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:      // with tid != 0 that finds the table to be NULL, but doesn't succeed
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:      if (tid == 0) {
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:        pt[tid-1]->seq_add_reference(from);
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:void OtherRegionsTable::add_reference(oop* from, int tid) {
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:                _from_card_cache[tid][cur_hrs_ind]);
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:  if (from_card == _from_card_cache[tid][cur_hrs_ind]) {
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:    _from_card_cache[tid][cur_hrs_ind] = from_card;
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:        gclog_or_tty->print_cr("   [tid %d] sparse table entry "
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:                      tid, from_hrs_ind, cur_hrs_ind);
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:  prt->add_reference(from, tid);
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:  for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) {
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:    int fcc_ent = _from_card_cache[tid][hr_ind];
+hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp:        _from_card_cache[tid][hr_ind] = -1;
+hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp:  virtual void par_write_ref(HeapRegion* from, oop* p, int tid) = 0;
+hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp:  void par_write_ref(HeapRegion* from, oop* p, int tid) {}
+hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp:  inline void par_write_ref(HeapRegion* from, oop* p, int tid);
+hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp:  void immediate_rs_update(HeapRegion* from, oop* p, int tid) {
+hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp:      _g1_rem->par_write_ref(from, p, tid);
+hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp:  void deferred_rs_update(HeapRegion* from, oop* p, int tid) {
+hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp:  void update_rs(HeapRegion* from, oop* p, int tid) {
+hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp:      deferred_rs_update(from, p, tid);
+hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp:      immediate_rs_update(from, p, tid);
+hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp:  Thread* tid = Thread::current();
+hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp:    os::sleep(tid, sleep_time_millis, false);
+hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp:  Thread* tid = Thread::current();
+hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp:    os::sleep(tid, sleep_time_millis, false);
+hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp:  assert(thr != NULL, "Unexpected tid");
+hotspot/src/share/vm/services/management.cpp.orig:    jlong tid = ids_ah->long_at(i);
+hotspot/src/share/vm/services/management.cpp.orig:    if (tid <= 0) {
+hotspot/src/share/vm/services/management.cpp.orig:      jlong tid = ids_ah->long_at(i);
+hotspot/src/share/vm/services/management.cpp.orig:      JavaThread* jt = find_java_thread_from_id(tid);
+hotspot/src/share/vm/services/management.cpp.orig:        jlong tid = ids_ah->long_at(i);
+hotspot/src/share/vm/services/management.cpp.orig:        JavaThread* jt = find_java_thread_from_id(tid);
+hotspot/src/share/vm/services/management.cpp.orig:      jlong tid = obj.j;
+hotspot/src/share/vm/services/management.cpp.orig:      if (tid < 0) {
+hotspot/src/share/vm/services/management.cpp.orig:      // Look for the JavaThread of this given tid
+hotspot/src/share/vm/services/management.cpp.orig:      if (tid == 0) {
+hotspot/src/share/vm/services/management.cpp.orig:        // reset contention statistics for all threads if tid == 0
+hotspot/src/share/vm/services/management.cpp.orig:        JavaThread* java_thread = find_java_thread_from_id(tid);
+hotspot/src/share/vm/services/management.cpp:    jlong tid = ids_ah->long_at(i);
+hotspot/src/share/vm/services/management.cpp:    if (tid <= 0) {
+hotspot/src/share/vm/services/management.cpp:      jlong tid = ids_ah->long_at(i);
+hotspot/src/share/vm/services/management.cpp:      JavaThread* jt = find_java_thread_from_id(tid);
+hotspot/src/share/vm/services/management.cpp:        jlong tid = ids_ah->long_at(i);
+hotspot/src/share/vm/services/management.cpp:        JavaThread* jt = find_java_thread_from_id(tid);
+hotspot/src/share/vm/services/management.cpp:      jlong tid = obj.j;
+hotspot/src/share/vm/services/management.cpp:      if (tid < 0) {
+hotspot/src/share/vm/services/management.cpp:      // Look for the JavaThread of this given tid
+hotspot/src/share/vm/services/management.cpp:      if (tid == 0) {
+hotspot/src/share/vm/services/management.cpp:        // reset contention statistics for all threads if tid == 0
+hotspot/src/share/vm/services/management.cpp:        JavaThread* java_thread = find_java_thread_from_id(tid);
+hotspot/src/share/vm/runtime/thread.cpp:    st->print("prio=%d tid=" INTPTR_FORMAT " ", get_priority(this), this);
+hotspot/src/share/vm/utilities/vmError.cpp:                 "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT,
+hotspot/src/share/vm/utilities/vmError.cpp:        "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT " \nError: %s",
+hotspot/src/share/vm/utilities/vmError.cpp:        "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT,
+hotspot/src/share/vm/utilities/vmError.cpp:     st->print(", tid=" UINTX_FORMAT, os::current_thread_id());
+hotspot/agent/src/os/solaris/dbx/README-commands.txt:thr_gregs <int tid>                  ::= <int numAddresses> <address...>
+hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.cpp:  // Map tid to thread handle
+hotspot/agent/src/os/solaris/proc/saproc.cpp:  (JNIEnv *env, jobject this_obj, jlong tid) {
+hotspot/agent/src/os/solaris/proc/saproc.cpp:  if (p_td_ta_map_id2thr(p_td_thragent_t, (thread_t) tid, &thr_handle) != TD_OK) {
+hotspot/agent/src/os/win32/SwDbgSub.cpp:  DWORD tid;
+hotspot/agent/src/os/win32/SwDbgSub.cpp:  ThreadInfo(DWORD tid, HANDLE thread) {
+hotspot/agent/src/os/win32/SwDbgSub.cpp:    this->tid = tid;
+hotspot/agent/src/os/win32/SwDbgSub.cpp:  bool removeByThreadID(DWORD tid) {
+hotspot/agent/src/os/win32/SwDbgSub.cpp:      if ((*iter).tid == tid) {
+hotspot/agent/src/os/win32/SwDbgSub.cpp:  HANDLE threadIDToHandle(DWORD tid) {
+hotspot/agent/src/os/win32/SwDbgSub.cpp:      if ((*iter).tid == tid) {
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebuggerLocal.java:  public synchronized long[] getThreadIntegerRegisterSet(int tid) {
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebuggerLocal.java:      printlnToOutput("thr_gregs " + tid);
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebugger.java:  public long[]       getThreadIntegerRegisterSet(int tid) throws DebuggerException;
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java:    public synchronized long[] getThreadIntegerRegisterSet(int tid) {
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java:        return getThreadIntegerRegisterSet0(tid);
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java:    private native long[] getThreadIntegerRegisterSet0(long tid) throws DebuggerException;
+hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebugger.java:  public long[]       getThreadIntegerRegisterSet(int tid) throws DebuggerException;
diff --git openjdk-orig/jdk/make/Makefile openjdk/jdk/make/Makefile
index 323bfcb..5ea9453 100644
--- openjdk-orig/jdk/make/Makefile
+++ openjdk/jdk/make/Makefile
@@ -346,6 +346,12 @@ include $(BUILDDIR)/common/internal/BinaryPlugs.gmk
 #
 include $(BUILDDIR)/common/Rules-SCCS.gmk
 
+# LSB rules
+ifdef OPENJDK_LSB_VERSION
+# Add lsb helper's build right after tools build, which is required for it
+SUBDIRS := $(subst tools,tools lsb,$(SUBDIRS))
+endif
+
 # JPRT rules
 include jprt.gmk
 
diff --git openjdk-orig/jdk/make/common/Defs-linux.gmk openjdk/jdk/make/common/Defs-linux.gmk
index 34f89d6..1339e13 100644
--- openjdk-orig/jdk/make/common/Defs-linux.gmk
+++ openjdk/jdk/make/common/Defs-linux.gmk
@@ -362,3 +362,6 @@ else
   INCLUDE_SA = true
 endif
 
+# LSB piece of stuff
+include $(BUILDDIR)/lsb/Defs-lsb.gmk
+
diff --git openjdk-orig/jdk/make/common/Defs.gmk openjdk/jdk/make/common/Defs.gmk
index c56440d..a6f3f74 100644
--- openjdk-orig/jdk/make/common/Defs.gmk
+++ openjdk/jdk/make/common/Defs.gmk
@@ -247,6 +247,12 @@ DEVTOOLS_FT_DIR_EXISTS = $(shell \
       FREETYPE_HEADERS_PATH = /usr/include
     endif
   endif
+
+  # For openjdk we have other plans on freetype
+  # Some stuff needs to be inlined
+  ifdef OPENJDK_LSB_VERSION
+    FREETYPE_LIB += -llsb_helper_openjdk7
+  endif
 endif
 
 #
diff --git openjdk-orig/jdk/make/common/shared/Compiler-gcc.gmk openjdk/jdk/make/common/shared/Compiler-gcc.gmk
index 9b3b668..4c20c5e 100644
--- openjdk-orig/jdk/make/common/shared/Compiler-gcc.gmk
+++ openjdk/jdk/make/common/shared/Compiler-gcc.gmk
@@ -157,3 +157,11 @@ endif
 _CC_VER :=$(shell $(CC) -dumpversion 2>&1 )
 CC_VER  :=$(call GetVersion,"$(_CC_VER)")
 
+ifdef OPENJDK_LSB_VERSION
+    CC = /opt/lsb/bin/lsbcc $(LSB_INCLUDE_AUX)
+    CPP = /opt/lsb/bin/lsbcc -E $(LSB_INCLUDE_AUX)
+    STATIC_CXX = false
+    CXX = /opt/lsb/bin/lsbc++ $(LSB_INCLUDE_AUX)
+    COMPILER_NAME = LSBCC_$(OPENJDK_LSB_VERSION)
+endif
+
diff --git openjdk-orig/jdk/make/common/shared/Sanity.gmk openjdk/jdk/make/common/shared/Sanity.gmk
index 3bf91dc..e049615 100644
--- openjdk-orig/jdk/make/common/shared/Sanity.gmk
+++ openjdk/jdk/make/common/shared/Sanity.gmk
@@ -788,6 +788,7 @@ sane-motif:
 
 ifdef OPENJDK
 
+ifndef OPENJDK_LSB_VERSION
 #name of test program that prints out "Failed" if freetype is not good enough
 FREETYPE_VERSION_CHECK_NAME = freetype_versioncheck
 FREETYPE_VERSION_CHECK = $(TEMPDIR)/$(FREETYPE_VERSION_CHECK_NAME)$(EXE_SUFFIX)
@@ -805,6 +806,8 @@ sane-freetype:
 	          "or higher is required. \n" >> $(ERROR_FILE) ; \
 	fi
 
+endif
+
 else
 #do nothing  (not OpenJDK)
 sane-freetype: 
diff --git openjdk-orig/jdk/make/java/management/Makefile openjdk/jdk/make/java/management/Makefile
index 8e905a1..22612b8 100644
--- openjdk-orig/jdk/make/java/management/Makefile
+++ openjdk/jdk/make/java/management/Makefile
@@ -107,3 +107,8 @@ clean clobber::
 	$(RM) -r $(CLASSDESTDIR)/sun/management
 	$(RM) $(TEMPDIR)/manifest $(AGENTJAR)
 
+# This library uses(used) non-lsb interfaces
+ifdef OPENJDK_LSB_VERSION
+OTHER_LDLIBS += -llsb_helper_openjdk7
+endif
+
diff --git openjdk-orig/jdk/make/java/nio/Makefile openjdk/jdk/make/java/nio/Makefile
index 93a7593..32f9517 100644
--- openjdk-orig/jdk/make/java/nio/Makefile
+++ openjdk/jdk/make/java/nio/Makefile
@@ -140,6 +140,9 @@ endif
 ifeq ($(PLATFORM), linux)
 COMPILER_WARNINGS_FATAL=true
 OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -lpthread -ldl
+ifdef OPENJDK_LSB_VERSION
+OTHER_LDLIBS += -llsb_helper_openjdk7
+endif
 endif
 ifeq ($(PLATFORM), solaris)
 OTHER_LDLIBS += $(JVMLIB) $(LIBSOCKET) -lposix4 -ldl \
diff --git openjdk-orig/jdk/make/javax/sound/jsoundalsa/Makefile openjdk/jdk/make/javax/sound/jsoundalsa/Makefile
index e4e83a3..2f86c61 100644
--- openjdk-orig/jdk/make/javax/sound/jsoundalsa/Makefile
+++ openjdk/jdk/make/javax/sound/jsoundalsa/Makefile
@@ -87,5 +87,9 @@ vpath %.cpp $(PLATFORM_SRC)/native/com/sun/media/sound
 #
 include $(BUILDDIR)/common/Library.gmk
 
+ifdef OPENJDK_LSB_VERSION
+OTHER_LDLIBS += -llsb_helper_openjdk7
+endif
+
 
 
diff --git openjdk-orig/jdk/make/lsb/Defs-lsb.gmk openjdk/jdk/make/lsb/Defs-lsb.gmk
new file mode 100644
index 0000000..f2a603c
--- /dev/null
+++ openjdk/jdk/make/lsb/Defs-lsb.gmk
@@ -0,0 +1,20 @@
+# Some definitions for LSB build
+# included in Defs-linux.gmk
+
+ifdef OPENJDK_LSB_VERSION
+# define some dirs
+LSBSRCDIR = $(PLATFORM_SRC)/../linux/lsb
+LSB_INCLUDE_AUX = -isystem $(LSBSRCDIR)/include -I$(LSBSRCDIR)
+LIBLSB = liblsb_helper_jdk7.a
+
+# No static libgcc.  We're stable!
+OTHER_LDFLAGS := $(filter-out -static-libgcc,$(OTHER_LDFLAGS))
+
+# For openjdk we had to inline some interfaces of freetype
+# Appending the proper libs here
+#FREETYPE_LIB += -llsb_helper_openjdk7
+override FREETYPE_HEADERS_PATH = 
+
+endif
+
+
diff --git openjdk-orig/jdk/make/tools/freetypecheck/Makefile openjdk/jdk/make/tools/freetypecheck/Makefile
index 560169e..76eb3b7 100644
--- openjdk-orig/jdk/make/tools/freetypecheck/Makefile
+++ openjdk/jdk/make/tools/freetypecheck/Makefile
@@ -23,7 +23,6 @@
 # have any questions.
 
 # Builds test program for freetype sanity check.
-#
 # Makefile should be called with following input parameters
 #   FT_TEST    - full name of test program
 #   FT_HEADERS - path to freetype headers
@@ -74,3 +73,4 @@ $(FT_TEST_PATH): freetypecheck.c
 ifeq ($(PLATFORM), windows)
 	@$(CP) $(FREETYPE_DLL) `dirname $@`
 endif
+
diff --git openjdk-orig/jdk/make/tools/freetypecheck/freetypecheck.c openjdk/jdk/make/tools/freetypecheck/freetypecheck.c
index 00f460d..eaba426 100644
--- openjdk-orig/jdk/make/tools/freetypecheck/freetypecheck.c
+++ openjdk/jdk/make/tools/freetypecheck/freetypecheck.c
@@ -33,6 +33,7 @@
 #define QUOTEME(x) #x
 
 int main(char** argv, int argc) {
+#ifndef __LSB_VERSION__
    char v[50];
    FT_Int major, minor, patch;
    FT_Library library;
@@ -54,6 +55,7 @@ int main(char** argv, int argc) {
    if (strcmp(v, QUOTEMACRO(REQUIRED_FREETYPE_VERSION)) < 0) {
       printf("Failed: too old library.\n");
    }
+#endif
 
    return 0;
 }
diff --git openjdk-orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h
index 927bae1..31cc6f3 100644
--- openjdk-orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h
+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h
@@ -27,6 +27,9 @@
 #ifndef __MLIB_IMAGEAFFINE_H
 #define __MLIB_IMAGEAFFINE_H
 
+// For NULL definition
+#include <stddef.h>
+
 #include "mlib_image.h"
 #include "mlib_ImageDivTables.h"
 #include "mlib_ImageFilters.h"
diff --git openjdk-orig/jdk/src/share/native/sun/awt/medialib/mlib_image.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h
index 922879a..be6c93b 100644
--- openjdk-orig/jdk/src/share/native/sun/awt/medialib/mlib_image.h
+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h
@@ -27,6 +27,8 @@
 #ifndef MLIB_IMAGE_H
 #define MLIB_IMAGE_H
 
+#include <stddef.h>
+
 #include <mlib_types.h>
 #include <mlib_status.h>
 #include <mlib_sys.h>
diff --git openjdk-orig/jdk/src/share/native/sun/awt/medialib/mlib_sys.c openjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c
index e63cf42..27b68ee 100644
--- openjdk-orig/jdk/src/share/native/sun/awt/medialib/mlib_sys.c
+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c
@@ -87,7 +87,11 @@ void *__mlib_malloc(mlib_u32 size)
    */
   return (void *) malloc(size);
 #else /* _MSC_VER */
-  return (void *) memalign(8, size);
+  void * ptr;
+  if (posix_memalign(&ptr, 8, size) != 0){
+      return NULL;
+  }
+  return ptr;
 #endif /* _MSC_VER */
 }
 
diff --git openjdk-orig/jdk/src/share/native/sun/font/freetypeScaler.c openjdk/jdk/src/share/native/sun/font/freetypeScaler.c
index 4398df2..091dd9e 100644
--- openjdk-orig/jdk/src/share/native/sun/font/freetypeScaler.c
+++ openjdk/jdk/src/share/native/sun/font/freetypeScaler.c
@@ -38,9 +38,13 @@
 #include FT_SIZES_H
 #include FT_OUTLINE_H
 #include FT_SYNTHESIS_H
+#include FT_SYSTEM_H
 
 #include "fontscaler.h"
 
+#include "lsb_wrappers.h"
+#include "lsb_flags.h"
+
 #define  ftFixed1  (FT_Fixed) (1 << 16)
 #define  FloatToFTFixed(f) (FT_Fixed)((f) * (float)(ftFixed1))
 #define  FTFixedToFloat(x) ((x) / (float)(ftFixed1))
diff --git openjdk-orig/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h openjdk/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h
index 3d22a0c..3498dc5 100644
--- openjdk-orig/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h
+++ openjdk/jdk/src/share/native/sun/java2d/opengl/OGLFuncs.h
@@ -32,6 +32,7 @@
 #include "OGLFuncMacros.h"
 #include "OGLFuncs_md.h"
 #include "Trace.h"
+#include <dlfcn.h>
 
 jboolean OGLFuncs_OpenLibrary();
 void     OGLFuncs_CloseLibrary();
diff --git openjdk-orig/jdk/src/solaris/bin/java_md.c openjdk/jdk/src/solaris/bin/java_md.c
index 71c598f..5f7429c 100644
--- openjdk-orig/jdk/src/solaris/bin/java_md.c
+++ openjdk/jdk/src/solaris/bin/java_md.c
@@ -991,7 +991,11 @@ physical_memory(void) {
   const uint64_t pages     = (uint64_t) sysconf(_SC_PHYS_PAGES);
   const uint64_t page_size = (uint64_t) sysconf(_SC_PAGESIZE);
   const uint64_t result    = pages * page_size;
+#ifndef __LSB_VERSION__
 # define UINT64_FORMAT "%" PRIu64
+#else
+# define UINT64_FORMAT "%" "llu"
+#endif
 
   if (_launcher_debug) {
     printf("pages: " UINT64_FORMAT
diff --git openjdk-orig/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c openjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
index ab678d2..913fc5a 100644
--- openjdk-orig/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
+++ openjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
@@ -544,12 +544,12 @@ sysBind(int fd, struct sockaddr *addr, int size)  {
 
 int
 sysAccept(int fd, struct sockaddr *him, int *len) {
-    INTERRUPT_IO(accept(fd, him, (uint *)len))
+    INTERRUPT_IO(accept(fd, him, (socklen_t *)len))
 }
 
 int
 sysGetSockName(int fd, struct sockaddr *him, int *len) {
-    return getsockname(fd, him, (uint *)len);
+    return getsockname(fd, him, (socklen_t *)len);
 }
 
 int
@@ -604,5 +604,5 @@ sysSendTo(int fd, char *buf, int len,
 SSIZE_T
 sysRecvFrom(int fd, char *buf, int nBytes,
             int flags, struct sockaddr *from, int *fromlen) {
-    INTERRUPT_IO(recvfrom(fd, buf, nBytes, flags, from, (uint *)fromlen))
+    INTERRUPT_IO(recvfrom(fd, buf, nBytes, flags, from, (socklen_t *)fromlen))
 }
diff --git openjdk-orig/jdk/src/solaris/hpi/native_threads/src/threads_linux.c openjdk/jdk/src/solaris/hpi/native_threads/src/threads_linux.c
index cf56780..50bcfbd 100644
--- openjdk-orig/jdk/src/solaris/hpi/native_threads/src/threads_linux.c
+++ openjdk/jdk/src/solaris/hpi/native_threads/src/threads_linux.c
@@ -58,7 +58,7 @@ static void prtsigset(char *s, sigset_t *set)
 {
     int sig;
     dprintf(2, "%s:", s);
-    for (sig = 1; sig < _NSIG; sig++) {
+    for (sig = 1; sig < NSIG; sig++) {
         if (sigismember(set, sig)) {
             dprintf(2, " %d", sig);
         }
diff --git openjdk-orig/jdk/src/solaris/hpi/src/memory_md.c openjdk/jdk/src/solaris/hpi/src/memory_md.c
index eeed396..2ab6c41 100644
--- openjdk-orig/jdk/src/solaris/hpi/src/memory_md.c
+++ openjdk/jdk/src/solaris/hpi/src/memory_md.c
@@ -394,7 +394,10 @@ sysDecommitMem(void *requestedAddr, size_t requestedSize,
 void *
 sysAllocBlock(size_t size, void** allocHead)
 {
-    void* alignedPtr = memalign(PAGE_ALIGNMENT, size);
+    void* alignedPtr;
+    if (posix_memalign(&alignedPtr, PAGE_ALIGNMENT, size) != 0){
+        return NULL;
+    }
     *allocHead = alignedPtr;
     return alignedPtr;
 }
diff --git openjdk-orig/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c openjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
index fff365e..2839d0b 100644
--- openjdk-orig/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
+++ openjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
@@ -43,6 +43,8 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
+#include <stdio.h>
 
 static jlong page_size = 0;
 
@@ -267,8 +269,13 @@ Java_com_sun_management_UnixOperatingSystem_getOpenFileDescriptorCount
 
     dirp = opendir("/proc/self/fd");
     if (dirp == NULL) {
-        throw_internal_error(env, "Unable to open directory /proc/self/fd");
-        return -1;
+        // We may be without /proc, so we should have a workaround
+        int i;
+        fds=0;
+        for (i=0; i<sysconf(_SC_OPEN_MAX); i++){
+            if (fcntl(i,F_GETFD)!=-1) fds++;
+        }
+        return fds;
     }
 
     // iterate through directory entries, skipping '.' and '..'
diff --git openjdk-orig/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c openjdk/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c
index be44713..354b012 100644
--- openjdk-orig/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c
+++ openjdk/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c
@@ -33,6 +33,8 @@
 #include "PlatformMidi.h"
 #include "PLATFORM_API_LinuxOS_ALSA_MidiUtils.h"
 
+#include <lsb_flags.h>
+
 /*
  * Helper methods
  */
diff --git openjdk-orig/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.h openjdk/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.h
index 3536cba..0185a5a 100644
--- openjdk-orig/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.h
+++ openjdk/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.h
@@ -24,6 +24,8 @@
  */
 
 #include <alsa/asoundlib.h>
+// For functions not in alsa
+#include <lsb_wrappers.h>
 #include "Utilities.h"
 #include "PlatformMidi.h"
 
diff --git openjdk-orig/jdk/src/solaris/native/java/lang/java_props_md.c openjdk/jdk/src/solaris/native/java/lang/java_props_md.c
index f3e4d60..42e3fec 100644
--- openjdk-orig/jdk/src/solaris/native/java/lang/java_props_md.c
+++ openjdk/jdk/src/solaris/native/java/lang/java_props_md.c
@@ -46,7 +46,9 @@
 #include "java_props.h"
 
 #ifdef __linux__
+#ifndef __LSB_VERSION__
 #define CODESET _NL_CTYPE_CODESET_NAME
+#endif
 #else
 #ifdef ALT_CODESET_KEY
 #define CODESET ALT_CODESET_KEY
diff --git openjdk-orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
index 7578dfa..886963d 100644
--- openjdk-orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
@@ -61,10 +61,10 @@ extern int gethostname(char *buf, int buf_len);
  */
 JNIEXPORT jstring JNICALL
 Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
-    char hostname[MAXHOSTNAMELEN+1];
+    char hostname[NI_MAXHOST+1];
 
     hostname[0] = '\0';
-    if (JVM_GetHostName(hostname, MAXHOSTNAMELEN)) {
+    if (JVM_GetHostName(hostname, NI_MAXHOST)) {
         /* Something went wrong, maybe networking is not setup? */
         strcpy(hostname, "localhost");
     } else {
diff --git openjdk-orig/jdk/src/solaris/native/java/net/Inet6AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
index 910d35b..66aad32 100644
--- openjdk-orig/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
+++ openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <strings.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <ctype.h>
 
 #include "jvm.h"
@@ -40,6 +41,8 @@
 #include <netinet/icmp6.h>
 #endif
 
+#include <lsb_flags.h>
+
 #include "java_net_Inet4AddressImpl.h"
 #include "java_net_Inet6AddressImpl.h"
 
@@ -48,11 +51,6 @@
 #define NI_MAXHOST 1025
 #endif
 
-#ifndef __GLIBC__
-/* gethostname() is in libc.so but I can't find a header file for it */
-extern int gethostname(char *buf, int buf_len);
-#endif
-
 /************************************************************************
  * Inet6AddressImpl
  */
@@ -67,7 +65,7 @@ Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
     char hostname[NI_MAXHOST+1];
 
     hostname[0] = '\0';
-    if (JVM_GetHostName(hostname, MAXHOSTNAMELEN)) {
+    if (JVM_GetHostName(hostname, NI_MAXHOST)) {
         /* Something went wrong, maybe networking is not setup? */
         strcpy(hostname, "localhost");
     } else {
@@ -483,6 +481,10 @@ ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
      * For some strange reason, the linux kernel won't calculate the
      * checksum of ICMPv6 packets unless you set this socket option
      */
+    /** Note from LSB-OpenJDK project: that's violation of RFC3542 that
+     * was fixed in year 2008.  Now the setsockopt below will just
+     * return -1 and have no effect
+     */
     csum_offset = 2;
     setsockopt(fd, SOL_RAW, IPV6_CHECKSUM, &csum_offset, sizeof(int));
     }
diff --git openjdk-orig/jdk/src/solaris/native/java/net/NetworkInterface.c openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
index f60e03f..222ef91 100644
--- openjdk-orig/jdk/src/solaris/native/java/net/NetworkInterface.c
+++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
@@ -40,7 +40,6 @@
 #endif
 #ifdef __linux__
 #include <sys/ioctl.h>
-#include <bits/ioctls.h>
 #include <linux/sockios.h>
 #include <sys/utsname.h>
 #include <stdio.h>
@@ -53,6 +52,8 @@
 #define _PATH_PROCNET_IFINET6           "/proc/net/if_inet6"
 #endif
 
+#include <lsb_flags.h>
+
 #include "jvm.h"
 #include "jni_util.h"
 #include "net_util.h"
diff --git openjdk-orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
index c4032c8..07e96fb 100644
--- openjdk-orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
@@ -1568,6 +1568,15 @@ Java_java_net_PlainDatagramSocketImpl_socketSetOption(JNIEnv *env,
  *              Query NetworkInterface by index and
  *              return NetworkInterface.
  */
+/* Comment from LSB-openjdk project: getsockoft for IP_MULTICAST_IF returns,
+ * as defined by specifications of 4.0, struct in_addr.  setsockopt with 
+ * ADD/DROP_MEMBERSHIP takes struct mreq as parameter (as in LSB specs).
+ * So, we enwrap its usage into flags.
+ */
+#if (!defined __LSB_VERSION__) && (defined __linux__)
+#define DO_SUPPORT_MREQN
+#endif
+
 jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
     jboolean isIPV4 = JNI_TRUE;
 
@@ -1598,7 +1607,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
         struct in_addr *inP = &in;
         int len = sizeof(struct in_addr);
 
-#ifdef __linux__
+#ifdef DO_SUPPORT_MREQN
         struct ip_mreqn mreqn;
         if (isOldKernel) {
             inP = (struct in_addr *)&mreqn;
@@ -1629,7 +1638,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
         addr = (*env)->NewObject(env, inet4_class, inet4_ctrID, 0);
         CHECK_NULL_RETURN(addr, NULL);
 
-#ifdef __linux__
+#ifdef DO_SUPPORT_MREQN
         (*env)->SetIntField(env, addr, inet4_addrID,
                 (isOldKernel ? ntohl(mreqn.imr_address.s_addr) : ntohl(in.s_addr)) );
 #else
@@ -2130,7 +2139,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
      * On Linux if IPv4 or IPv6 use IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP
      */
     if (!ipv6_join_leave) {
-#ifdef __linux__
+#ifdef DO_SUPPORT_MREQN
         struct ip_mreqn mname;
 #else
         struct ip_mreq mname;
@@ -2148,7 +2157,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
          *              NetworkInterface
          */
         if (niObj != NULL) {
-#if defined(__linux__) && defined(AF_INET6)
+#if DO_SUPPORT_MREQN && defined(AF_INET6)
             if (ipv6_available()) {
                 static jfieldID ni_indexID;
 
@@ -2178,7 +2187,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
                 addr = (*env)->GetObjectArrayElement(env, addrArray, 0);
 
                 mname.imr_multiaddr.s_addr = htonl((*env)->GetIntField(env, iaObj, ia_addressID));
-#ifdef __linux__
+#ifdef DO_SUPPORT_MREQN
                 mname.imr_address.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID));
 #else
                 mname.imr_interface.s_addr = htonl((*env)->GetIntField(env, addr, ia_addressID));
@@ -2204,7 +2213,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
 
         if (niObj == NULL) {
 
-#if defined(__linux__) && defined(AF_INET6)
+#if DO_SUPPORT_MREQN && defined(AF_INET6)
             if (ipv6_available()) {
 
                 int index;
@@ -2231,7 +2240,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
                 struct in_addr *inP = &in;
                 int len = sizeof(struct in_addr);
 
-#ifdef __linux__
+#ifdef DO_SUPPORT_MREQN
                 struct ip_mreqn mreqn;
                 if (isOldKernel) {
                     inP = (struct in_addr *)&mreqn;
@@ -2243,7 +2252,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
                     return;
                 }
 
-#ifdef __linux__
+#ifdef DO_SUPPORT_MREQN
                 mname.imr_address.s_addr =
                     (isOldKernel ? mreqn.imr_address.s_addr : in.s_addr);
 
diff --git openjdk-orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c
index 0ac0acf..c72b9a8 100644
--- openjdk-orig/jdk/src/solaris/native/java/net/linux_close.c
+++ openjdk/jdk/src/solaris/native/java/net/linux_close.c
@@ -35,7 +35,7 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include <sys/poll.h>
+#include <poll.h>
 
 /*
  * Stack allocated by thread when doing blocking operation
@@ -57,7 +57,7 @@ typedef struct {
 /*
  * Signal to unblock thread
  */
-static int sigWakeup = (__SIGRTMAX - 2);
+static int sigWakeup() {return (SIGRTMAX - 2); }
 
 /*
  * The fd table and the number of file descriptors
@@ -99,10 +99,10 @@ static void __attribute((constructor)) init() {
     sa.sa_handler = sig_wakeup;
     sa.sa_flags   = 0;
     sigemptyset(&sa.sa_mask);
-    sigaction(sigWakeup, &sa, NULL);
+    sigaction(sigWakeup(), &sa, NULL);
 
     sigemptyset(&sigset);
-    sigaddset(&sigset, sigWakeup);
+    sigaddset(&sigset, sigWakeup());
     sigprocmask(SIG_UNBLOCK, &sigset, NULL);
 }
 
@@ -198,7 +198,7 @@ static int closefd(int fd1, int fd2) {
         threadEntry_t *curr = fdEntry->threads;
         while (curr != NULL) {
             curr->intr = 1;
-            pthread_kill( curr->thr, sigWakeup );
+            pthread_kill( curr->thr, sigWakeup() );
             curr = curr->next;
         }
 
diff --git openjdk-orig/jdk/src/solaris/native/java/nio/MappedByteBuffer.c openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
index 70c2d07..e6535e0 100644
--- openjdk-orig/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
+++ openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
@@ -32,6 +32,9 @@
 #include <stddef.h>
 #include <stdlib.h>
 
+//for mincore()
+#include <lsb_wrappers.h>
+
 
 JNIEXPORT jboolean JNICALL
 Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj,
@@ -50,6 +53,11 @@ Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj,
         return JNI_FALSE;
     }
 
+    // We can't guarantee that on LSB platform this functionality is supported
+    // Unless it is, we return false -- just like in code for Windows.
+    if (!mincore_available()){
+        return JNI_FALSE;
+    }
     result = mincore(a, (size_t)len, vec);
     if (result != 0) {
         free(vec);
@@ -77,7 +85,7 @@ Java_java_nio_MappedByteBuffer_load0(JNIEnv *env, jobject obj, jlong address,
     int *ptr = (int *)jlong_to_ptr(address);
     int i = 0;
     int j = 0;
-    int result = madvise((caddr_t)ptr, len, MADV_WILLNEED);
+    int result = posix_madvise((caddr_t)ptr, len, POSIX_MADV_WILLNEED);
 
     /* touch every page */
     for (i=0; i<numPages; i++) {
diff --git openjdk-orig/jdk/src/solaris/native/java/util/TimeZone_md.c openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
index a3b9fc7..2d3bfd7 100644
--- openjdk-orig/jdk/src/solaris/native/java/util/TimeZone_md.c
+++ openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
@@ -99,7 +99,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
     struct stat statbuf;
     union {
         struct dirent d;
-        char b[offsetof (struct dirent, d_name) + NAME_MAX + 1];
+        char b[offsetof (struct dirent, d_name) + sizeof( ((struct dirent*)(0))->d_name ) ];
     } entry;
     struct dirent *dp;
     char *pathname = NULL;
diff --git openjdk-orig/jdk/src/solaris/native/sun/awt/awt_xembed_server.c openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
index 6dc5407..620a4a6 100644
--- openjdk-orig/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
@@ -835,6 +835,9 @@ Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers (JNIEnv *env, jobject this,
     AWT_UNLOCK();
 }
 
+// This function isn't used anyway, so we just mask it in order to
+// make appchecker not shout at usage of backtrace and backtrace_symbols.
+#ifndef __LSB_VERSION_
 #ifdef __linux__
 void
 print_stack (void)
@@ -855,6 +858,8 @@ print_stack (void)
   free (strings);
 }
 #endif
+#endif
+
 
 extern int32_t  numEventsHandled;
 
diff --git openjdk-orig/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c openjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
index 7b4a4e7..fe55061 100644
--- openjdk-orig/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
@@ -44,8 +44,8 @@ extern "C" {
 typedef union epoll_data {
     void *ptr;
     int fd;
-    __uint32_t u32;
-    __uint64_t u64;
+    uint32_t u32;
+    uint64_t u64;
 } epoll_data_t;
 
 
@@ -57,7 +57,7 @@ typedef union epoll_data {
 #endif
 
 struct epoll_event {
-    __uint32_t events;  /* Epoll events */
+    uint32_t events;  /* Epoll events */
     epoll_data_t data;  /* User data variable */
 } EPOLL_PACKED;
 
diff --git openjdk-orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
index ffd86d0..0e75ff2 100644
--- openjdk-orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
@@ -38,7 +38,7 @@
 #include <sys/signal.h>
 
 /* Also defined in src/solaris/native/java/net/linux_close.c */
-#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+static int INTERRUPT_SIGNAL() {return (SIGRTMAX - 2);}
 
 static void
 nullHandler(int sig)
@@ -65,7 +65,7 @@ Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
     sa.sa_handler = nullHandler;
     sa.sa_flags = 0;
     sigemptyset(&sa.sa_mask);
-    if (sigaction(INTERRUPT_SIGNAL, &sa, &osa) < 0)
+    if (sigaction(INTERRUPT_SIGNAL(), &sa, &osa) < 0)
         JNU_ThrowIOExceptionWithLastError(env, "sigaction");
 
 #endif
@@ -85,7 +85,7 @@ JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
 {
 #ifdef __linux__
-    if (pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL))
+    if (pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL()))
         JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
 #endif
 }
diff --git openjdk-orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
index f92d263..94d21ef 100644
--- openjdk-orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
+++ openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
@@ -34,6 +34,9 @@
 
 #include "j2secmod.h"
 
+//for RTLD_NOLOAD
+#include <lsb_flags.h>
+
 void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) {
     void *hModule = (void*)jHandle;
     void *fAddress = dlsym(hModule, functionName);
diff --git openjdk-orig/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c openjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
index 49f5819..cdceab7 100644
--- openjdk-orig/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
+++ openjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
@@ -65,7 +65,35 @@ static void forEachProcess(ProcessCallback f, void* user_data) {
      * position integer as a filename.
      */
     if ((dir = opendir("/proc")) == NULL) {
+#ifndef __LSB_VERSION__
         return;
+#else
+        /* Notes from LSB-OpenJDK project
+         * We don't give up!  LSB says that `ps -A` should work.
+         * Yes, ps -A also does the same thing.  This may seem dumb, but I
+         * guess, I have to do it.
+         */
+        char buf[100] = "ps -A";
+        FILE * pipe;
+        /* simply invoke a app, pipe output*/
+        pipe = popen(buf, "r" );
+        if (pipe == NULL ) {
+            fprintf(stderr,"invoking %s failed: %s\n", buf, strerror(errno));
+            return;
+        }
+
+        while(!feof(pipe) ) {
+            if( fgets( buf, 100, pipe ) != NULL ) {
+                int pid;
+                if (sscanf(buf,"%d",&pid) != 1 || pid <= 0) continue;
+                (*f)(pid, user_data);
+            }
+        }
+
+        /* Close pipe */
+        pclose(pipe);
+        return;
+#endif
     }
     while ((ptr = readdir(dir)) != NULL) {
         pid_t pid;
diff --git openjdk-orig/jdk/src/solaris/native/sun/xawt/XToolkit.c openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
index ac3fecc..b165a5f 100644
--- openjdk-orig/jdk/src/solaris/native/sun/xawt/XToolkit.c
+++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
@@ -692,6 +692,7 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11_XToolkit_getEnv
 
 static XErrorHandler saved_error_handler = NULL;
 
+#ifndef __LSB_VERSION__
 #ifdef __linux__
 void print_stack(void)
 {
@@ -711,6 +712,7 @@ void print_stack(void)
   free (strings);
 }
 #endif
+#endif
 
 static int NoisyXErrorHandler(Display * dpy, XErrorEvent * event) {
     fprintf(stderr, "id=%x, serial=%x, ec=%d, rc=%d, mc=%d\n",
diff --git openjdk-orig/jdk/src/solaris/transport/socket/socket_md.c openjdk/jdk/src/solaris/transport/socket/socket_md.c
index f392bd9..3716dcc 100644
--- openjdk-orig/jdk/src/solaris/transport/socket/socket_md.c
+++ openjdk/jdk/src/solaris/transport/socket/socket_md.c
@@ -38,7 +38,7 @@
 #endif
 #ifdef __linux__
 #include <pthread.h>
-#include <sys/poll.h>
+#include <poll.h>
 #endif
 
 #include "socket_md.h"
diff --git a/src/openjdk/jdk/make/lsb/Makefile b/src/openjdk/jdk/make/lsb/Makefile
new file mode 100644
index 0000000..0572b3c
--- /dev/null
+++ openjdk/jdk/make/lsb/Makefile
@@ -0,0 +1,36 @@
+
+# Makefile for LSB helper library
+
+ifdef OPENJDK_LSB_VERSION
+
+BUILDDIR = ..
+PRODUCT = 
+LIBRARY = lsb_helper_openjdk7
+LIBRARY_OUTPUT = lsb_helper_openjdk7
+include $(BUILDDIR)/common/Defs.gmk
+
+
+SRCDIR = $(LSBSRCDIR)
+FILES_c = lsb_helpers.c \
+    lsb_wrappers.c \
+    static/freetype_impl.c
+
+FILES_o = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(FILES_c)))
+
+CPPFLAGS += -I$(FREETYPE_HEADERS_PATH) \
+    -I$(FREETYPE_HEADERS_PATH)/freetype2
+OTHER_LDLIBS += -lfreetype -ldl
+
+#
+# Rules
+#
+#include $(BUILDDIR)/common/Mapfile-vers.gmk
+include $(BUILDDIR)/common/Library.gmk
+
+vpath %.c $(SRCDIR)
+vpath %.c $(SRCDIR)/static
+
+else
+all build clobber clean:: ;
+endif
+
