tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY wait funtion
@ 1998-08-18 19:03 ABDON TREMOLS
  0 siblings, 0 replies; only message in thread
From: ABDON TREMOLS @ 1998-08-18 19:03 UTC (permalink / raw)
  To: tru64-unix-managers

Hello,

Thanks for your examples and suggestions, specially to 
( sorry if I forgot someone):

Kurt Carlson <snkac@java.sois.alaska.edu>
John Hascall <john@iastate.edu>
Larry Griffith <larry@garfield.wsc.mass.edu>
Lars Bro <lbr@dksin.dk>

The general idea is to get a copy of Unix Network 
Programing by W. Richard Stevens.

This is a listing of one of the examples I received:

        pid_t                cpid;
        pid_t                wpid;
        int                wst;
        extern int        errno;

        switch (cpid = fork()) {
            case -1:                                /* error */
                fprintf(stderr, "fork failed: %s\n", strerror(errno));
                exit(1);
            case 0:                                /* child (new process) */
                execl("/bin/ps", "ps", "ax", NULL);
                fprintf(stderr, "exec failed: %s\n", strerror(errno));
                exit(1);
            default:                                /* parent (original proc)
*/
                while ((wpid = wait(&wst)) != -1) {
                        if (wpid == cpid) {
                                /* child just started above died */
                                break;
                        } else {
                                /* some other child died??? */
                        }
                        /* could use WIFEXITED/WEXITSTATUS/etc here to
                         * look at child's exit status in 'wst' variable
                         * (see "man wait" for details)
                         */
                }
        }


Thanks again,

Abdon


  
 







____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-08-18 19:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-08-18 19:03 SUMMARY wait funtion ABDON TREMOLS

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox