home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.20 / text0023.txt < prev    next >
Encoding:
Internet Message Format  |  1990-08-02  |  1.7 KB

  1. From:  Andy Tanenbaum <ast@cs.vu.nl>
  2.  
  3. In article <712@longway.TIC.COM> Doug Gwyn <gwyn@smoke.brl.mil> writes:
  4. ><signal.h> must not define extra garbage such as the kill() interface
  5. >or the POSIX *_t typedefs, except under control of some "feature test
  6. >macro" such as _POSIX_SOURCE.  In the case of the typedefs, I would
  7. >urge that they not be defined as a side effect of #including <signal.h>
  8. >even in the presence of _POSIX_SOURCE.  You don't need pid_t to properly
  9. >declare getpid() or kill() in an implementation; instead, simply use the
  10. >equivalent type derived from basic types (in this case, probably "int").
  11.  
  12. POSIX specifically defines kill's first argument as type pid_t, so it
  13. would seem to be poor programming practice to use int, even if this is legal.
  14. If one replaced the *_t types by their definitions everywhere, then a
  15. decision to change pid_t from, say, int, to, say, long, would require
  16. a real expert to dig through all the code to find those int's that really
  17. are pid_t's.  Maintenance of such code would be exceedingly difficult.
  18. I think that the only realistic way is to use pid_t in the prototype of 
  19. kill.  This prototype is required in <signal.h> (protected by
  20. #ifdef _POSIX_SOURCE).
  21.  
  22. This then raises the question of how to make pid_t known.  In the example
  23. implementation given, <sys/types.h> is included in raise.c.  If this is
  24. indeed legal, then that is clearly one way to do it, as presumably all the
  25. names introduced by <sys/types.h> are not present in the object file,
  26. raise.o, and thus do not pollute the name space.
  27.  
  28. However, why do you urge not to put #include <sys/types.h> into <signal.h>
  29. under protection of #ifdef _POSIX_SOURCE?
  30.  
  31. Andy Tanenbaum (ast@cs.vu.nl)
  32.  
  33. Volume-Number: Volume 20, Number 23
  34.  
  35.