vijay@bradley.UUCP (09/12/89)
Hi: I hope you can give me some pointers. I am trying to port an application from a 4.3 BSD UNIX to System V. There is a wait3() call in the application that needs to be converted to System V wait() or equivalent. And that's where I am stuck. Any help would be appreciated. Thanks in advance... -- Vijay K. Gurbani | {uiucdcs, inhp4, cepu}!bradley!vijay | "Learn how to Distributed Systems | vijay@bradley.edu | avoid RIPOFFS - Bradley University | (309)677-2339 | Send $10.00 for Peoria, IL 61605 | | details!!"
kucharsk@uts.amdahl.com (William Kucharski) (09/16/89)
In article <10800032@bradley> vijay@bradley.UUCP writes: > >Hi: > I hope you can give me some pointers. I am trying to port >an application from a 4.3 BSD UNIX to System V. There is a >wait3() call in the application that needs to be converted to >System V wait() or equivalent. And that's where I am stuck. Any help >would be appreciated. > >Thanks in advance... It depends upon the parameters you're trying to feed to the wait3() call. If you're just trying to do a WNOHANG-style non-blocking wait, try something along the lines of (PSEUDO-C Code Follows): alarm(1); /* set alarm time for around 1 second */ pid = wait(&status); /* blocking wait(2) */ alarm(0); /* reset alarm */ If the wait succeeds - no problem. If it doesn't, it will be awakened by the alarm call. -- =============================================================================== | ARPA: kucharsk@uts.amdahl.com | William Kucharski | | UUCP: ...!{ames,apple,sun,uunet}!amdahl!kucharsk | Amdahl Corporation | =============================================================================== | Saying: "It's a window system named 'X,' NOT a system named 'X Windows'" | =============================================================================== | Disclaimer: "The opinions expressed above may not agree with mine at any | | other moment in time, so they certainly can't be those of my | | employer." | ===============================================================================
mday@ohs.UUCP (Matthew T. Day) (09/17/89)
From article <10800032@bradley>, by vijay@bradley.UUCP: > I hope you can give me some pointers. I am trying to port > an application from a 4.3 BSD UNIX to System V. There is a > wait3() call in the application that needs to be converted to > System V wait() or equivalent. And that's where I am stuck. Any help > would be appreciated. Try using waitpid(). You'll need to include <sys/wait.h>, if you haven't already. -- +----------------------------------------------+-------------------------+ | Matthew T. Day, Icon International, Orem, UT | Xerox never comes up | | ..!uunet!iconsys!mday (mday@iconsys.uu.net) | with anything original. | +----------------------------------------------+-------------------------+
guy@auspex.auspex.com (Guy Harris) (09/19/89)
>> I hope you can give me some pointers. I am trying to port >> an application from a 4.3 BSD UNIX to System V. ... > >Try using waitpid(). You'll need to include <sys/wait.h>, if you haven't >already. Try *finding* "waitpid()", or <sys/wait.h>. They're not in the S5R3.0 or S5R3.1 source distributions from AT&T, and so aren't likely to be in your vendor's version of those systems unless said vendor added them.... They weren't in earlier S5 releases from AT&T, either. They may be in the S5 you have, and may even be in e.g. S5R3.2, but the original poster didn't indicate what version of S5 he had, so he may not have the same version you do. It's often unwise to assume that something that's in your UNIX is in all versions of UNIX, or even in all versions of UNIX in the same "family", unless you're fairly familiar with several members of said family and the history of said family....
brian@bradley.UUCP (09/21/89)
> They may be in the S5 you have, and may even be in e.g. S5R3.2, but the > original poster didn't indicate what version of S5 he had, so he may not > have the same version you do. The original poster is using release 2.1.2. Brian Michael Wendt UUCP: {cepu,uiucdcs,noao}!bradley!brian Bradley University ARPA: cepu!bradley!brian@seas.ucla.edu (309) 677-2335 ICBM: 40 40' N 89 34' W "Down, down in the basement, we hear the sound of machines..."
chip@ateng.com (Chip Salzenberg) (09/22/89)
According to vijay@bradley.UUCP: > I hope you can give me some pointers. I am trying to port >an application from a 4.3 BSD UNIX to System V. There is a >wait3() call in the application that needs to be converted to >System V wait() or equivalent. And that's where I am stuck. Any help >would be appreciated. A non-blocking wait can be simulated (badly) with the already-suggested: int wstat, pid; alarm(1); pid = wait(&wstat); alarm(0); if (pid != -1) { /* We got a dead child */ } An alternative is to keep track of children as they die by strategic use of the SIGCLD signal. A SIGCLD signal catching routine will be called when a child process dies; it can then call wait() with the calm assurance that it won't block. Read the manual pages signal(2) and wait(2). A caveat: You'll pick up child processes created by library subroutines, too; this can mess up both them and you. Be careful with getpwd(), popen(), system() and any other forking library routines you may have.