jni issues with JDK1.6.0 (calling vm from c++ native)

Charlie Root root at fourcalorieservers.com
Thu Oct 9 15:37:29 UTC 2008


Hello all:


I have a small snippet program that attempts to launch a java vm (JDK1.6.0 on FreeBSD 7.0) using c++ native code with jni.


The pertinent line of code to launch the vm is:

    ...
    //
    // Create VM
    //
    JNI_CreateJavaVM(&jvm,(void **)&env, &vm_args);
    ...


When the test program is executed with truss, the output shows the cause of the crash is a call to non-existent call ksem_init:

gettimeofday({1223561385.435451},0x0)            = 0 (0x0)
lseek(3,0x2b0d74c,SEEK_SET)                      = 45143884 (0x2b0d74c)
read(3,"PK\^C\^D\n\0\0\0\0\0\M^U\M^Q\f9"...,30)  = 30 (0x1e)
lseek(3,0x2b0d791,SEEK_SET)                      = 45143953 (0x2b0d791)
read(3,"\M-J\M-~\M-:\M->\0\0\0001\0<\b\0"...,1134) = 1134 (0x46e)
gettimeofday({1223561385.436426},0x0)            = 0 (0x0)
gettimeofday({1223561385.436553},0x0)            = 0 (0x0)
gettimeofday({1223561385.436811},0x0)            = 0 (0x0)
gettimeofday({1223561385.436972},0x0)            = 0 (0x0)
gettimeofday({1223561385.437336},0x0)            = 0 (0x0)
gettimeofday({1223561385.437588},0x0)            = 0 (0x0)
gettimeofday({1223561385.437729},0x0)            = 0 (0x0)
gettimeofday({1223561385.437879},0x0)            = 0 (0x0)
gettimeofday({1223561385.438150},0x0)            = 0 (0x0)
gettimeofday({1223561385.537357},0x0)            = 0 (0x0)
gettimeofday({1223561385.537543},0x0)            = 0 (0x0)
ksem_init(0xbfbfe87c,0x0,0x2804a419,0x28077200,0x510,0x0) ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS)


A subsequent culling of internet mailing lists shows that the ksem_init call is in fact a non-existent call on the GENERIC kernel for FreeBSD 7.0, due to the fact that the GENERIC kernel does not include the P1003_1B_SEMAPHORES option.

Before I rebuild the kernel with the P1003_1B_SEMAPHORES option, are there any issues/caveats involved with using it on FreeBSD 7.0 (Taking into consideration that I must make heavy use of pthreads in the application)?.

 -Regards,

  Ron




More information about the freebsd-java mailing list