You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/16 07:50:02 UTC

svn commit: r804626 - in /commons/sandbox/runtime/trunk/src/main/native: ./ include/ include/arch/hpux/ include/arch/windows/ os/unix/ os/win32/ port/

Author: mturk
Date: Sun Aug 16 05:50:02 2009
New Revision: 804626

URL: http://svn.apache.org/viewvc?rev=804626&view=rev
Log:
Add port subdir

Added:
    commons/sandbox/runtime/trunk/src/main/native/port/
    commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c   (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/native/Makefile.in
    commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
    commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
    commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
    commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Sun Aug 16 05:50:02 2009
@@ -65,6 +65,7 @@
 
 ARCH_DIRS=\
 	$(SRCDIR)/shared \
+	$(SRCDIR)/port \
 	$(SRCDIR)/os/linux \
 	$(SRCDIR)/os/solaris \
 	$(SRCDIR)/os/darwin \
@@ -190,6 +191,9 @@
 	$(SRCDIR)/os/hpux/shm.$(OBJ) \
 	$(SRCDIR)/os/hpux/os.$(OBJ)
 
+PPORT_OBJS=\
+	$(SRCDIR)/port/strsignal.$(OBJ)
+
 ZLIB_OBJS=\
 	$(SRCDIR)/srclib/zlib/adler32.$(OBJ) \
 	$(SRCDIR)/srclib/zlib/compress.$(OBJ) \
@@ -219,12 +223,12 @@
 .cpp.$(OBJ):
 	$(CXX) $(CFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
 
-$(STATICLIB): $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@
+$(STATICLIB): $(PPORT_OBJS) $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@
 	$(AR) $(ARFLAGS) $@ $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@
 	$(RANLIB) $@
 
-$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@ $(STATICLIB)
-	$(CC) $(SHFLAGS) $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@ $(LDFLAGS) -o $@
+$(SHAREDLIB): $(PPORT_OBJS) $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@ $(STATICLIB)
+	$(CC) $(SHFLAGS) $(PPORT_OBJS) $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@ $(LDFLAGS) -o $@
 
 $(SSLMODLIB): $(SHAREDLIB) $(OPENSSL_OBJS)
 	$(CC) $(EXLFLAGS) $(SHFLAGS) $(OPENSSL_OBJS) $(LDFLAGS) $(SSLFLAGS) -L. -l$(NAME) -o $@

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Sun Aug 16 05:50:02 2009
@@ -113,6 +113,9 @@
 	$(SRCDIR)/os/win32/wutil.$(OBJ) \
 	$(SRCDIR)/os/win32/wusec.$(OBJ)
 
+PPORT_OBJS=\
+	$(SRCDIR)/port/strsignal.$(OBJ)
+
 ZLIB_OBJS=\
 	$(SRCDIR)/srclib/zlib/adler32.$(OBJ) \
 	$(SRCDIR)/srclib/zlib/compress.$(OBJ) \
@@ -137,6 +140,9 @@
 {$(SRCDIR)\shared}.c{$(SRCDIR)\shared}.$(OBJ):
 	$(CC) $(CFLAGS) $(CPPFLAGS) -DACR_DECLARE_EXPORT $(INCLUDES) -c -Fo$@ -Fd$(LIBNAME)-src $<
 
+{$(SRCDIR)\port}.c{$(SRCDIR)\port}.$(OBJ):
+	$(CC) $(CFLAGS) $(CPPFLAGS) -DACR_DECLARE_EXPORT $(INCLUDES) -c -Fo$@ -Fd$(LIBNAME)-src $<
+
 {$(SRCDIR)\os\win32}.c{$(SRCDIR)\os\win32}.$(OBJ):
 	$(CC) $(CFLAGS) $(CPPFLAGS) -DACR_DECLARE_EXPORT $(INCLUDES) -c -Fo$@ -Fd$(LIBNAME)-src $<
 
@@ -152,10 +158,10 @@
 {$(SRCDIR)\modules\network\ssl}.c{$(SRCDIR)\modules\network\ssl}.$(OBJ):
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -Fo$@ -Fd$(SSLNAME)-src $<
 
-$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@
+$(SHAREDLIB): $(PPORT_OBJS) $(COMMON_OBJS) $(@platform@_OBJS) $(ZLIB_OBJS) @testobjs@
 	$(RC) /l 0x409 /d "NDEBUG" /i "$(SRCDIR)\include" /fo $@.res $(SRCDIR)/os/win32/main.rc
 	$(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS /pdb:$(LIBNAME).pdb /out:$@ @<<
-	$(COMMON_OBJS) $(WINDOWS_OBJS) $(ZLIB_OBJS) @testobjs@ $@.res
+	$(PPORT_OBJS) $(COMMON_OBJS) $(WINDOWS_OBJS) $(ZLIB_OBJS) @testobjs@ $@.res
 <<
 	IF EXIST $@.manifest \
 		mt -nologo -manifest $@.manifest -outputresource:$@;2
@@ -182,6 +188,7 @@
 
 
 clean:
+	-@del /Q $(SRCDIR)\port\*.$(OBJ) 2>NUL
 	-@del /Q $(SRCDIR)\shared\*.$(OBJ) 2>NUL
 	-@del /Q $(SRCDIR)\test\*.$(OBJ) 2>NUL
 	-@del /Q $(SRCDIR)\os\win32\*.$(OBJ) 2>NUL

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h Sun Aug 16 05:50:02 2009
@@ -273,6 +273,10 @@
 #define J2W(V)                  _w##V
 #define J2S(V)                  _c##V
 
+
+#define UNUSED_SOURCE_FILE(F)   \
+const char __unused_##F [] = "unused " #F ".c"
+
 #if CC_SIZEOF_VOIDP == 8
 typedef jlong                   jniptr;
 #define P2N(P)                  ((jlong)LLT(P))

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h Sun Aug 16 05:50:02 2009
@@ -39,6 +39,13 @@
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_platform_hpux_##CL##_##FN
 
 /**
+ * Include needed functions from portable layer
+ */
+#define ACR_WANT_STRSIGNAL                  1
+extern char *strsignal(int);
+
+
+/**
  * Temporary APR flags
  */
 #define APR_USE_SHMEM_SHMGET                1

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h Sun Aug 16 05:50:02 2009
@@ -70,6 +70,12 @@
  */
 #define ACR_DELTA_EPOCH_IN_USEC   11644473600000000I64
 
+/**
+ * Include needed functions from portable layer
+ */
+#define ACR_WANT_STRSIGNAL                  1
+extern char *strsignal(int);
+
 
 /**
  * Local functions from wusec.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c Sun Aug 16 05:50:02 2009
@@ -163,7 +163,7 @@
 ACR_DECLARE(int) ACR_SemaphorePermSet(JNIEnv *_E, int sema, int perms,
                                       acr_uid_t uid, acr_uid_t gid)
 {
-    int rc;
+    int rc = 0;
     acr_semaphore_t *s = (acr_semaphore_t *)ACR_IOH(sema);
 
     if (IS_INVALID_HANDLE(s) || ACR_IOH_TYPE(sema) != ACR_DT_SEMAPHORE) {
@@ -185,7 +185,7 @@
 
 ACR_DECLARE(int) ACR_SemaphoreWait(JNIEnv *_E, int sema)
 {
-    int rc;
+    int rc = 0;
     acr_semaphore_t *s = (acr_semaphore_t *)ACR_IOH(sema);
 
     if (IS_INVALID_HANDLE(s) || ACR_IOH_TYPE(sema) != ACR_DT_SEMAPHORE) {
@@ -205,7 +205,7 @@
 
 ACR_DECLARE(int) ACR_SemaphoreTryWait(JNIEnv *_E, int sema)
 {
-    int rc;
+    int rc = 0;
     acr_semaphore_t *s = (acr_semaphore_t *)ACR_IOH(sema);
 
     if (IS_INVALID_HANDLE(s) || ACR_IOH_TYPE(sema) != ACR_DT_SEMAPHORE) {
@@ -228,7 +228,7 @@
 
 ACR_DECLARE(int) ACR_SemaphoreRelease(JNIEnv *env, int sema)
 {
-    int rc;
+    int rc = 0;
     acr_semaphore_t *s = (acr_semaphore_t *)ACR_IOH(sema);
 
     if (IS_INVALID_HANDLE(s) || ACR_IOH_TYPE(sema) != ACR_DT_SEMAPHORE) {

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/signals.c Sun Aug 16 05:50:02 2009
@@ -35,15 +35,6 @@
 #define ACR_NUMSIG  33
 #endif
 
-#if defined(HPUX11)
-static char *strsignal(int signum)
-{
-    static char buf[32];
-    sprintf(buf, "Signal %d", signum);
-    return buf;
-}
-#endif
-
 void acr_SignalsInit()
 {
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c?rev=804626&r1=804625&r2=804626&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c Sun Aug 16 05:50:02 2009
@@ -34,42 +34,15 @@
 #include "acr_crypto.h"
 #include "acr_signals.h"
 
-#define ACR_NUMSIG _NSIG
-
-static const char *signal_description[] = {
-    "Signal 0",
-    "Hangup",
-    "Interrupt",
-    "Quit",
-    "Illegal instruction (not reset when caught)",
-    "Trace trap (not reset when caught)",
-    "Abort()",
-    "EMT instruction",
-    "Floating point exception",
-    "Kill (cannot be caught or ignored)",
-    "Bus error",
-    "Segmentation violation",
-    "Bad argument to system call",
-    "Write on a pipe with no one to read it",
-    "Alarm clock",
-    "Software termination signal from kill",
-    "Urgent condition on IO channel",
-    "Sendable stop signal not from tty",
-    "Stop signal from tty",
-    "Continue a stopped process",
-    "To parent on child stop or exit",
-    "To readers pgrp upon background tty read",
-    "Like TTIN for output if (tp->t_local&LTOSTOP)",
-    "Input/output possible signal",
-    "Exceeded CPU time limit",
-    "Exceeded file size limit",
-    "Virtual time alarm",
-    "Profiling time alarm",
-    "Window size changes",
-    "Information request",
-    "User defined signal 1",
-    "User defined signal 2"
-};
+#if defined(NSIG)
+#define ACR_NUMSIG  NSIG
+#elif defined(_NSIG)
+#define ACR_NUMSIG  _NSIG
+#elif defined(__NSIG)
+#define ACR_NUMSIG  __NSIG
+#else
+#define ACR_NUMSIG  33
+#endif
 
 void acr_SignalsInit()
 {
@@ -78,10 +51,11 @@
 
 ACR_DECLARE(const char *) ACR_SignalDescription(int signum)
 {
-    if (signum >= 0 && signum < ACR_NUMSIG)
-        return signal_description[signum];
+    char *desc;
+
+    if ((desc = strsignal(signum)))
+        return desc;
     else
         return "Unknown signal (number)";
 }
 
-

Added: commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c?rev=804626&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c Sun Aug 16 05:50:02 2009
@@ -0,0 +1,86 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *
+ * strsignal.c
+ *      Portable signal descriptions
+ *
+ */
+
+#include "acr.h"
+#include "acr_private.h"
+#include "acr_arch.h"
+
+#if defined(ACR_WANT_STRSIGNAL)
+
+#define ACR_NUMSIGS 32
+/*
+ * This table presumes that all signals have
+ * the same number, whuch should be true
+ * for any posix system.
+ * TODO: Create a mapping table from real signal
+ *       number to our description table if that's a problem.
+ */
+static const char *signal_description[] = {
+    "Signal #0",
+    "Hangup",
+    "Interrupt",
+    "Quit",
+    "Illegal instruction",
+    "Trace trap",
+    "Abort",
+    "EMT instruction",
+    "Floating point exception",
+    "Kill",
+    "Bus error",
+    "Segmentation violation",
+    "Bad argument to system call",
+    "Write on a pipe with no one to read it",
+    "Alarm clock",
+    "Software termination signal from kill",
+    "Urgent condition on IO channel",
+    "Stopped (signal)",
+    "Stop signal from tty",
+    "Continue a stopped process",
+    "To parent on child stop or exit",
+    "Stopped (tty input)",
+    "Stopped (tty output)",
+    "Input/output possible signal",
+    "Exceeded CPU time limit",
+    "Exceeded file size limit",
+    "Virtual time alarm",
+    "Profiling time alarm",
+    "Window size changes",
+    "Information request",
+    "User defined signal #1",
+    "User defined signal #2",
+    NULL
+};
+
+char *strsignal(int signum)
+{
+    if (signum >= 0 && signum < ACR_NUMSIGS)
+        return (char *)signal_description[signum];
+    else
+        return NULL;
+}
+#else
+
+UNUSED_SOURCE_FILE(strsignal);
+
+#endif /* ACR_WANT_STRSIGNAL */
+

Propchange: commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c
------------------------------------------------------------------------------
    svn:eol-style = native