From owner-freebsd-standards@FreeBSD.ORG Fri Aug 3 10:20:11 2012 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E699106564A for ; Fri, 3 Aug 2012 10:20:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 78A988FC0C for ; Fri, 3 Aug 2012 10:20:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q73AKBkh042159 for ; Fri, 3 Aug 2012 10:20:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q73AKBtt042158; Fri, 3 Aug 2012 10:20:11 GMT (envelope-from gnats) Date: Fri, 3 Aug 2012 10:20:11 GMT Message-Id: <201208031020.q73AKBtt042158@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: jau@iki.fi (Jukka A. Ukkonen) Cc: Subject: Re: standards/170346: Changes to support waitid() and related stuff X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Jukka A. Ukkonen" List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2012 10:20:11 -0000 The following reply was made to PR standards/170346; it has been noted by GNATS. From: jau@iki.fi (Jukka A. Ukkonen) To: pluknet@gmail.com (Sergey Kandaurov) Cc: bug-followup@FreeBSD.org, jau@iki.fi Subject: Re: standards/170346: Changes to support waitid() and related stuff Date: Fri, 3 Aug 2012 13:11:00 +0300 (EEST) Quoting Sergey Kandaurov: > > Hi. > Shouldn't the idtype_t definition be cut from sys/types.h and instead moved > into sys/wait.h itself? POSIX specifies for waitid() that you only need to > include sys/wait.h and doesn't mention sys/types.h. > It's also probably makes sense to wrap new syscall with __POSIX_VISIBLE > Something like this: > > Index: sys/sys/wait.h > =================================================================== > --- sys/sys/wait.h (revision 237379) > +++ sys/sys/wait.h (working copy) > @@ -93,8 +93,18 @@ > #define WAIT_MYPGRP 0 /* any process in my process group */ > #endif /* __BSD_VISIBLE */ > > +#if __POSIX_VISIBLE >= 200809 > +/* needs for waitid() */ > +typedef enum { > + P_ALL, > + P_PGID, > + P_PID > +/* other stuff goes here */ > +} idtype_t; > +#endif > + > #ifndef _KERNEL > #include > +#include > > __BEGIN_DECLS > pid_t wait(int *); > @@ -104,6 +114,9 @@ > pid_t wait3(int *, int, struct rusage *); > pid_t wait4(pid_t, int *, int, struct rusage *); > #endif > +#if __POSIX_VISIBLE >= 200809 > +int waitid(idtype_t, id_t, siginfo_t *, int); > +#endif > __END_DECLS > #endif /* !_KERNEL */ > > The remain part of sys/wait.h patch intentionally omitted for clarity. > > -- > wbr, > pluknet > Since the new wait6() also requires idtype_t and P_xxx stuff I am not quite sure how will the macro framing fare with the kernel. I just run out of steam before I got that far. ;-) If you are convinced that framing the idtype_t declaration within __POSIX_VISIBLE does not harm compilation of kern_exit.c, go ahead. My decision to put the idtype_t type declaration where it is in my patch was prompted by the idea that the type and its values might be later on needed also elsewhere, not only with the wait*() stuff. As long as idtype_t is not used anywhere else but with the wait*() implementation, it should be technically quite possible to put the stuff in . That would carry the risk, though, that later the definition would have to be moved again to a more generic place to be feasible to use with some other code. Since idtype_t is a SUS/POSIX feature, I would not be surprised to see it used with other standard APIs as well. I can only say that it is hard to predict anything, especially the future. ;-) And, if I my memory serves me right, I guess Solaris has put the idtype_t declaration in and just includes all sorts of necessary stuff. Because idtype_t carries with it a whole lot of P_xxx names, it might be beneficial to have those somewhere such that any potential conflict with the P_zzz macros in becomes quickly visible. I have no objection to moving things around as such. I just estimated the benefits and the drawbacks embedded in the selection of the location one way. Others may think differently. Cheers, // jau .--- ..- -.- -.- .- .- .-.-.- ..- -.- -.- --- -. . -. / Jukka A. Ukkonen, Oxit Ltd, Finland /__ M.Sc. (sw-eng & cs) (Phone) +358-500-606-671 / Internet: Jukka.Ukkonen(a)Oxit.Fi / Internet: jau(a)iki.fi v .--- .- ..- ...-.- .. -.- .. .-.-.- ..-. .. + + + + My opinions are mine and mine alone, not my employers. + + + +