Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 10719 invoked by uid 500); 20 Sep 2001 17:39:34 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 10701 invoked from network); 20 Sep 2001 17:39:34 -0000 Errors-To: Message-ID: <08ce01c141fb$4513b240$93c0b0d0@roweclan.net> From: "William A. Rowe, Jr." To: Subject: [PATCH] Addresses broken OC data Date: Thu, 20 Sep 2001 12:25:31 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_089F_01C141CF.56FB25A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_089F_01C141CF.56FB25A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit The OC child logic is broken WRT the 'id' field. I noticed the bogosity grepping for Win32 casts. We have no reason _not_ to simply carry the apr_proc_t * instead of 'id'. Comments? Bill ------=_NextPart_000_089F_01C141CF.56FB25A0 Content-Type: application/octet-stream; name="brokenoc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="brokenoc.patch" Index: srclib/apr/include/arch/unix/misc.h =================================================================== RCS file: /home/cvs/apr/include/arch/unix/misc.h,v retrieving revision 1.28 diff -u -r1.28 misc.h --- srclib/apr/include/arch/unix/misc.h 2001/08/27 19:14:20 1.28 +++ srclib/apr/include/arch/unix/misc.h 2001/09/20 17:15:39 @@ -91,7 +91,7 @@ struct apr_other_child_rec_t { apr_pool_t *p; struct apr_other_child_rec_t *next; - int id; /* This is either a pid or tid depending on the platform */ + apr_proc_t *proc; void (*maintenance) (int, void *, int); void *data; apr_os_file_t write_fd; Index: srclib/apr/misc/unix/otherchild.c =================================================================== RCS file: /home/cvs/apr/misc/unix/otherchild.c,v retrieving revision 1.24 diff -u -r1.24 otherchild.c --- srclib/apr/misc/unix/otherchild.c 2001/05/17 12:20:01 1.24 +++ srclib/apr/misc/unix/otherchild.c 2001/09/20 17:15:39 @@ -98,7 +98,7 @@ ocr = apr_palloc(p, sizeof(*ocr)); ocr->p = p; - ocr->id = pid->pid; + ocr->proc = pid; ocr->maintenance = maintenance; ocr->data = data; if (write_fd == NULL) { @@ -144,10 +144,10 @@ for (ocr = other_children; ocr; ocr = nocr) { nocr = ocr->next; - if (ocr->id != pid->pid) + if (ocr->proc->pid != pid->pid) continue; - ocr->id = -1; + ocr->proc = NULL; (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, status); return 0; } @@ -173,10 +173,10 @@ for (ocr = other_children; ocr; ocr = nocr) { nocr = ocr->next; - if (ocr->id == -1) + if (ocr->proc == NULL) continue; - rv = WaitForSingleObject((HANDLE) ocr->id, 0); + rv = WaitForSingleObject(ocr->proc->hproc, 0); if (rv != WAIT_TIMEOUT) { (*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data, -1); } @@ -191,12 +191,12 @@ for (ocr = other_children; ocr; ocr = nocr) { nocr = ocr->next; - if (ocr->id == -1) + if (ocr->proc == NULL) continue; - waitret = waitpid(ocr->id, &status, WNOHANG); - if (waitret == ocr->id) { - ocr->id = -1; + waitret = waitpid(ocr->proc, &status, WNOHANG); + if (waitret == ocr->proc) { + ocr->proc = NULL; (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, status); } else if (waitret == 0) { @@ -204,7 +204,7 @@ } else if (waitret == -1) { /* uh what the heck? they didn't call unregister? */ - ocr->id = -1; + ocr->proc = NULL; (*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data, -1); } } ------=_NextPart_000_089F_01C141CF.56FB25A0--