apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject [PATCH] Add return value to apr_proc_wait was Re: FW: Updating svn.collab.net
Date Thu, 20 Sep 2001 06:14:00 GMT
On Thu, Sep 20, 2001 at 12:37:55AM +0200, Sander Striker wrote:
> [forwarded thread from dev@subversion.tigris.org]
> 
> -----Original Message-----
> From: Kevin Pilch-Bisson [mailto:kevin@pilch-bisson.net]
> Sent: 19 September 2001 21:46
> To: cmpilato@collab.net
> Cc: Greg Stein; Sander Striker; dev@subversion.tigris.org
> Subject: Re: Updating svn.collab.net
> 
> 
> On Wed, Sep 19, 2001 at 01:47:32PM -0500, cmpilato@collab.net wrote:
> > Greg Stein <gstein@lyra.org> writes:
> >
> > > IMO, it should be a repository-defined attribute, rather than a
> client-side
> > > issue. Of course, clients may also want to enforce it, but that is
> beside
> > > the point.
> >
> > Couldn't this be repository-side enforced with a pre-commit hook that
> > makes sure that there's not an empty log message?
> >
> Well, not at present, since commits are going through regardless of the
> value they return.  There doesn't seem to be a way to get the process'
> return value from apr. :(

How would this patch work?  This seems like a reasonable change.

Win32 doesn't implement wait_all from what I can tell, so I'm not
sure how to get the return value.  OtherBill or Ryan can probably
figure this out.  -- justin

Index: include/apr_thread_proc.h
===================================================================
RCS file: /home/cvs/apr/include/apr_thread_proc.h,v
retrieving revision 1.74
diff -u -r1.74 apr_thread_proc.h
--- include/apr_thread_proc.h	2001/09/09 06:03:05	1.74
+++ include/apr_thread_proc.h	2001/09/20 06:02:58
@@ -481,6 +481,9 @@
 /**
  * Wait for a child process to die
  * @param proc The process handle that corresponds to the desired child process 
+ * @param status The returned exit status of the child, if a child process dies
+ *               On platforms that don't support obtaining this information, 
+ *               the status parameter will be returned as APR_ENOTIMPL.
  * @param waithow How should we wait.  One of:
  * <PRE>
  *            APR_WAIT   -- block until the child process dies.
@@ -494,6 +497,7 @@
  * </PRE>
  */
 APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, 
+                                        apr_wait_t *status,
                                         apr_wait_how_e waithow);
 
 /**
Index: threadproc/unix/proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/unix/proc.c,v
retrieving revision 1.47
diff -u -r1.47 proc.c
--- threadproc/unix/proc.c	2001/08/10 21:04:48	1.47
+++ threadproc/unix/proc.c	2001/09/20 06:02:58
@@ -380,23 +380,24 @@
 } 
 
 APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, 
+                                        apr_wait_t *status,
                                         apr_wait_how_e waithow)
 {
-    pid_t status;
+    pid_t pstatus;
 
     if (waithow == APR_WAIT) {
-        if ((status = waitpid(proc->pid, NULL, WUNTRACED)) > 0) {
+        if ((pstatus = waitpid(proc->pid, status, WUNTRACED)) > 0) {
             return APR_CHILD_DONE;
         }
-        else if (status == 0) {
+        else if (pstatus == 0) {
             return APR_CHILD_NOTDONE;
         }
         return errno;
     }
-    if ((status = waitpid(proc->pid, NULL, WUNTRACED | WNOHANG)) > 0) {
+    if ((pstatus = waitpid(proc->pid, status, WUNTRACED | WNOHANG)) > 0) {
         return APR_CHILD_DONE;
     }
-    else if (status == 0) {
+    else if (pstatus == 0) {
         return APR_CHILD_NOTDONE;
     }
     return errno;
Index: threadproc/beos/proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/beos/proc.c,v
retrieving revision 1.39
diff -u -r1.39 proc.c
--- threadproc/beos/proc.c	2001/09/11 13:33:39	1.39
+++ threadproc/beos/proc.c	2001/09/20 06:02:58
@@ -299,16 +299,17 @@
 } 
 
 APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, 
+                                        apr_wait_t *status,
                                         apr_wait_how_e wait)
 {
-    status_t exitval, rv;
+    status_t rv;
 
     if (!proc)
         return APR_ENOPROC;
     /* when we run processes we are actually running threads, so here
        we'll wait on the thread dying... */
     if (wait == APR_WAIT) {
-        if ((rv = wait_for_thread(proc->pid, &exitval)) == B_OK) {
+        if ((rv = wait_for_thread(proc->pid, status)) == B_OK) {
             return APR_CHILD_DONE;
         }
         return rv;
Index: threadproc/netware/proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/netware/proc.c,v
retrieving revision 1.1
diff -u -r1.1 proc.c
--- threadproc/netware/proc.c	2001/08/02 20:29:14	1.1
+++ threadproc/netware/proc.c	2001/09/20 06:02:58
@@ -393,6 +393,7 @@
 } 
 
 apr_status_t apr_proc_wait(apr_proc_t *proc, 
+                           apr_wait_t *status,
                            apr_wait_how_e waithow)
 {
 #if 0
Index: threadproc/os2/proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/os2/proc.c,v
retrieving revision 1.44
diff -u -r1.44 proc.c
--- threadproc/os2/proc.c	2001/08/23 16:42:27	1.44
+++ threadproc/os2/proc.c	2001/09/20 06:02:58
@@ -527,6 +527,7 @@
 
 
 APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
+                                        apr_wait_t *status,
                                         apr_wait_how_e wait)
 {
     RESULTCODES codes;
@@ -538,6 +539,8 @@
 
     rc = DosWaitChild(DCWA_PROCESS, wait == APR_WAIT ? DCWW_WAIT : DCWW_NOWAIT, &codes,
&pid, proc->pid);
 
+    if (status)
+        *status = codes.codeResult;
     if (rc == 0) {
         return APR_CHILD_DONE;
     } else if (rc == ERROR_CHILD_NOT_COMPLETE) {
Index: threadproc/win32/proc.c
===================================================================
RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
retrieving revision 1.55
diff -u -r1.55 proc.c
--- threadproc/win32/proc.c	2001/09/17 21:24:29	1.55
+++ threadproc/win32/proc.c	2001/09/20 06:02:58
@@ -540,11 +540,15 @@
     return APR_SUCCESS;
 }
 
-APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, apr_wait_how_e wait)
+APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
+                                        apr_wait_t *status,
+                                        apr_wait_how_e wait)
 {
     DWORD stat;
     if (!proc)
         return APR_ENOPROC;
+    if (status)
+        *status = APR_ENOTIMPL;
     if (wait == APR_WAIT) {
         if ((stat = WaitForSingleObject(proc->hproc, 
                                         INFINITE)) == WAIT_OBJECT_0) {


Mime
View raw message