diff -u -r -N lsbjdk7/jdk/make/Makefile testjdk/jdk/make/Makefile
--- lsbjdk7/jdk/make/Makefile	2009-06-10 13:33:52.000000000 +0400
+++ testjdk/jdk/make/Makefile	2009-07-28 13:36:40.000000000 +0400
@@ -239,7 +239,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 lsbjdk7/jdk/make/common/Defs-linux.gmk testjdk/jdk/make/common/Defs-linux.gmk
--- lsbjdk7/jdk/make/common/Defs-linux.gmk	2009-05-17 22:33:55.000000000 +0400
+++ testjdk/jdk/make/common/Defs-linux.gmk	2009-07-28 13:36:40.000000000 +0400
@@ -228,8 +228,10 @@
 #
 CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1)
 ifeq ("$(CC_VER_MAJOR)", "3")
+ifndef LSB
 OTHER_LDFLAGS  += -static-libgcc
 endif
+endif
 
 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
 #   (See Rules.gmk) The gcc 5 compiler might have an option for this?
diff -u -r -N lsbjdk7/jdk/make/common/Defs.gmk testjdk/jdk/make/common/Defs.gmk
--- lsbjdk7/jdk/make/common/Defs.gmk	2009-05-17 22:33:55.000000000 +0400
+++ testjdk/jdk/make/common/Defs.gmk	2009-07-28 13:36:40.000000000 +0400
@@ -228,7 +228,11 @@
   ifeq ($(PLATFORM), windows)
     FREETYPE_LIB = $(FREETYPE_LIB_PATH)/freetype.lib
   else
+    ifndef LSB
     FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) -lfreetype
+    else
+    FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) -lopenjdk6_lsb_helper -lfreetype
+    endif
   endif
 
   ifdef ALT_FREETYPE_HEADERS_PATH
diff -u -r -N lsbjdk7/jdk/make/common/shared/Compiler-gcc.gmk testjdk/jdk/make/common/shared/Compiler-gcc.gmk
--- lsbjdk7/jdk/make/common/shared/Compiler-gcc.gmk	2009-05-17 22:33:55.000000000 +0400
+++ testjdk/jdk/make/common/shared/Compiler-gcc.gmk	2009-07-28 13:36:40.000000000 +0400
@@ -54,10 +54,19 @@
 ifeq ($(PLATFORM), linux)
 
   # Settings specific to Linux
+  ifndef LSB
   CC             = $(COMPILER_PATH)gcc
   CPP            = $(COMPILER_PATH)gcc -E
+  else
+  CC           = /opt/lsb/bin/lsbcc
+  CPP           = /opt/lsb/bin/lsbcc -E
+  endif
   # statically link libstdc++ before C++ ABI is stablized on Linux
+  ifndef LSB
   STATIC_CXX     = true
+  else
+  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 lsbjdk7/jdk/make/lsb/Makefile testjdk/jdk/make/lsb/Makefile
--- lsbjdk7/jdk/make/lsb/Makefile	1970-01-01 03:00:00.000000000 +0300
+++ testjdk/jdk/make/lsb/Makefile	2009-07-28 13:36:40.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 lsbjdk7/jdk/make/sun/font/Makefile testjdk/jdk/make/sun/font/Makefile
--- lsbjdk7/jdk/make/sun/font/Makefile	2009-06-10 13:33:52.000000000 +0400
+++ testjdk/jdk/make/sun/font/Makefile	2009-07-28 13:36:40.000000000 +0400
@@ -159,6 +159,9 @@
   CPPFLAGS += -I$(CLOSED_SRC)/share/native/$(PKGDIR)/t2k
 else
   CPPFLAGS += -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 lsbjdk7/jdk/src/linux/lsb/lsb_freetype.c testjdk/jdk/src/linux/lsb/lsb_freetype.c
--- lsbjdk7/jdk/src/linux/lsb/lsb_freetype.c	1970-01-01 03:00:00.000000000 +0300
+++ testjdk/jdk/src/linux/lsb/lsb_freetype.c	2009-07-28 13:36:40.000000000 +0400
@@ -0,0 +1,277 @@
+
+
+/* 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"
+
+  FT_Error
+  FT_Outline_Embolden( FT_Outline*  outline,
+                       FT_Pos       strength );
+  FT_Error
+  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );
+
+  void
+  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )
+/* ok */
+  {
+    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;
+  }
+
+  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 );
+  }
+
+
+  /* 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; 
+
+
+  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;
+  }
+  typedef enum  FT_Orientation_
+  {
+    FT_ORIENTATION_TRUETYPE   = 0,
+    FT_ORIENTATION_POSTSCRIPT = 1,
+    FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
+    FT_ORIENTATION_FILL_LEFT  = FT_ORIENTATION_POSTSCRIPT,
+    FT_ORIENTATION_NONE
+
+  } FT_Orientation;
+
+
+  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;
+  }
+
+
diff -u -r -N lsbjdk7/jdk/src/linux/lsb/lsb_freetype.h testjdk/jdk/src/linux/lsb/lsb_freetype.h
--- lsbjdk7/jdk/src/linux/lsb/lsb_freetype.h	1970-01-01 03:00:00.000000000 +0300
+++ testjdk/jdk/src/linux/lsb/lsb_freetype.h	2009-07-28 13:36:40.000000000 +0400
@@ -0,0 +1,15 @@
+
+/* Include this file if you want to use non-lsb freetype functions */
+
+/* 
+FT_GlyphSlot_Embolden
+FT_GlyphSlot_Oblique
+*/
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+void FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );
+
+void FT_GlyphSlot_Oblique( FT_GlyphSlot  slot );
+
diff -u -r -N lsbjdk7/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c testjdk/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c
--- lsbjdk7/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/com/sun/media/sound/DirectAudioDevice.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/share/native/com/sun/media/sound/SoundDefs.h testjdk/jdk/src/share/native/com/sun/media/sound/SoundDefs.h
--- lsbjdk7/jdk/src/share/native/com/sun/media/sound/SoundDefs.h	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/com/sun/media/sound/SoundDefs.h	2009-07-28 13:36:40.000000000 +0400
@@ -67,10 +67,8 @@
 */
 #if (X_PLATFORM != X_WINDOWS)
 
-typedef unsigned char           UINT8;
 typedef char                    INT8;
 typedef short                   INT16;
-typedef unsigned short          UINT16;
 #ifdef _LP64
 typedef int                     INT32;
 typedef unsigned int            UINT32;
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	2009-07-28 13:36:40.000000000 +0400
@@ -40,6 +40,7 @@
 #include <setjmp.h>
 #include <assert.h>
 #include <string.h>
+#include <X11/Xmd.h>
 
 
 /* java native interface headers */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcapimin.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcapimin.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcapimin.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcapimin.c	2009-07-28 13:36:40.000000000 +0400
@@ -21,6 +21,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcapistd.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcapistd.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcapistd.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcapistd.c	2009-07-28 13:36:40.000000000 +0400
@@ -19,6 +19,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jccoefct.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jccoefct.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jccoefct.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jccoefct.c	2009-07-28 13:36:40.000000000 +0400
@@ -15,6 +15,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jccolor.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jccolor.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jccolor.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jccolor.c	2009-07-28 13:36:40.000000000 +0400
@@ -13,6 +13,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcdctmgr.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcdctmgr.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcdctmgr.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcdctmgr.c	2009-07-28 13:36:40.000000000 +0400
@@ -16,6 +16,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jchuff.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jchuff.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jchuff.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jchuff.c	2009-07-28 13:36:40.000000000 +0400
@@ -19,6 +19,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jchuff.h"             /* Declarations shared with jcphuff.c */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcinit.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcinit.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcinit.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcinit.c	2009-07-28 13:36:40.000000000 +0400
@@ -20,6 +20,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcmainct.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcmainct.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcmainct.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcmainct.c	2009-07-28 13:36:40.000000000 +0400
@@ -15,6 +15,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcmarker.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcmarker.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcmarker.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcmarker.c	2009-07-28 13:36:40.000000000 +0400
@@ -13,6 +13,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcmaster.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcmaster.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcmaster.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcmaster.c	2009-07-28 13:36:40.000000000 +0400
@@ -16,6 +16,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcomapi.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcomapi.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcomapi.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcomapi.c	2009-07-28 13:36:40.000000000 +0400
@@ -14,6 +14,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcparam.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcparam.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcparam.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcparam.c	2009-07-28 13:36:40.000000000 +0400
@@ -15,6 +15,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcphuff.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcphuff.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcphuff.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcphuff.c	2009-07-28 13:36:40.000000000 +0400
@@ -17,6 +17,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jchuff.h"             /* Declarations shared with jchuff.c */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcprepct.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcprepct.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcprepct.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcprepct.c	2009-07-28 13:36:40.000000000 +0400
@@ -19,6 +19,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcsample.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcsample.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jcsample.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jcsample.c	2009-07-28 13:36:40.000000000 +0400
@@ -50,6 +50,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jctrans.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jctrans.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jctrans.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jctrans.c	2009-07-28 13:36:40.000000000 +0400
@@ -15,6 +15,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdapimin.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdapimin.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdapimin.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdapimin.c	2009-07-28 13:36:40.000000000 +0400
@@ -21,6 +21,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdapistd.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdapistd.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdapistd.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdapistd.c	2009-07-28 13:36:40.000000000 +0400
@@ -19,6 +19,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdcoefct.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdcoefct.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdcoefct.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdcoefct.c	2009-07-28 13:36:40.000000000 +0400
@@ -19,6 +19,8 @@
  */
 
 #define JPEG_INTERNALS
+/* We include default header and comment out all declarations here */
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdcolor.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdcolor.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdcolor.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdcolor.c	2009-07-28 13:36:40.000000000 +0400
@@ -13,6 +13,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jddctmgr.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jddctmgr.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jddctmgr.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jddctmgr.c	2009-07-28 13:36:40.000000000 +0400
@@ -20,6 +20,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdhuff.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdhuff.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdhuff.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdhuff.c	2009-07-28 13:36:40.000000000 +0400
@@ -19,6 +19,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdhuff.h"             /* Declarations shared with jdphuff.c */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdinput.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdinput.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdinput.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdinput.c	2009-07-28 13:36:40.000000000 +0400
@@ -16,6 +16,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmainct.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmainct.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmainct.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmainct.c	2009-07-28 13:36:40.000000000 +0400
@@ -18,6 +18,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c	2009-07-28 13:36:40.000000000 +0400
@@ -17,6 +17,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmaster.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmaster.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmaster.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmaster.c	2009-07-28 13:36:40.000000000 +0400
@@ -16,6 +16,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmerge.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmerge.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdmerge.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdmerge.c	2009-07-28 13:36:40.000000000 +0400
@@ -37,6 +37,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdphuff.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdphuff.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdphuff.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdphuff.c	2009-07-28 13:36:40.000000000 +0400
@@ -19,6 +19,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdhuff.h"             /* Declarations shared with jdhuff.c */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdpostct.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdpostct.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdpostct.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdpostct.c	2009-07-28 13:36:40.000000000 +0400
@@ -21,6 +21,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdsample.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdsample.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdsample.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdsample.c	2009-07-28 13:36:40.000000000 +0400
@@ -23,6 +23,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdtrans.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdtrans.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jdtrans.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jdtrans.c	2009-07-28 13:36:40.000000000 +0400
@@ -15,6 +15,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jerror.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jerror.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jerror.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jerror.c	2009-07-28 13:36:40.000000000 +0400
@@ -23,6 +23,7 @@
  */
 
 /* this is not a core library module, so it doesn't define JPEG_INTERNALS */
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jversion.h"
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jfdctflt.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jfdctflt.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jfdctflt.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jfdctflt.c	2009-07-28 13:36:40.000000000 +0400
@@ -39,6 +39,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jfdctfst.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jfdctfst.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jfdctfst.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jfdctfst.c	2009-07-28 13:36:40.000000000 +0400
@@ -35,6 +35,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jfdctint.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jfdctint.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jfdctint.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jfdctint.c	2009-07-28 13:36:40.000000000 +0400
@@ -28,6 +28,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctflt.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctflt.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctflt.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctflt.c	2009-07-28 13:36:40.000000000 +0400
@@ -41,6 +41,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctfst.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctfst.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctfst.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctfst.c	2009-07-28 13:36:40.000000000 +0400
@@ -37,6 +37,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctint.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctint.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctint.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctint.c	2009-07-28 13:36:40.000000000 +0400
@@ -30,6 +30,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctred.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctred.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jidctred.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jidctred.c	2009-07-28 13:36:40.000000000 +0400
@@ -25,6 +25,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jdct.h"               /* Private declarations for DCT subsystem */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jinclude.h testjdk/jdk/src/share/native/sun/awt/image/jpeg/jinclude.h
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jinclude.h	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jinclude.h	2009-07-28 13:36:40.000000000 +0400
@@ -81,6 +81,7 @@
  * we always use this SIZEOF() macro in place of using sizeof() directly.
  */
 
+#undef SIZEOF
 #define SIZEOF(object)  ((size_t) sizeof(object))
 
 /*
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c	2009-07-28 13:36:40.000000000 +0400
@@ -29,6 +29,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #define AM_MEMORY_MANAGER       /* we define jvirt_Xarray_control structs */
 #include "jinclude.h"
 #include "jpeglib.h"
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c	2009-07-28 13:36:40.000000000 +0400
@@ -20,6 +20,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jmemsys.h"            /* import the system-dependent declarations */
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jmorecfg.h testjdk/jdk/src/share/native/sun/awt/image/jpeg/jmorecfg.h
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jmorecfg.h	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jmorecfg.h	2009-07-28 13:36:40.000000000 +0400
@@ -156,16 +156,16 @@
 /* INT16 must hold at least the values -32768..32767. */
 
 #ifndef XMD_H                   /* X11/xmd.h correctly defines INT16 */
-typedef short INT16;
+//typedef short INT16;
 #endif
 
 /* INT32 must hold at least signed 32-bit values. */
 
 #ifndef XMD_H                   /* X11/xmd.h correctly defines INT32 */
 #ifndef _LP64
-typedef long INT32;
+//typedef long INT32;
 #else
-typedef int INT32;
+//typedef int INT32;
 #endif
 #endif
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	2009-07-28 13:36:40.000000000 +0400
@@ -37,6 +37,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <assert.h>
+#include <X11/Xmd.h>
 
 #include "jni.h"
 #include "jni_util.h"
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jquant1.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jquant1.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jquant1.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jquant1.c	2009-07-28 13:36:40.000000000 +0400
@@ -15,6 +15,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jquant2.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jquant2.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jquant2.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jquant2.c	2009-07-28 13:36:40.000000000 +0400
@@ -22,6 +22,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jutils.c testjdk/jdk/src/share/native/sun/awt/image/jpeg/jutils.c
--- lsbjdk7/jdk/src/share/native/sun/awt/image/jpeg/jutils.c	2009-05-17 22:34:09.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/image/jpeg/jutils.c	2009-07-28 13:36:40.000000000 +0400
@@ -16,6 +16,7 @@
  */
 
 #define JPEG_INTERNALS
+#include <X11/Xmd.h>
 #include "jinclude.h"
 #include "jpeglib.h"
 
diff -u -r -N lsbjdk7/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h testjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h
--- lsbjdk7/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h	2009-05-17 22:34:10.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.h	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/share/native/sun/awt/medialib/mlib_image.h testjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h
--- lsbjdk7/jdk/src/share/native/sun/awt/medialib/mlib_image.h	2009-05-17 22:34:10.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/medialib/mlib_image.h	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/share/native/sun/awt/medialib/mlib_sys.c testjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c
--- lsbjdk7/jdk/src/share/native/sun/awt/medialib/mlib_sys.c	2009-05-17 22:34:10.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/awt/medialib/mlib_sys.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/share/native/sun/font/freetypeScaler.c testjdk/jdk/src/share/native/sun/font/freetypeScaler.c
--- lsbjdk7/jdk/src/share/native/sun/font/freetypeScaler.c	2009-06-10 14:21:17.000000000 +0400
+++ testjdk/jdk/src/share/native/sun/font/freetypeScaler.c	2009-07-28 13:36:40.000000000 +0400
@@ -38,6 +38,9 @@
 #include FT_SIZES_H
 #include FT_OUTLINE_H
 #include FT_SYNTHESIS_H
+#ifdef __LSB_VERSION__
+#include "lsb_freetype.h"
+#endif
 
 
 #include "fontscaler.h"
diff -u -r -N lsbjdk7/jdk/src/solaris/bin/ergo.c testjdk/jdk/src/solaris/bin/ergo.c
--- lsbjdk7/jdk/src/solaris/bin/ergo.c	2009-05-17 22:34:11.000000000 +0400
+++ testjdk/jdk/src/solaris/bin/ergo.c	2009-07-28 13:36:40.000000000 +0400
@@ -74,7 +74,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
 
   JLI_TraceLauncher("pages: " UINT64_FORMAT
           "  page_size: " UINT64_FORMAT
diff -u -r -N lsbjdk7/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c testjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
--- lsbjdk7/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c	2009-07-28 13:36:40.000000000 +0400
@@ -535,12 +535,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
@@ -595,5 +595,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 lsbjdk7/jdk/src/solaris/hpi/native_threads/src/threads_linux.c testjdk/jdk/src/solaris/hpi/native_threads/src/threads_linux.c
--- lsbjdk7/jdk/src/solaris/hpi/native_threads/src/threads_linux.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/hpi/native_threads/src/threads_linux.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/hpi/src/memory_md.c testjdk/jdk/src/solaris/hpi/src/memory_md.c
--- lsbjdk7/jdk/src/solaris/hpi/src/memory_md.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/hpi/src/memory_md.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c testjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
--- lsbjdk7/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	2009-06-05 23:07:22.000000000 +0400
+++ testjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	2009-07-28 13:43:48.000000000 +0400
@@ -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,18 @@
 
     dirp = opendir("/proc/self/fd");
     if (dirp == NULL) {
+#ifndef __LSB_VERSION__
         throw_internal_error(env, "Unable to open directory /proc/self/fd");
         return -1;
+#else
+        // LSB doesn't specify 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;
+#endif
     }
 
     // iterate through directory entries, skipping '.' and '..'
diff -u -r -N lsbjdk7/jdk/src/solaris/native/java/lang/java_props_md.c testjdk/jdk/src/solaris/native/java/lang/java_props_md.c
--- lsbjdk7/jdk/src/solaris/native/java/lang/java_props_md.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/java/lang/java_props_md.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/native/java/net/Inet4AddressImpl.c testjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
--- lsbjdk7/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/native/java/net/Inet6AddressImpl.c testjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
--- lsbjdk7/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	2009-07-28 13:36:40.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 {
@@ -477,7 +478,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 lsbjdk7/jdk/src/solaris/native/java/net/NetworkInterface.c testjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
--- lsbjdk7/jdk/src/solaris/native/java/net/NetworkInterface.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/java/net/NetworkInterface.c	2009-07-28 13:36:40.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>
@@ -1337,12 +1337,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 lsbjdk7/jdk/src/solaris/native/java/net/linux_close.c testjdk/jdk/src/solaris/native/java/net/linux_close.c
--- lsbjdk7/jdk/src/solaris/native/java/net/linux_close.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/java/net/linux_close.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/native/java/nio/MappedByteBuffer.c testjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
--- lsbjdk7/jdk/src/solaris/native/java/nio/MappedByteBuffer.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c	2009-07-28 13:36:40.000000000 +0400
@@ -54,7 +54,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");
@@ -81,7 +86,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 lsbjdk7/jdk/src/solaris/native/java/util/TimeZone_md.c testjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
--- lsbjdk7/jdk/src/solaris/native/java/util/TimeZone_md.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/java/util/TimeZone_md.c	2009-07-28 13:36: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 lsbjdk7/jdk/src/solaris/native/sun/awt/awt_xembed_server.c testjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
--- lsbjdk7/jdk/src/solaris/native/sun/awt/awt_xembed_server.c	2009-05-17 22:34:12.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c	2009-07-28 13:36:40.000000000 +0400
@@ -835,6 +835,7 @@
     AWT_UNLOCK();
 }
 
+#ifndef __LSB_VERSION_
 #ifdef __linux__
 void
 print_stack (void)
@@ -855,6 +856,8 @@
   free (strings);
 }
 #endif
+#endif
+
 
 extern int32_t  numEventsHandled;
 
diff -u -r -N lsbjdk7/jdk/src/solaris/native/sun/nio/ch/EPoll.c testjdk/jdk/src/solaris/native/sun/nio/ch/EPoll.c
--- lsbjdk7/jdk/src/solaris/native/sun/nio/ch/EPoll.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/nio/ch/EPoll.c	2009-07-28 13:36:40.000000000 +0400
@@ -44,12 +44,12 @@
 typedef union epoll_data {
     void *ptr;
     int fd;
-    __uint32_t u32;
-    __uint64_t u64;
+    uint32_t u32;
+    uint64_t u64;
 } epoll_data_t;
 
 struct epoll_event {
-    __uint32_t events;  /* Epoll events */
+    uint32_t events;  /* Epoll events */
     epoll_data_t data;  /* User data variable */
 } __attribute__ ((__packed__));
 
diff -u -r -N lsbjdk7/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c testjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
--- lsbjdk7/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/native/sun/nio/ch/NativeThread.c testjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
--- lsbjdk7/jdk/src/solaris/native/sun/nio/ch/NativeThread.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/native/sun/nio/ch/Sctp.h testjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.h
--- lsbjdk7/jdk/src/solaris/native/sun/nio/ch/Sctp.h	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.h	2009-07-28 13:36:40.000000000 +0400
@@ -67,7 +67,7 @@
 
 #else /* __linux__ */
 #include <stdint.h>
-#include <linux/types.h>
+//#include <linux/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include "jni.h"
@@ -154,7 +154,11 @@
         SCTP_UNORDERED = 1,  /* Send/receive message unordered. */
         SCTP_ADDR_OVER = 2,  /* Override the primary destination. */
         SCTP_ABORT=4,        /* Send an ABORT message to the peer. */
+#ifndef __LSB_VERSION__
         SCTP_EOF=MSG_FIN,    /* Initiate graceful shutdown process. */
+#else
+        SCTP_EOF=0x200/*MSG_FIN*/,    /* Initiate graceful shutdown process. */
+#endif
 };
 
 enum sctp_sn_type {
@@ -183,6 +187,18 @@
 #define SCTP_BINDX_ADD_ADDR 0x01
 #define SCTP_BINDX_REM_ADDR 0x02
 
+#ifdef __LSB_VERSION__
+/* backward aliases.  The types are to be rewritten */
+typedef int8_t __s8;
+typedef int16_t __s16;
+typedef int32_t __s32;
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+typedef uint64_t __u64;
+typedef int64_t __s64;
+#endif
+
 typedef __s32 sctp_assoc_t;
 
 struct sctp_initmsg {
diff -u -r -N lsbjdk7/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c testjdk/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
--- lsbjdk7/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c	2009-07-28 13:36:40.000000000 +0400
@@ -32,7 +32,7 @@
 #include <dlfcn.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
 
 #include "sun_nio_fs_LinuxWatchService.h"
 
@@ -40,6 +40,21 @@
 #ifdef  __cplusplus
 extern "C" {
 #endif
+#ifdef __LSB_VERSION__
+/* Support for flexible arrays.  */
+/* LSB does not define it.  */
+# ifdef __GNUC__
+#  define __flexarr [0]
+# else
+#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#   define __flexarr    []
+#  else
+/* Some other non-C99 compiler.  Approximate with [1].  */
+#   define __flexarr    [1]
+#  endif
+# endif
+#endif
+
 struct inotify_event
 {
   int wd;
diff -u -r -N lsbjdk7/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c testjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
--- lsbjdk7/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	2009-07-28 13:36:40.000000000 +0400
@@ -113,7 +113,7 @@
     #ifndef __NR_fstatat64
     #define __NR_fstatat64  300
     #endif
-    return syscall(__NR_fstatat64, dfd, path, statbuf, flag);
+    return fstatat64(dfd, path, statbuf, flag);
 }
 #endif
 
@@ -125,7 +125,7 @@
     #ifndef __NR_newfstatat
     #define __NR_newfstatat  262
     #endif
-    return syscall(__NR_newfstatat, dfd, path, statbuf, flag);
+    return fstatat64(dfd, path, statbuf, flag);
 }
 #endif
 
diff -u -r -N lsbjdk7/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c testjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
--- lsbjdk7/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c	2009-07-28 13:36:40.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 lsbjdk7/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c testjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
--- lsbjdk7/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c	2009-07-28 13:42:35.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 lsbjdk7/jdk/src/solaris/native/sun/xawt/XToolkit.c testjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
--- lsbjdk7/jdk/src/solaris/native/sun/xawt/XToolkit.c	2009-05-17 22:34:13.000000000 +0400
+++ testjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c	2009-07-28 13:36:40.000000000 +0400
@@ -686,6 +686,7 @@
 
 static XErrorHandler saved_error_handler = NULL;
 
+#ifndef __LSB_VERSION__
 #ifdef __linux__
 void print_stack(void)
 {
@@ -705,6 +706,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",
