From owner-freebsd-standards Fri Nov 30 5:38:56 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id C6CCC37B41B for ; Fri, 30 Nov 2001 05:38:52 -0800 (PST) Received: from vagabond.auriga.ru (vagabond.auriga.ru [213.24.253.246]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAUDcpG25382 for ; Fri, 30 Nov 2001 08:38:51 -0500 (EST) (envelope-from avn@vagabond.auriga.ru) Received: from localhost (localhost [[UNIX: localhost]]) by vagabond.auriga.ru (8.11.2/8.11.2) id fAUDcmb05605 for freebsd-standards@bostonradio.org; Fri, 30 Nov 2001 16:38:48 +0300 Content-Type: text/plain; charset="koi8-r" X-KMail-Redirect-From: Alexey V. Neyman Subject: waitid() From: "Alexey V. Neyman" (by way of Alexey V. Neyman ) Date: Fri, 30 Nov 2001 16:38:46 +0300 To: freebsd-standards@bostonradio.org MIME-Version: 1.0 Message-Id: <0111301638460L.01351@vagabond.auriga.ru> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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