[PATCH] HP-UX 11 port of JSVC (Commons::Daemon)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] HP-UX 11 port of JSVC (Commons::Daemon)

Max Zinal
Hello and have a good time of day!

This patch allows JSVC to compile and run on HP-UX 11
systems. It has been tested on PA_RISC2.0W architecture,
but should also work on PA_RISC2.0. Compilation was
performed with GCC 3.4.3, with JDK 1.4.2 provided by HP.

There is a major problem with that patch. It links libjvm.sl
directly to jsvc binary in addition of dlopen()ing it because
of static TLS entry inside libjvm.sl. These TLS problems are
native and common to HP-UX, and I don't know how to get rid
of it. Maybe using HP's ANSI-compatible C compiler could help.
Please note that this patch is hard-coded to JDK 1.4, which
always resides in /opt/java1.4.

In addition, I had to decrease sleep() parameter in the child()
wait-for-stop cycle. With the default value of 60 seconds there
were significant delays (up to 60 seconds) in the response to
SIGINT, SIGHUP and SIGTERM. With the value of 2 seconds the delay
is always almost zero. I know it's strange, but it works after all.

Hope this patch could be useful to people using HP-UX.

--
   Max Zinal


diff -ur daemon-1.0.1a/src/native/unix/configure daemon-1.0.1b/src/native/unix/configure
--- daemon-1.0.1a/src/native/unix/configure 2005-05-17 15:00:45.000000000 +0400
+++ daemon-1.0.1b/src/native/unix/configure 2005-06-01 10:13:13.746683194 +0400
@@ -2413,6 +2413,10 @@
     CFLAGS="$CFLAGS -pthread -DOS_TRU64 -DDSO_DLFCN -D_XOPEN_SOURCE_EXTENDED"
     LDFLAGS="$LDFLAGS -pthread"
     ;;
+  hpux11*)
+    CFLAGS="$CFLAGS -pthread -DOS_HPUX -DDSO_DLFCN"
+    LDFLAGS="$LDFLAGS -pthread -lpthread"
+    ;;
   *)
     echo "$as_me:$LINENO: result: failed" >&5
 echo "${ECHO_T}failed" >&6
@@ -2444,6 +2448,16 @@
     CFLAGS="$CFLAGS -DCPU=\\\"alpha\\\""
     supported_os="alpha"
     ;;
+  hppa2.0w)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\""
+    supported_os="hp-ux"
+    LDFLAGS="$LDFLAGS -L/opt/java1.4/jre/lib/PA_RISC2.0W/server -ljvm"
+    ;;
+  hppa2.0)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0\\\""
+    supported_os="hp-ux"
+    LDFLAGS="$LDFLAGS -L/opt/java1.4/jre/lib/PA_RISC2.0/server -ljvm"
+    ;;
   *)
     echo "$as_me:$LINENO: result: failed" >&5
 echo "${ECHO_T}failed" >&6
diff -ur daemon-1.0.1a/src/native/unix/native/jsvc-unix.c daemon-1.0.1b/src/native/unix/native/jsvc-unix.c
--- daemon-1.0.1a/src/native/unix/native/jsvc-unix.c 2005-05-30 15:50:34.000000000 +0400
+++ daemon-1.0.1b/src/native/unix/native/jsvc-unix.c 2005-06-01 10:14:19.817823008 +0400
@@ -524,7 +524,7 @@
         java_sleep(60);
         /* pause(); */
 #else
-        sleep(60); /* pause() not threadsafe */
+        sleep(2); /* pause() not threadsafe */
 #endif
     }
     remove_tmp_file(args);
diff -ur daemon-1.0.1a/src/native/unix/native/location.c daemon-1.0.1b/src/native/unix/native/location.c
--- daemon-1.0.1a/src/native/unix/native/location.c 2005-04-27 20:28:57.000000000 +0400
+++ daemon-1.0.1b/src/native/unix/native/location.c 2005-06-01 10:13:13.747682969 +0400
@@ -40,6 +40,9 @@
 #elif defined(OS_TRU64)
     "/usr/opt/java142",
     "/usr/opt/java13",
+#elif defined(OS_HPUX)
+    "/opt/java1.4",
+    "/opt/java1.3",
 #endif
     NULL,
 };
@@ -99,6 +102,11 @@
     "$JAVA_HOME/jre/lib/" CPU "/fast32/libjvm.so",
     "$JAVA_HOME/lib/" CPU "/fast64/libjvm.so",
     "$JAVA_HOME/lib/" CPU "/fast32/libjvm.so",
+#elif defined(OS_HPUX)
+    "$JAVA_HOME/jre/lib/" CPU "/server/libjvm.sl",
+    "$JAVA_HOME/jre/lib/" CPU "/client/libjvm.sl",
+    "$JAVA_HOME/jre/lib/" CPU "/hotspot/libjvm.sl",
+    "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.sl",
 #endif
     NULL,
 };
@@ -114,6 +122,9 @@
 #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_FREEBSD) || defined(OS_TRU64)
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.so",/* Sun JDK 1.3 */
     "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.so",    /* Sun JRE 1.3 */
+#elif defined(OS_HPUX)
+    "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.sl",
+    "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.sl",
 #elif defined(OS_SYSV)
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/dce_threads/libjvm.so",
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/green_threads/libjvm.so",
diff -ur daemon-1.0.1a/src/native/unix/support/apsupport.m4 daemon-1.0.1b/src/native/unix/support/apsupport.m4
--- daemon-1.0.1a/src/native/unix/support/apsupport.m4 2005-04-28 12:03:15.000000000 +0400
+++ daemon-1.0.1b/src/native/unix/support/apsupport.m4 2005-06-01 10:13:13.749682519 +0400
@@ -58,6 +58,10 @@
     CFLAGS="$CFLAGS -pthread -DOS_TRU64 -DDSO_DLFCN -D_XOPEN_SOURCE_EXTENDED"
     LDFLAGS="$LDFLAGS -pthread"
     ;;
+  hpux11*)
+    CFLAGS="$CFLAGS -pthread -DOS_HPUX -DDSO_DLFCN"
+    LDFLAGS="$LDFLAGS -pthread -lpthread"
+    ;;
   *)
     AC_MSG_RESULT([failed])
     AC_MSG_ERROR([Unsupported operating system "$host_os"])
@@ -86,6 +90,16 @@
     CFLAGS="$CFLAGS -DCPU=\\\"alpha\\\""
     supported_os="alpha"
     ;;
+  hppa2.0w)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0W\\\""
+    supported_os="hp-ux"
+    LDFLAGS="$LDFLAGS -L/opt/java1.4/jre/lib/PA_RISC2.0W/server -ljvm"
+    ;;
+  hppa2.0)
+    CFLAGS="$CFLAGS -DCPU=\\\"PA_RISC2.0\\\""
+    supported_os="hp-ux"
+    LDFLAGS="$LDFLAGS -L/opt/java1.4/jre/lib/PA_RISC2.0/server -ljvm"
+    ;;
   *)
     AC_MSG_RESULT([failed])
     AC_MSG_ERROR([Unsupported CPU architecture "$host_cpu"]);;

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] HP-UX 11 port of JSVC (Commons::Daemon)

jean-frederic clere
Max Zinal wrote:

> Hello and have a good time of day!
>
> This patch allows JSVC to compile and run on HP-UX 11
> systems. It has been tested on PA_RISC2.0W architecture,
> but should also work on PA_RISC2.0. Compilation was
> performed with GCC 3.4.3, with JDK 1.4.2 provided by HP.
>
> There is a major problem with that patch. It links libjvm.sl
> directly to jsvc binary in addition of dlopen()ing it because
> of static TLS entry inside libjvm.sl. These TLS problems are
> native and common to HP-UX, and I don't know how to get rid
> of it. Maybe using HP's ANSI-compatible C compiler could help.
> Please note that this patch is hard-coded to JDK 1.4, which
> always resides in /opt/java1.4.

Probably mixing native and gcc libraries is not working well ;-(.

>
> In addition, I had to decrease sleep() parameter in the child()
> wait-for-stop cycle. With the default value of 60 seconds there
> were significant delays (up to 60 seconds) in the response to
> SIGINT, SIGHUP and SIGTERM. With the value of 2 seconds the delay
> is always almost zero. I know it's strange, but it works after all.

Try to use java_sleep(60) (See the code I have added for OSD_POSIX).

>
> Hope this patch could be useful to people using HP-UX.
>
> --
>   Max Zinal
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] HP-UX 11 port of JSVC (Commons::Daemon)

jean-frederic clere
In reply to this post by Max Zinal
Max Zinal wrote:

> Hello and have a good time of day!
>
> This patch allows JSVC to compile and run on HP-UX 11
> systems. It has been tested on PA_RISC2.0W architecture,
> but should also work on PA_RISC2.0. Compilation was
> performed with GCC 3.4.3, with JDK 1.4.2 provided by HP.
>
> There is a major problem with that patch. It links libjvm.sl
> directly to jsvc binary in addition of dlopen()ing it because
> of static TLS entry inside libjvm.sl. These TLS problems are
> native and common to HP-UX, and I don't know how to get rid
> of it.

The LDFLAGS="$LDFLAGS -L/opt/java1.4/jre/lib/PA_RISC2.0W/server -ljvm" probably
cause the static linking. What happends if you remove it?

> Maybe using HP's ANSI-compatible C compiler could help.
> Please note that this patch is hard-coded to JDK 1.4, which
> always resides in /opt/java1.4.
>
> In addition, I had to decrease sleep() parameter in the child()
> wait-for-stop cycle. With the default value of 60 seconds there
> were significant delays (up to 60 seconds) in the response to
> SIGINT, SIGHUP and SIGTERM. With the value of 2 seconds the delay
> is always almost zero. I know it's strange, but it works after all.
>
> Hope this patch could be useful to people using HP-UX.
>
> --
>   Max Zinal
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] HP-UX 11 port of JSVC (Commons::Daemon)

Max Zinal
jean-frederic clere wrote:

> Max Zinal wrote:
>
>> There is a major problem with that patch. It links libjvm.sl
>> directly to jsvc binary in addition of dlopen()ing it because
>> of static TLS entry inside libjvm.sl. These TLS problems are
>> native and common to HP-UX, and I don't know how to get rid
>> of it.
>
>
> The LDFLAGS="$LDFLAGS -L/opt/java1.4/jre/lib/PA_RISC2.0W/server -ljvm"
> probably cause the static linking. What happends if you remove it?

jsvc initialization fails when it tries to load appropriate libjvm.sl.
I cannot give you the exact error message because I don't currently have
access to HP-UX system, but it's something about a static TLS entry in
libjvm.sl itself. The text in the error message suggests relinking
libjvm.sl with dynamic TLS enabled. So we you cannot dlopen() libjvm.sl
if it is not already linked to the calling binary (e.g. jsvc). So this
is a major problem I've mentioned before.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]