home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.23 / text0069.txt < prev    next >
Encoding:
Text File  |  1991-06-15  |  1.6 KB  |  51 lines

  1. Submitted-by: decot@hpcupt1.cup.hp.com (Dave Decot)
  2.  
  3. > Recently while working on the command sources of Andy Tanenbaums Minix 1.6
  4. > (currently in beta and trying to become fully P1003.1 and .2 compatible),
  5. > there appeared the question whether code like
  6. >     #include <pwd.h>
  7. >     
  8. >     int main (void)
  9. >     {
  10. >     }
  11. > is required to work in a strictly conforming POSIX.1 implementation with
  12. > Standard C Bindings. 
  13.  
  14. No.  But it is allowed to work.  Note that POSIX.1 permits any symbols
  15. ending in _t, including uid_t, to appear in any of its headers (i.e.,
  16. those not imported from ANSI C).
  17.  
  18. > The problem is as follows:
  19. >     <pwd.h> contains a prototype for struct passwd *getpwuid (uid_t)
  20. >     and doesn't include <sys/types.h> by itself. I'm not shure if the
  21. >     above program needs to #include <sys/types.h> itself or <pwd.h> is
  22. >     wrong. From P1003.1-1988 <sys/types.h> needs to be included only if
  23. >     the program uses getpwuid().
  24.  
  25. To conform to POSIX.1-1988 or POSIX.1-1990, the program has to include
  26. <sys/types.h> first.
  27.  
  28. > The same problem occurs in several other headers: e.g. <signal.h>, <grp.h>,
  29. > <unistd.h>, <sys/wait.h>.
  30.  
  31. Same applies to them.
  32.  
  33. > Does P1003.1-1990 specify the correct behaviour?
  34.  
  35. It is clearer in this regard, although POSIX.1-1988 also required
  36. that the prerequisite #includes be there as well.
  37.  
  38. POSIX.1-1991 will *require* that implementations provide stand-alone
  39. headers.  In addition, a program will need to include *at most* one header
  40. in order to use a particular function (the one that contains the prototype
  41. for the function).
  42.  
  43. Dave Decot
  44.  
  45.  
  46. Volume-Number: Volume 23, Number 73
  47.  
  48.