Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Aug 2012 10:20:11 GMT
From:      jau@iki.fi (Jukka A. Ukkonen)
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/170346: Changes to support waitid() and related stuff
Message-ID:  <201208031020.q73AKBtt042158@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/types.h>
 > +#include <sys/signal.h>
 > 
 >  __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 <sys/wait.h>. 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 <sys/types.h> and <wait.h> 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 <sys/proc.h> 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. + + + +



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208031020.q73AKBtt042158>