Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 67715 invoked from network); 15 Mar 2010 06:36:09 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Mar 2010 06:36:09 -0000 Received: (qmail 27707 invoked by uid 500); 15 Mar 2010 06:35:24 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 27613 invoked by uid 500); 15 Mar 2010 06:35:23 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 27606 invoked by uid 99); 15 Mar 2010 06:35:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Mar 2010 06:35:23 +0000 X-ASF-Spam-Status: No, hits=-1017.7 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Mar 2010 06:35:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EB98923889B3; Mon, 15 Mar 2010 06:35:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100315063501.EB98923889B3@eris.apache.org> 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 ="); 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) {