apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/threadproc/win32 proc.c
Date Wed, 23 Jun 2004 15:07:59 GMT
trawick     2004/06/23 08:07:59

  Modified:    .        Tag: APR_0_9_BRANCH CHANGES
               include  Tag: APR_0_9_BRANCH apr_thread_proc.h
               threadproc/os2 Tag: APR_0_9_BRANCH proc.c
               threadproc/unix Tag: APR_0_9_BRANCH proc.c
               threadproc/win32 Tag: APR_0_9_BRANCH proc.c
  Log:
  backport this from 1.0-dev:
  
  *) Add command type APR_SHELLCMD_ENV for creating a process
     which is started by the shell and which inherits the parent's
     environment variables.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.426.2.24 +4 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.426.2.23
  retrieving revision 1.426.2.24
  diff -u -r1.426.2.23 -r1.426.2.24
  --- CHANGES	22 Jun 2004 08:45:04 -0000	1.426.2.23
  +++ CHANGES	23 Jun 2004 15:07:58 -0000	1.426.2.24
  @@ -1,5 +1,9 @@
   Changes with APR 0.9.5
   
  +  *) Add command type APR_SHELLCMD_ENV for creating a process
  +     which is started by the shell and which inherits the parent's
  +     environment variables.  [Jeff Trawick]
  +
     *) Change default inter-process locking mechanisms: POSIX semaphores
        and pthread cross-process mutexes are not used by default; on 
        Solaris, fcntl locks are used by default.  [Joe Orton]
  
  
  
  No                   revision
  No                   revision
  1.98.2.2  +6 -3      apr/include/apr_thread_proc.h
  
  Index: apr_thread_proc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_thread_proc.h,v
  retrieving revision 1.98.2.1
  retrieving revision 1.98.2.2
  diff -u -r1.98.2.1 -r1.98.2.2
  --- apr_thread_proc.h	13 Feb 2004 09:33:45 -0000	1.98.2.1
  +++ apr_thread_proc.h	23 Jun 2004 15:07:58 -0000	1.98.2.2
  @@ -45,7 +45,10 @@
       APR_SHELLCMD,       /**< use the shell to invoke the program */
       APR_PROGRAM,        /**< invoke the program directly, no copied env */
       APR_PROGRAM_ENV,    /**< invoke the program, replicating our environment */
  -    APR_PROGRAM_PATH    /**< find program on PATH, use our environment */
  +    APR_PROGRAM_PATH,   /**< find program on PATH, use our environment */
  +    APR_SHELLCMD_ENV    /**< use the shell to invoke the program,
  +                          *   replicating our environment
  +                          */
   } apr_cmdtype_e;
   
   typedef enum {
  @@ -511,8 +514,8 @@
    *             one should be the program name.
    * @param env The new environment table for the new process.  This 
    *            should be a list of NULL-terminated strings. This argument
  - *            is ignored for APR_PROGRAM_ENV and APR_PROGRAM_PATH types
  - *            of commands.
  + *            is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and
  + *            APR_SHELLCMD_ENV types of commands.
    * @param attr the procattr we should use to determine how to create the new
    *         process
    * @param cont The pool to use. 
  
  
  
  No                   revision
  No                   revision
  1.59.2.2  +3 -1      apr/threadproc/os2/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/os2/proc.c,v
  retrieving revision 1.59.2.1
  retrieving revision 1.59.2.2
  diff -u -r1.59.2.1 -r1.59.2.2
  --- proc.c	13 Feb 2004 09:33:54 -0000	1.59.2.1
  +++ proc.c	23 Jun 2004 15:07:59 -0000	1.59.2.2
  @@ -326,7 +326,9 @@
   
       /* ### how to handle APR_PROGRAM_ENV and APR_PROGRAM_PATH? */
   
  -    if (attr->cmdtype == APR_SHELLCMD || strcasecmp(extension, ".cmd") == 0) {
  +    if (attr->cmdtype == APR_SHELLCMD ||
  +        attr->cmdtype == APR_SHELLCMD_ENV ||
  +        strcasecmp(extension, ".cmd") == 0) {
           strcpy(interpreter, "#!" SHELL_PATH);
           extra_arg = "/C";
       } else if (stricmp(extension, ".exe") != 0) {
  
  
  
  No                   revision
  No                   revision
  1.67.2.2  +8 -2      apr/threadproc/unix/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/unix/proc.c,v
  retrieving revision 1.67.2.1
  retrieving revision 1.67.2.2
  diff -u -r1.67.2.1 -r1.67.2.2
  --- proc.c	13 Feb 2004 09:33:54 -0000	1.67.2.1
  +++ proc.c	23 Jun 2004 15:07:59 -0000	1.67.2.2
  @@ -382,7 +382,8 @@
               exit(-1);   /* We have big problems, the child should exit. */
           }
   
  -        if (attr->cmdtype == APR_SHELLCMD) {
  +        if (attr->cmdtype == APR_SHELLCMD ||
  +            attr->cmdtype == APR_SHELLCMD_ENV) {
               int onearg_len = 0;
               const char *newargs[4];
   
  @@ -433,7 +434,12 @@
                   apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
               }
   
  -            execve(SHELL_PATH, (char * const *) newargs, (char * const *)env);
  +            if (attr->cmdtype == APR_SHELLCMD) {
  +                execve(SHELL_PATH, (char * const *) newargs, (char * const *)env);
  +            }
  +            else {
  +                execv(SHELL_PATH, (char * const *)newargs);
  +            }
           }
           else if (attr->cmdtype == APR_PROGRAM) {
               if (attr->detached) {
  
  
  
  No                   revision
  No                   revision
  1.90.2.2  +4 -2      apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
  retrieving revision 1.90.2.1
  retrieving revision 1.90.2.2
  diff -u -r1.90.2.1 -r1.90.2.2
  --- proc.c	13 Feb 2004 09:33:55 -0000	1.90.2.1
  +++ proc.c	23 Jun 2004 15:07:59 -0000	1.90.2.2
  @@ -342,7 +342,7 @@
       }
   
   #ifndef _WIN32_WCE
  -    if (attr->cmdtype == APR_SHELLCMD) {
  +    if (attr->cmdtype == APR_SHELLCMD || attr->cmdtype == APR_SHELLCMD_ENV) {
           char *shellcmd = getenv("COMSPEC");
           if (!shellcmd) {
               return APR_EINVAL;
  @@ -438,8 +438,10 @@
           }
       }
   
  -    if (!env || attr->cmdtype == APR_PROGRAM_ENV) 
  +    if (!env || attr->cmdtype == APR_PROGRAM_ENV ||
  +        attr->cmdtype == APR_SHELLCMD_ENV) {
           pEnvBlock = NULL;
  +    }
       else {
           apr_size_t iEnvBlockLen;
           /*
  
  
  

Mime
View raw message