29 Mar 2005 rmathew   » (Master)

Java Web Start (JDK 1.4.2_07) on Linux (Again)
I found a neater way of working around the bug in Sun's javaws in JDK 1.4.2_07 on a Linux system running kernel 2.6.x and glibc 2.3.3+ that I referred to in my previous blog entry - I wrote a wrapper for waitid() that tolerates the bogus options passed by javawsbin and calls the real waitid() with saner options. With this code, I am finally able to run javaws without problems. Note that this bug seems to have been fixed by Sun in JDK 1.5.0_02.
/* Quick and dirty pre-loaded DSO to make buggy javawsbin
   in JDK 1.4.2_07 work on Linux with kernel 2.6.x and
   glibc 2.3.4.

Compilation: gcc -O2 -fPIC -g0 -shared -o mywait.so mywait.c

Usage (Bash): LD_PRELOAD=/path/to/mywait.so /path/to/javaws <Launcher URL> */ #include <dlfcn.h> #include <sys/wait.h>

int (*real_waitid)( idtype_t, id_t, siginfo_t *, int);

int waitid( idtype_t idtype, id_t id, siginfo_t *infop, int options) { int retVal = -1;

void *handle = dlopen( "/lib/libc.so.6", RTLD_LAZY); real_waitid = dlsym( handle, "waitid");

options = (options == 0) ? WEXITED : options; retVal = (*real_waitid)( idtype, id, infop, options);

dlclose( handle);

return retVal; } /* End pseudo-waitid() */

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!