apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: apr/threadproc/win32 proc.c
Date Fri, 05 Jul 2002 17:58:10 GMT
brane       2002/07/05 10:58:10

  Modified:    include  apr_file_io.h apr_inherit.h apr_network_io.h
               include/arch/unix inherit.h
               include/arch/win32 inherit.h
               network_io/win32 sockets.c
               threadproc/win32 proc.c
  Log:
  Changed the return values of the apr_*_inherit_(un)set functions from
  void to apr_status_t.  The deprecated versios, apr_*_(un)set_inherit,
  are still void, so that we don't inadvertently break code that uses them.
  
  Updated all uses of apr_file_inherit_set in threadproc/win32/proc.c,
  and replaced make_handle_private with apr_file_inherit_unset.
  
  Revision  Changes    Path
  1.130     +5 -5      apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_file_io.h,v
  retrieving revision 1.129
  retrieving revision 1.130
  diff -u -r1.129 -r1.130
  --- apr_file_io.h	2 Jul 2002 23:40:37 -0000	1.129
  +++ apr_file_io.h	5 Jul 2002 17:58:09 -0000	1.130
  @@ -682,16 +682,16 @@
    * @param file The file to enable inheritance.
    *
    */
  -APR_DECLARE(void) apr_file_inherit_set(apr_file_t *file);
  +APR_DECLARE_INHERIT_SET(file);
  +
  +/** @deprecated @see apr_file_inherit_set */
  +APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
   
   /**
    * Unset a file from being inherited by child processes.
    * @param file The file to disable inheritance.
    */
  -APR_DECLARE(void) apr_file_inherit_unset(apr_file_t *file);
  -
  -/** @deprecated @see apr_file_inherit_set */
  -APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
  +APR_DECLARE_INHERIT_UNSET(file);
   
   /** @deprecated @see apr_file_inherit_unset */
   APR_DECLARE(void) apr_file_unset_inherit(apr_file_t *file);
  
  
  
  1.11      +2 -2      apr/include/apr_inherit.h
  
  Index: apr_inherit.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_inherit.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- apr_inherit.h	8 Jun 2002 22:32:11 -0000	1.10
  +++ apr_inherit.h	5 Jul 2002 17:58:10 -0000	1.11
  @@ -75,13 +75,13 @@
    * @param name Set Inheritance for this Socket/File Handle
    */
   #define APR_DECLARE_INHERIT_SET(name) \
  -    APR_DECLARE(void) apr_##name##_inherit_set(apr_##name##_t *name)
  +    APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *name)
   
   /**
    * @param name Unset Inheritance for this Socket/File Handle
    */
   #define APR_DECLARE_INHERIT_UNSET(name) \
  -    APR_DECLARE(void) apr_##name##_inherit_unset(apr_##name##_t *name)
  +    APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *name)
   
   #ifdef __cplusplus
   }
  
  
  
  1.124     +2 -2      apr/include/apr_network_io.h
  
  Index: apr_network_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_network_io.h,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- apr_network_io.h	9 Jun 2002 05:01:40 -0000	1.123
  +++ apr_network_io.h	5 Jul 2002 17:58:10 -0000	1.124
  @@ -811,7 +811,7 @@
    * Set a socket to be inherited by child processes.
    * @param socket The socket to enable inheritance.
    */
  -APR_DECLARE(void) apr_socket_inherit_set(apr_socket_t *skt);
  +APR_DECLARE_INHERIT_SET(socket);
   
   /** @deprecated @see apr_socket_inherit_set */
   APR_DECLARE(void) apr_socket_set_inherit(apr_socket_t *skt);
  @@ -820,7 +820,7 @@
    * Unset a socket from being inherited by child processes.
    * @param socket The socket to disable inheritance.
    */
  -APR_DECLARE(void) apr_socket_inherit_unset(apr_socket_t *skt);
  +APR_DECLARE_INHERIT_UNSET(socket);
   
   /** @deprecated @see apr_socket_inherit_unset */
   APR_DECLARE(void) apr_socket_unset_inherit(apr_socket_t *skt);
  
  
  
  1.11      +5 -3      apr/include/arch/unix/inherit.h
  
  Index: inherit.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/inherit.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- inherit.h	8 Jun 2002 22:32:11 -0000	1.10
  +++ inherit.h	5 Jul 2002 17:58:10 -0000	1.11
  @@ -57,16 +57,17 @@
   
   #include "apr_inherit.h"
   
  -#define APR_INHERIT    (2^24)    /* Must not conflicts with other bits */
  +#define APR_INHERIT (1 << 24)    /* Must not conflict with other bits */
   
   #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
  -void apr_##name##_inherit_set(apr_##name##_t *name)                 \
  +apr_status_t apr_##name##_inherit_set(apr_##name##_t *name)         \
   {                                                                   \
       if (!(name->flag & APR_INHERIT)) {                              \
           name->flag |= APR_INHERIT;                                  \
           apr_pool_child_cleanup_set(name->pool, (void *)name,        \
                                      cleanup, apr_pool_cleanup_null); \
       }                                                               \
  +    return APR_SUCCESS;                                             \
   }                                                                   \
   /* Deprecated */                                                    \
   void apr_##name##_set_inherit(apr_##name##_t *name)                 \
  @@ -75,13 +76,14 @@
   }
   
   #define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup)      \
  -void apr_##name##_inherit_unset(apr_##name##_t *name)               \
  +apr_status_t apr_##name##_inherit_unset(apr_##name##_t *name)       \
   {                                                                   \
       if (name->flag & APR_INHERIT) {                                 \
           name->flag &= ~APR_INHERIT;                                 \
           apr_pool_child_cleanup_set(name->pool, (void *)name,        \
                                      cleanup, cleanup);               \
       }                                                               \
  +    return APR_SUCCESS;                                             \
   }                                                                   \
   /* Deprecated */                                                    \
   void apr_##name##_unset_inherit(apr_##name##_t *name)               \
  
  
  
  1.4       +11 -11    apr/include/arch/win32/inherit.h
  
  Index: inherit.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/inherit.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- inherit.h	3 Jul 2002 00:16:55 -0000	1.3
  +++ inherit.h	5 Jul 2002 17:58:10 -0000	1.4
  @@ -57,17 +57,17 @@
   
   #include "apr_inherit.h"
   
  -#define APR_INHERIT    (2^24)    /* Must not conflicts with other bits */
  +#define APR_INHERIT (1 << 24)    /* Must not conflict with other bits */
   
   #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
  -APR_DECLARE(void) apr_##name##_inherit_set(apr_##name##_t *name)    \
  +APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *name) \
   {                                                                   \
       IF_WIN_OS_IS_UNICODE                                            \
       {                                                               \
           if (!SetHandleInformation(name->filehand,                   \
                                     HANDLE_FLAG_INHERIT,              \
                                     HANDLE_FLAG_INHERIT))             \
  -            return /* apr_get_os_error() */;                        \
  +            return apr_get_os_error();                              \
       }                                                               \
       ELSE_WIN_OS_IS_ANSI                                             \
       {                                                               \
  @@ -75,26 +75,26 @@
           if (!DuplicateHandle(hproc, name->filehand,                 \
                                hproc, &temp, 0, TRUE,                 \
                                DUPLICATE_SAME_ACCESS))                \
  -            return /* apr_get_os_error() */;                        \
  +            return apr_get_os_error();                              \
           CloseHandle(name->filehand);                                \
           name->filehand = temp;                                      \
       }                                                               \
  -    return /* APR_SUCCESS */;                                       \
  +    return APR_SUCCESS;                                             \
   }                                                                   \
   /* Deprecated */                                                    \
   APR_DECLARE(void) apr_##name##_set_inherit(apr_##name##_t *name)    \
   {                                                                   \
  -    /* return */ apr_##name##_inherit_set(name);                    \
  +    apr_##name##_inherit_set(name);                                 \
   }
   
   #define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup)      \
  -APR_DECLARE(void) apr_##name##_inherit_unset(apr_##name##_t *name)  \
  +APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *name) \
   {                                                                   \
       IF_WIN_OS_IS_UNICODE                                            \
       {                                                               \
           if (!SetHandleInformation(name->filehand,                   \
                                     HANDLE_FLAG_INHERIT, 0))          \
  -            return /* apr_get_os_error() */;                        \
  +            return apr_get_os_error();                              \
       }                                                               \
       ELSE_WIN_OS_IS_ANSI                                             \
       {                                                               \
  @@ -102,16 +102,16 @@
           if (!DuplicateHandle(hproc, name->filehand,                 \
                                hproc, &temp, 0, FALSE,                \
                                DUPLICATE_SAME_ACCESS))                \
  -            return /* apr_get_os_error() */;                        \
  +            return apr_get_os_error();                              \
           CloseHandle(name->filehand);                                \
           name->filehand = temp;                                      \
       }                                                               \
  -    return /* APR_SUCCESS */;                                       \
  +    return APR_SUCCESS;                                             \
   }                                                                   \
   /* Deprecated */                                                    \
   APR_DECLARE(void) apr_##name##_unset_inherit(apr_##name##_t *name)  \
   {                                                                   \
  -    /* return */ apr_##name##_inherit_unset(name);                  \
  +    apr_##name##_inherit_unset(name);                               \
   }
   
   #endif	/* ! INHERIT_H */
  
  
  
  1.80      +6 -6      apr/network_io/win32/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sockets.c,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- sockets.c	3 Jul 2002 00:16:55 -0000	1.79
  +++ sockets.c	5 Jul 2002 17:58:10 -0000	1.80
  @@ -430,22 +430,22 @@
    * This is not trivial to implement.
    */
   
  -APR_DECLARE(void) apr_socket_inherit_set(apr_socket_t *socket)    
  +APR_DECLARE(apr_status_t) apr_socket_inherit_set(apr_socket_t *socket)    
   {    
  -    return /* APR_ENOTIMPL */;
  +    return APR_ENOTIMPL;
   }    
   /* Deprecated */    
   APR_DECLARE(void) apr_socket_set_inherit(apr_socket_t *socket)    
   {    
  -    /* return */ apr_socket_inherit_set(socket);    
  +    apr_socket_inherit_set(socket);    
   }
   
  -APR_DECLARE(void) apr_socket_inherit_unset(apr_socket_t *socket)    
  +APR_DECLARE(apr_status_t) apr_socket_inherit_unset(apr_socket_t *socket)    
   {    
  -    return /* APR_ENOTIMPL */;
  +    return APR_ENOTIMPL;
   }    
   /* Deprecated */    
   APR_DECLARE(void) apr_socket_unset_inherit(apr_socket_t *socket)    
   {    
  -    /* return */ apr_socket_inherit_unset(socket);    
  +    apr_socket_inherit_unset(socket);    
   }
  
  
  
  1.80      +6 -30     apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- proc.c	3 Jul 2002 00:23:39 -0000	1.79
  +++ proc.c	5 Jul 2002 17:58:10 -0000	1.80
  @@ -129,30 +129,6 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t make_handle_private(apr_file_t *file)
  -{
  -#ifdef _WIN32_WCE
  -    return APR_ENOTIMPL;
  -#else
  -    HANDLE hproc = GetCurrentProcess();
  -    HANDLE filehand = file->filehand;
  -
  -    /* Create new non-inheritable versions of handles that
  -     * the child process doesn't care about. Otherwise, the child
  -     * inherits these handles; resulting in non-closeable handles
  -     * to the respective pipes.
  -     */
  -    if (!DuplicateHandle(hproc, filehand,
  -                         hproc, &file->filehand, 0,
  -                         FALSE, DUPLICATE_SAME_ACCESS))
  -        return apr_get_os_error();
  -    /* 
  -     * Close the inerhitable handle we don't need anymore.
  -     */
  -    CloseHandle(filehand);
  -    return APR_SUCCESS;
  -#endif
  -}
   
   APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
                                                apr_int32_t in, 
  @@ -165,19 +141,19 @@
           stat = open_nt_process_pipe(&attr->child_in, &attr->parent_in, in,
                                       attr->pool);
           if (stat == APR_SUCCESS)
  -            stat = make_handle_private(attr->parent_in);
  +            stat = apr_file_inherit_unset(attr->parent_in);
       }
       if (out && stat == APR_SUCCESS) {
           stat = open_nt_process_pipe(&attr->parent_out, &attr->child_out,
out,
                                       attr->pool);
           if (stat == APR_SUCCESS)
  -            stat = make_handle_private(attr->parent_out);
  +            stat = apr_file_inherit_unset(attr->parent_out);
       }
       if (err && stat == APR_SUCCESS) {
           stat = open_nt_process_pipe(&attr->parent_err, &attr->child_err,
err,
                                       attr->pool);
           if (stat == APR_SUCCESS)
  -            stat = make_handle_private(attr->parent_err);
  +            stat = apr_file_inherit_unset(attr->parent_err);
       }
       return stat;
   }
  @@ -195,7 +171,7 @@
               rv = apr_file_dup2(attr->child_in, child_in, attr->pool);
   
           if (rv == APR_SUCCESS)
  -            apr_file_inherit_set(attr->child_in);
  +            rv = apr_file_inherit_set(attr->child_in);
       }
   
       if (parent_in && rv == APR_SUCCESS) {
  @@ -221,7 +197,7 @@
               rv = apr_file_dup2(attr->child_out, child_out, attr->pool);
   
           if (rv == APR_SUCCESS)
  -            apr_file_inherit_set(attr->child_out);
  +            rv = apr_file_inherit_set(attr->child_out);
       }
   
       if (parent_out && rv == APR_SUCCESS) {
  @@ -247,7 +223,7 @@
               rv = apr_file_dup2(attr->child_err, child_err, attr->pool);
   
           if (rv == APR_SUCCESS)
  -            apr_file_inherit_set(attr->child_err);
  +            rv = apr_file_inherit_set(attr->child_err);
       }
   
       if (parent_err && rv == APR_SUCCESS) {
  
  
  

Mime
View raw message