diff -u -r -N icedtea-orig/jdk/make/common/Defs.gmk openjdk/jdk/make/common/Defs.gmk
--- icedtea-orig/jdk/make/common/Defs.gmk	2009-07-28 14:31:01.000000000 +0400
+++ openjdk/jdk/make/common/Defs.gmk	2009-07-28 17:25:26.000000000 +0400
@@ -235,7 +235,11 @@
   ifeq ($(PLATFORM), windows)
     FREETYPE_LIB = $(FREETYPE_LIB_PATH)/freetype.lib
   else
+    ifndef LSB
     FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) $(FT2_LIB)
+    else
+    FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) -lopenjdk6_lsb_helper -lfreetype
+    endif
   endif
 
   ifdef ALT_FREETYPE_HEADERS_PATH
diff -u -r -N icedtea-orig/jdk/make/common/shared/Compiler-gcc.gmk openjdk/jdk/make/common/shared/Compiler-gcc.gmk
--- icedtea-orig/jdk/make/common/shared/Compiler-gcc.gmk	2009-07-28 14:31:22.000000000 +0400
+++ openjdk/jdk/make/common/shared/Compiler-gcc.gmk	2009-07-28 17:16:35.000000000 +0400
@@ -58,10 +58,18 @@
 ifeq ($(PLATFORM), linux)
 
   # Settings specific to Linux
+  ifndef LSB
   CC             = gcc$(GCC_SUFFIX)
   CPP            = gcc$(GCC_SUFFIX) -E
   # statically link libstdc++ before C++ ABI is stablized on Linux
   STATIC_CXX     = true
+  else
+  CC             = /opt/lsb/bin/lsbcc
+  CPP            = /opt/lsb/bin/lsbcc -E
+  # LSB takes care of ABI stability on linux
+  STATIC_CXX     = false
+  endif
+
   ifeq ($(STATIC_CXX),true)
     # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
     # We need to use gcc to statically link the C++ runtime. gcc and g++ use
diff -u -r -N icedtea-orig/jdk/make/lsb/Makefile openjdk/jdk/make/lsb/Makefile
--- icedtea-orig/jdk/make/lsb/Makefile	1970-01-01 03:00:00.000000000 +0300
+++ openjdk/jdk/make/lsb/Makefile	2009-07-28 17:25:38.000000000 +0400
@@ -0,0 +1,34 @@
+
+ifdef LSB
+
+BUILDDIR = ..
+PRODUCT = 
+LIBRARY = openjdk6_lsb_helper
+LIBRARY_OUTPUT = openjdk6_lsb_helper
+include $(BUILDDIR)/common/Defs.gmk
+
+FILES_c = lsb_freetype.c
+
+FILES_o = $(patsubst %.c,$(OBJDIR)/%.o,$(FILES_c))
+
+SRCDIR=$(PLATFORM_SRC)/../linux/lsb
+CPPFLAGS += -I $(SRCDIR) \
+    -iquote $(SRCDIR) \
+    -I$(FREETYPE_HEADERS_PATH) \
+    -I$(FREETYPE_HEADERS_PATH)/freetype2
+OTHER_LDLIBS += -lfreetype
+
+#
+# Rules
+#
+#include $(BUILDDIR)/common/Mapfile-vers.gmk
+include $(BUILDDIR)/common/Library.gmk
+
+vpath %.c $(SRCDIR)
+
+else
+all build clobber clean:: ;
+endif
+
+vpath %.c $(SRCDIR)
+
diff -u -r -N icedtea-orig/jdk/make/Makefile openjdk/jdk/make/Makefile
--- icedtea-orig/jdk/make/Makefile	2008-11-25 12:01:05.000000000 +0300
+++ openjdk/jdk/make/Makefile	2009-07-28 17:24:07.000000000 +0400
@@ -247,7 +247,11 @@
 
 all build:: sanity-all post-sanity-all
 
+ifndef LSB
 SUBDIRS    = tools java javax org sun sunw com jpda mkdemo mksample launchers
+else
+SUBDIRS    = tools lsb java javax org sun sunw com jpda mkdemo mksample launchers
+endif
 all build::
 	$(SUBDIRS-loop)
 
diff -u -r -N icedtea-orig/jdk/make/sun/font/Makefile openjdk/jdk/make/sun/font/Makefile
--- icedtea-orig/jdk/make/sun/font/Makefile	2009-07-28 14:31:17.000000000 +0400
+++ openjdk/jdk/make/sun/font/Makefile	2009-07-28 17:27:42.000000000 +0400
@@ -169,6 +169,9 @@
 else
   CPPFLAGS += $(FREETYPE_HEADERS) $(FREETYPE_HEADERS)/freetype2 \
 	-I$(FREETYPE_HEADERS_PATH) -I$(FREETYPE_HEADERS_PATH)/freetype2
+  ifdef LSB
+    CPPFLAGS += -I$(PLATFORM_SRC)/../linux/lsb
+  endif
   OTHER_LDLIBS += $(FREETYPE_LIB)
 endif
 
diff -u -r -N icedtea-orig/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c openjdk/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c
--- icedtea-orig/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c	2008-11-25 12:05:51.000000000 +0300
+++ openjdk/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c	2009-07-28 17:17:04.000000000 +0400
@@ -35,6 +35,8 @@
 // for malloc
 #include <malloc.h>
 #include "SoundDefs.h"
+typedef unsigned char           UINT8;
+typedef unsigned short          UINT16;
 #include "DirectAudio.h"
 #include "Utilities.h"
 #include "com_sun_media_sound_DirectAudioDevice.h"
diff -u -r -N icedtea-orig/jdk/src/share/native/com/sun/media/sound/SoundDefs.h openjdk/jdk/src/share/native/com/sun/media/sound/SoundDefs.h
--- icedtea-orig/jdk/src/share/native/com/sun/media/sound/SoundDefs.h	2009-07-28 14:31:13.000000000 +0400
+++ openjdk/jdk/src/share/native/com/sun/media/sound/SoundDefs.h	2009-07-28 16:51:51.000000000 +0400
@@ -77,10 +77,10 @@
 */
 #if (X_PLATFORM != X_WINDOWS)
 
-typedef unsigned char           UINT8;
+//typedef unsigned char           UINT8;
 typedef char                    INT8;
 typedef short                   INT16;
-typedef unsigned short          UINT16;
+//typedef unsigned short          UINT16;
 #ifdef _LP64
 typedef int                     INT32;
 typedef unsigned int            UINT32;
diff -u -r -N icedtea-orig/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
--- icedtea-orig/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	2009-07-28 14:31:07.000000000 +0400
+++ openjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	2009-07-28 17:18:04.000000000 +0400
@@ -58,6 +58,8 @@
 #undef MAX
 #define MAX(a,b)        ((a) > (b) ? (a) : (b))
 
+typedef long                    INT32;
+
 /* Cached Java method ids */
 static jmethodID ImageInputStream_readID;
 static jmethodID ImageInputStream_skipBytesID;
diff -u -r -N icedtea-orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h
--- icedtea-orig/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h	2008-11-25 12:05:58.000000000 +0300
+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h	2009-07-28 16:53:02.000000000 +0400
@@ -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 -u -r -N icedtea-orig/jdk/src/share/native/sun/awt/medialib/mlib_image.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h
--- icedtea-orig/jdk/src/share/native/sun/awt/medialib/mlib_image.h	2008-11-25 12:06:00.000000000 +0300
+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h	2009-07-28 16:53:26.000000000 +0400
@@ -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 -u -r -N icedtea-orig/jdk/src/share/native/sun/awt/medialib/mlib_sys.c openjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c
--- icedtea-orig/jdk/src/share/native/sun/awt/medialib/mlib_sys.c	2008-11-25 12:06:00.000000000 +0300
+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c	2009-07-28 16:53:45.000000000 +0400
@@ -87,7 +87,11 @@
    */
   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 -u -r -N icedtea-orig/jdk/src/solaris/bin/java_md.c openjdk/jdk/src/solaris/bin/java_md.c
--- icedtea-orig/jdk/src/solaris/bin/java_md.c	2009-07-28 14:31:21.000000000 +0400
+++ openjdk/jdk/src/solaris/bin/java_md.c	2009-07-28 17:08:52.000000000 +0400
@@ -991,7 +991,11 @@
   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 -u -r -N icedtea-orig/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c openjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
--- icedtea-orig/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c	2009-07-28 14:31:12.000000000 +0400
+++ openjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c	2009-07-28 16:54:20.000000000 +0400
@@ -544,12 +544,12 @@
 
 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 @@
 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 -u -r -N icedtea-orig/jdk/src/solaris/hpi/native_threads/src/threads_linux.c openjdk/jdk/src/solaris/hpi/native_threads/src/threads_linux.c
--- icedtea-orig/jdk/src/solaris/hpi/native_threads/src/threads_linux.c	2008-11-25 12:06:18.000000000 +0300
+++ openjdk/jdk/src/solaris/hpi/native_threads/src/threads_linux.c	2009-07-28 16:54:20.000000000 +0400
@@ -58,7 +58,7 @@
 {
     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 -u -r -N icedtea-orig/jdk/src/solaris/hpi/src/memory_md.c openjdk/jdk/src/solaris/hpi/src/memory_md.c
--- icedtea-orig/jdk/src/solaris/hpi/src/memory_md.c	2008-11-25 12:06:18.000000000 +0300
+++ openjdk/jdk/src/solaris/hpi/src/memory_md.c	2009-07-28 16:54:46.000000000 +0400
@@ -394,7 +394,10 @@
 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 -u -r -N icedtea-orig/jdk/src/solaris/javavm/include/typedefs_md.h openjdk/jdk/src/solaris/javavm/include/typedefs_md.h
--- icedtea-orig/jdk/src/solaris/javavm/include/typedefs_md.h	2008-11-25 12:06:18.000000000 +0300
+++ openjdk/jdk/src/solaris/javavm/include/typedefs_md.h	2009-07-28 17:09:35.000000000 +0400
@@ -70,6 +70,7 @@
 #endif  /* LONG_IS_64 */
 #endif /* don't HAVE_INTPTR_T */
 
+#ifndef __LSB_VERSION__
 #ifndef _UINT64_T
 #define _UINT64_T
 #ifdef LONG_IS_64
@@ -104,6 +105,7 @@
 #endif
 #endif
 #endif /* __BIT_TYPES_DEFINED__ */
+#endif
 
 #endif   /* !defined(_ILP32) && !defined(_LP64) */
 
diff -u -r -N icedtea-orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
--- icedtea-orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2008-11-25 12:06:19.000000000 +0300
+++ openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	2009-07-28 17:19:57.000000000 +0400
@@ -60,6 +60,7 @@
 
 
 /* -- Large-file support -- */
+#ifndef __LSB_VERSION__
 
 /* LINUX_FIXME: ifdef __solaris__ here is wrong.  We need to move the
  * definition of stat64 into a solaris_largefile.h and create a
@@ -99,6 +100,8 @@
 
 #endif  /* !_LFS_LARGEFILE */
 
+#endif
+
 typedef int (*STAT64)(const char *, struct stat64 *);
 
 #if defined(__linux__) && defined(_LARGEFILE64_SOURCE)
diff -u -r -N icedtea-orig/jdk/src/solaris/native/java/lang/java_props_md.c openjdk/jdk/src/solaris/native/java/lang/java_props_md.c
--- icedtea-orig/jdk/src/solaris/native/java/lang/java_props_md.c	2009-07-28 14:31:13.000000000 +0400
+++ openjdk/jdk/src/solaris/native/java/lang/java_props_md.c	2009-07-28 16:55:03.000000000 +0400
@@ -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 -u -r -N icedtea-orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
--- icedtea-orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	2008-11-25 12:06:19.000000000 +0300
+++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	2009-07-28 16:55:48.000000000 +0400
@@ -61,10 +61,10 @@
  */
 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 -u -r -N icedtea-orig/jdk/src/solaris/native/java/net/Inet6AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
--- icedtea-orig/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	2008-11-25 12:06:19.000000000 +0300
+++ openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	2009-07-28 16:55:48.000000000 +0400
@@ -50,7 +50,8 @@
 
 #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);
+/* shvedsky: I could. ;-) */
+#include <unistd.h>
 #endif
 
 /************************************************************************
@@ -67,7 +68,7 @@
     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 {
@@ -484,7 +485,8 @@
      * checksum of ICMPv6 packets unless you set this socket option
      */
     csum_offset = 2;
-    setsockopt(fd, SOL_RAW, IPV6_CHECKSUM, &csum_offset, sizeof(int));
+    setsockopt(fd, SOL_RAW, 7/*IPV6_CHECKSUM*/, &csum_offset, sizeof(int));
+    /* setting this option is incorrect anyway, so I don't really care */
     }
 #endif
 
diff -u -r -N icedtea-orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c
--- icedtea-orig/jdk/src/solaris/native/java/net/linux_close.c	2008-11-25 12:06:19.000000000 +0300
+++ openjdk/jdk/src/solaris/native/java/net/linux_close.c	2009-07-28 16:56:15.000000000 +0400
@@ -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 @@
 /*
  * 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 @@
     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 @@
         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 -u -r -N icedtea-orig/jdk/src/solaris/native/java/net/NetworkInterface.c openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
--- icedtea-orig/jdk/src/solaris/native/java/net/NetworkInterface.c	2008-11-25 12:06:19.000000000 +0300
+++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c	2009-07-28 17:00:28.000000000 +0400
@@ -40,7 +40,7 @@
 #endif
 #ifdef __linux__
 #include <sys/ioctl.h>
-#include <bits/ioctls.h>
+//#include <bits/ioctls.h>
 #include <linux/sockios.h>
 #include <sys/utsname.h>
 #include <stdio.h>
@@ -1292,12 +1292,21 @@
     close(sock);
     return -1;
   }
+#if __LSB_VERSION__>=41 || (!defined __LSB_VERSION__)
   memcpy(buf, &ifr.ifr_hwaddr.sa_data, IFHWADDRLEN);
   close(sock);
   for (i = 0; i < IFHWADDRLEN; i++) {
     if (buf[i] != 0)
       return IFHWADDRLEN;
   }
+#else
+  memcpy(buf, &ifr.ifr_hwaddr.sa_data, 6/*IFHWADDRLEN*/);
+  close(sock);
+  for (i = 0; i < 6/*IFHWADDRLEN*/; i++) {
+    if (buf[i] != 0)
+      return 6/*IFHWADDRLEN*/;
+  }
+#endif
   /*
    * All bytes to 0 means no hardware address.
    */
diff -u -r -N icedtea-orig/jdk/src/solaris/native/java/nio/MappedByteBuffer.c openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
--- icedtea-orig/jdk/src/solaris/native/java/nio/MappedByteBuffer.c	2008-11-25 12:06:19.000000000 +0300
+++ openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c	2009-07-28 17:00:51.000000000 +0400
@@ -50,7 +50,12 @@
         return JNI_FALSE;
     }
 
+#ifndef __LSB_VERSION__
     result = mincore(a, (size_t)len, vec);
+#else
+    /* this functionality is unsupported on windows and on LSB system as well. */ 
+    return JNI_FALSE;
+#endif
     if (result != 0) {
         free(vec);
         JNU_ThrowIOExceptionWithLastError(env, "mincore failed");
@@ -77,7 +82,7 @@
     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 -u -r -N icedtea-orig/jdk/src/solaris/native/java/util/TimeZone_md.c openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
--- icedtea-orig/jdk/src/solaris/native/java/util/TimeZone_md.c	2008-11-25 12:06:19.000000000 +0300
+++ openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c	2009-07-28 17:02:40.000000000 +0400
@@ -99,7 +99,7 @@
     struct stat statbuf;
     union {
         struct dirent d;
-        char b[offsetof (struct dirent, d_name) + NAME_MAX + 1];
+        char b[offsetof (struct dirent, d_name) + 256 + 1];
     } entry;
     struct dirent *dp;
     char *pathname = NULL;
diff -u -r -N icedtea-orig/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c openjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
--- icedtea-orig/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c	2009-07-28 14:31:15.000000000 +0400
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c	2009-07-28 17:03:12.000000000 +0400
@@ -44,8 +44,8 @@
 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 @@
 #endif
 
 struct epoll_event {
-    __uint32_t events;  /* Epoll events */
+    uint32_t events;  /* Epoll events */
     epoll_data_t data;  /* User data variable */
 } EPOLL_PACKED;
 
diff -u -r -N icedtea-orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
--- icedtea-orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c	2008-11-25 12:06:26.000000000 +0300
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c	2009-07-28 17:04:26.000000000 +0400
@@ -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 @@
     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 @@
 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 -u -r -N icedtea-orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
--- icedtea-orig/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	2008-11-25 12:06:27.000000000 +0300
+++ openjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	2009-07-28 17:04:55.000000000 +0400
@@ -51,7 +51,11 @@
 {
     const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
     // look up existing handle only, do not load
+#if __LSB_VERSION__>=41 || (!defined __LSB_VERSION__)
     void *hModule = dlopen(libName, RTLD_NOLOAD);
+#else
+    void *hModule = dlopen(libName, 0x00004/*RTLD_NOLOAD*/);
+#endif
     dprintf2("-handle for %s: %u\n", libName, hModule);
     (*env)->ReleaseStringUTFChars(env, jLibName, libName);
     return (jlong)hModule;
diff -u -r -N icedtea-orig/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c openjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
--- icedtea-orig/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c	2008-11-25 12:06:27.000000000 +0300
+++ openjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c	2009-07-28 17:29:18.000000000 +0400
@@ -57,6 +57,7 @@
  * Invokes the callback function for each process
  */
 static void forEachProcess(ProcessCallback f, void* user_data) {
+#ifndef __LSB_VERSION__
     DIR* dir;
     struct dirent* ptr;
 
@@ -85,6 +86,27 @@
         (*f)(pid, user_data);
     }
     closedir(dir);
+#else
+    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);
+#endif
 }
 
 
diff -u -r -N icedtea-orig/jdk/src/solaris/native/sun/xawt/XToolkit.c openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
--- icedtea-orig/jdk/src/solaris/native/sun/xawt/XToolkit.c	2008-11-25 12:06:27.000000000 +0300
+++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c	2009-07-28 17:29:30.000000000 +0400
@@ -692,6 +692,7 @@
 
 static XErrorHandler saved_error_handler = NULL;
 
+#ifndef __LSB_VERSION__
 #ifdef __linux__
 void print_stack(void)
 {
@@ -711,6 +712,7 @@
   free (strings);
 }
 #endif
+#endif
 
 static int NoisyXErrorHandler(Display * dpy, XErrorEvent * event) {
     fprintf(stderr, "id=%x, serial=%x, ec=%d, rc=%d, mc=%d\n",
