X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_42,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4A5719F6.5010902@gmail.com> Date: Fri, 10 Jul 2009 11:37:42 +0100 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: WCONTINUED/WIFCONTINUED References: <6910a60907100049x47d2645cl1ce5930fb9034dce AT mail DOT gmail DOT com> In-Reply-To: <6910a60907100049x47d2645cl1ce5930fb9034dce@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------090306050707070807080301" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------090306050707070807080301 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Reini Urban wrote: > Any volunteer for WCONTINUED, WIFCONTINUED() for wait4() for the > initial cygwin-1.7 release? > See http://www.opengroup.org/onlinepubs/009695399/functions/wait.html > > Sorry, I'm not able to write this, but I have looked into wait.cc. ? They appear to exist and work. See "/usr/include/cygwin/wait.h". Attached: crude smoketest derived from the opengroup web page linked above. cheers, DaveK --------------090306050707070807080301 Content-Type: text/plain; name="w4.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="w4.c" #include #include #include #include int main (int argc, const char **argv) { pid_t child_pid, wpid; int status; child_pid = fork(); if (child_pid == -1) { /* fork() failed */ perror("fork"); exit(EXIT_FAILURE); } if (child_pid == 0) { /* This is the child */ /* Child does some work and then terminates */ printf ("In child!\n"); fflush (0); /* TRY WITH OR WITHOUT THIS LINE. */ * (int * ) 0 = 0; /* TRY CHANGING THIS VALUE. */ return 42; } else { /* This is the parent */ do { wpid = waitpid(child_pid, &status, WUNTRACED #ifdef WCONTINUED /* Not all implementations support this */ | WCONTINUED #endif ); if (wpid == -1) { perror("waitpid"); exit(EXIT_FAILURE); } if (WIFEXITED(status)) { printf("child exited, status=%d\n", WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { printf("child killed (signal %d)\n", WTERMSIG(status)); } else if (WIFSTOPPED(status)) { printf("child stopped (signal %d)\n", WSTOPSIG(status)); #ifdef WIFCONTINUED /* Not all implementations support this */ } else if (WIFCONTINUED(status)) { printf("child continued\n"); #endif } else { /* Non-standard case -- may never happen */ printf("Unexpected status (0x%x)\n", status); } } while (!WIFEXITED(status) && !WIFSIGNALED(status)); } return 0; } --------------090306050707070807080301 Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --------------090306050707070807080301--