Date: Fri, 30 Nov 2001 16:38:46 +0300 From: "Alexey V. Neyman" <alex.neyman@auriga.ru>(by way of Alexey V. Neyman <alex.neyman@auriga.ru>) To: freebsd-standards@bostonradio.org Subject: waitid() Message-ID: <0111301638460L.01351@vagabond.auriga.ru>
next in thread | raw e-mail | index | archive | help
Hello there! I'm trying to implement aforementioned function, and met with the following: First, how it should be? I guess it has to be a new syscall, I'd suggest the following prototype: int waitid5(idtype_t idtype, id_t id, siginfo_t *infop, int options, struct rusage *rusage); This way all waitXX() syscalls (I mean, wait() and wait4()) could have the same backend. A question arises, should it substitute wait4() call (to make wait4() a libc wrapper around it) or should a new one be introduced? And some implementation questions: Are there any contras if a process is created with P_WAITED in p_flag? This would allow to implement WCONTINUED predicate to waitid() more easily. As far as I've dug in process subsystem, this is the state of process if it was stopped and later continued. Thus if a process state is neither SSTOP nor SZOMB and P_WAITED is not set, the process has continued its execution after being stopped. Posix requires WSTOPPED to be defined as a bit flag for waitid() function; we have it in <sys/wait.h> defined to _WSTOPPED. Luckily, `grep -r src` shows that there are only 3 files where WSTOPPED is used: contrib/sendmail/src/conf.h contrib/tcsh/tc.wait.h usr.sbin/lpr/lpd/printjob.c The former two seem to not actually use this (sendmail uses it if defined(sequent) and tcsh uses it if !defined(POSIX), both statements are not true on FreeBSD). The latter is not a vendor-imported software to my best knowledge and thus can be easily teached to use _WSTOPPED instead. Also, what's the rationale behind leaving higher 16 bits of status return by wait() family of functions blank? If there is one what's the best way to implement WIFCONTINUED() macro? I can imagine something like (_WSTOPPED|WCOREFLAG), though it seems a bit ugly. And at last, Posix requires SIGCHLD to be sent in case of child process continuing after being stopped (base definitions, signal.h description). This is not done now and I can imagine consequences of such a change scattered all around the source tree. Comments? Regards, Alexey. -- <-------------------------> ) May the Sun and Water ( Regards, Alexey V. Neyman ) always fall upon you! ( mailto:alex.neyman@auriga.ru <-------------------------> -- <-------------------------> ) May the Sun and Water ( Regards, Alexey V. Neyman ) always fall upon you! ( mailto:alex.neyman@auriga.ru <-------------------------> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0111301638460L.01351>