commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r923078 - in /commons/proper/daemon/trunk/src/native/unix/native: arguments.c arguments.h jsvc-unix.c
Date Mon, 15 Mar 2010 06:35:01 GMT
Author: mturk
Date: Mon Mar 15 06:35:01 2010
New Revision: 923078

URL: http://svn.apache.org/viewvc?rev=923078&view=rev
Log:
Fix DAEMON-140. Add missing Java6 parameters

Modified:
    commons/proper/daemon/trunk/src/native/unix/native/arguments.c
    commons/proper/daemon/trunk/src/native/unix/native/arguments.h
    commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c

Modified: commons/proper/daemon/trunk/src/native/unix/native/arguments.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/arguments.c?rev=923078&r1=923077&r2=923078&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/arguments.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/arguments.c Mon Mar 15 06:35:01 2010
@@ -43,28 +43,31 @@ static arg_data *parse(int argc, char *a
     /* Create the default command line arguments */
     args = (arg_data *)malloc(sizeof(arg_data));
     args->pidf = "/var/run/jsvc.pid"; /* The default PID file */
-    args->user = NULL;            /* No user switching by default */
-    args->dtch = true;            /* Do detach from parent */
-    args->vers = false;           /* Don't display version */
-    args->help = false;           /* Don't display help */
-    args->chck = false;           /* Don't do a check-only startup */
-    args->stop = false;           /* Stop a running jsvc */
-    args->wait = 0;               /* Wait until jsvc has started the JVM */
+    args->user    = NULL;         /* No user switching by default */
+    args->dtch    = true;         /* Do detach from parent */
+    args->vers    = false;        /* Don't display version */
+    args->help    = false;        /* Don't display help */
+    args->chck    = false;        /* Don't do a check-only startup */
+    args->stop    = false;        /* Stop a running jsvc */
+    args->wait    = 0;            /* Wait until jsvc has started the JVM */
     args->install = false;        /* Don't install as a service */
     args->remove  = false;        /* Don't remove the installed service */
     args->service = false;        /* Don't run as a service */
     args->name    = NULL;         /* No VM version name */
     args->home    = NULL;         /* No default JAVA_HOME */
     args->onum    = 0;            /* Zero arguments, but let's have some room */
-    args->opts = (char **)malloc(argc * sizeof(char *));
     args->clas    = NULL;         /* No class predefined */
     args->anum    = 0;            /* Zero class specific arguments but make room*/
     args->outfile = "/dev/null";   /* Swallow by default */
     args->errfile = "/dev/null";   /* Swallow by default */
     args->redirectstdin = true;    /* Redirect stdin to /dev/null by default */
-    args->args = (char **)malloc(argc*sizeof(char *));
     args->procname = "jsvc.exec";
 
+    if (!(args->args = (char **)malloc(argc * sizeof(char *))))
+        return NULL;
+    if (!(args->opts = (char **)malloc(argc * sizeof(char *))))
+        return NULL;
+
     /* Set up the command name */
     cmnd = strrchr(argv[0],'/');
     if (cmnd == NULL)
@@ -78,7 +81,7 @@ static arg_data *parse(int argc, char *a
 
         if (!strcmp(argv[x], "-cp") ||
             !strcmp(argv[x], "-classpath")) {
-            temp = optional(argc,argv,x++);
+            temp = optional(argc, argv, x++);
             if (temp == NULL) {
                 log_error("Invalid classpath specified");
                 return NULL;
@@ -90,21 +93,21 @@ static arg_data *parse(int argc, char *a
 
         }
         else if (!strcmp(argv[x], "-jvm")) {
-            args->name = optional(argc,argv,x++);
+            args->name = optional(argc, argv, x++);
             if (args->name == NULL) {
                 log_error("Invalid Java VM name specified");
                 return NULL;
             }
         }
         else if (!strcmp(argv[x], "-home")) {
-            args->home = optional(argc,argv,x++);
+            args->home = optional(argc, argv, x++);
             if (args->home == NULL) {
                 log_error("Invalid Java Home specified");
                 return NULL;
             }
         }
         else if (!strcmp(argv[x], "-user")) {
-            args->user = optional(argc,argv,x++);
+            args->user = optional(argc, argv, x++);
             if (args->user == NULL) {
                 log_error("Invalid user name specified");
                 return NULL;
@@ -114,6 +117,9 @@ static arg_data *parse(int argc, char *a
             args->vers = true;
             args->dtch = false;
         }
+        else if (!strcmp(argv[x], "-showversion")) {
+            args->vershow = true;
+        }
         else if (!strcmp(argv[x], "-?") ||
                  !strcmp(argv[x], "-help") ||
                  !strcmp(argv[x], "--help")) {
@@ -160,7 +166,7 @@ static arg_data *parse(int argc, char *a
             args->remove = true;
         }
         else if (!strcmp(argv[x], "-pidfile")) {
-            args->pidf = optional(argc,argv,x++);
+            args->pidf = optional(argc, argv, x++);
             if (args->pidf == NULL) {
                 log_error("Invalid PID file specified");
                 return NULL;
@@ -180,11 +186,11 @@ static arg_data *parse(int argc, char *a
                 return NULL;
             }
         }
-        else if (strstr(argv[x], "-verbose") == argv[x]) {
+        else if (!strncmp(argv[x], "-verbose", 8)) {
             args->opts[args->onum++] = strdup(argv[x]);
         }
 #ifdef HAVE_KAFFEVM
-        else if (strstr(argv[x], "-vmdebug") == argv[x]) {
+        else if (!strncmp(argv[x], "-vmdebug", 8)) {
             args->opts[args->onum++] = strdup(argv[x]);
             temp = optional(argc,argv,x++);
             if (temp == NULL) {
@@ -198,7 +204,7 @@ static arg_data *parse(int argc, char *a
             log_error("Parameter -D must be followed by <name>=<value>");
             return NULL;
         }
-        else if (strstr(argv[x], "-D") == argv[x]) {
+        else if (!strncmp(argv[x], "-D", 2)) {
             temp = strchr(argv[x], '=');
             if (temp == argv[x] + 2) {
                 log_error("A property name must be specified before '='");
@@ -206,10 +212,31 @@ static arg_data *parse(int argc, char *a
             }
             args->opts[args->onum++] = strdup(argv[x]);
         }
-        else if (strstr(argv[x], "-X") == argv[x]) {
+        else if (!strncmp(argv[x], "-X", 2)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-ea", 3)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-enableassertions", 17)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-da", 3)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-disableassertions", 18)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-esa")) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-enablesystemassertions")) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-dsa")) {
             args->opts[args->onum++] = strdup(argv[x]);
         }
-        else if (strstr(argv[x], "-ea") == argv[x]) {
+        else if (!strcmp(argv[x], "-disablesystemassertions")) {
             args->opts[args->onum++] = strdup(argv[x]);
         }
         else if (!strcmp(argv[x], "-procname")) {
@@ -219,13 +246,13 @@ static arg_data *parse(int argc, char *a
               return NULL;
             }
         }
-        else if (strstr(argv[x], "-agentlib:") == argv[x]) {
+        else if (!strncmp(argv[x], "-agentlib:", 10)) {
             args->opts[args->onum++] = strdup(argv[x]);
         }
-        else if (strstr(argv[x], "-agentpath:") == argv[x]) {
+        else if (!strncmp(argv[x], "-agentpath:", 11)) {
             args->opts[args->onum++] = strdup(argv[x]);
         }
-        else if (strstr(argv[x], "-javaagent:") == argv[x]) {
+        else if (!strncmp(argv[x], "-javaagent:", 11)) {
             args->opts[args->onum++] = strdup(argv[x]);
         }
         else if (*argv[x] == '-') {

Modified: commons/proper/daemon/trunk/src/native/unix/native/arguments.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/arguments.h?rev=923078&r1=923077&r2=923078&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/arguments.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/arguments.h Mon Mar 15 06:35:01 2010
@@ -49,6 +49,8 @@ typedef struct {
     bool dtch;
     /** Wether to print the VM version number or not. */
     bool vers;
+    /** Show the VM version and continue. */
+    bool vershow;
     /** Wether to display the help page or not. */
     bool help;
     /** Only check environment without running the service. */

Modified: commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c?rev=923078&r1=923077&r2=923078&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c Mon Mar 15 06:35:01 2010
@@ -584,6 +584,12 @@ static int child(arg_data *args, home_da
         else
             return 0;
     }
+    /* Check wether we need to dump the VM version */
+    else if (args->vershow == true) {
+        if (java_version() != true) {
+            return 7;
+        }
+    }
 
     /* Do we have to do a "check-only" initialization? */
     if (args->chck == true) {



Mime
View raw message