home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.21 / text0034.txt < prev    next >
Encoding:
Internet Message Format  |  1990-10-26  |  2.1 KB

  1. From:  Bob Goudreau <goudreau@larrybud.rtp.dg.com>
  2.  
  3. In article <11188@cs.utexas.edu>, Don_Lewine@dgc.ceo.dg.com writes:
  4. >
  5. > I have been comparing SVID Issue 3 (for V.4) to IEEE Std 1003.1-1988. 
  6. > I noticed that the SVID specifies header files in the synopsis for 
  7. > various functions that are not required for POSIX.  For example,
  8. > POSIX says that setuid() requires that <sys/types.h> be included.  
  9. > The SVID requires that both <sys/types.h> and <unistd.h> be included.
  10. >  
  11. > Question: Is there anything wrong with this?  If I write a strictly
  12. > conforming application, can I include <unistd.h> for SVID 
  13. > compatibility even if POSIX does not require it?  Is there any 
  14. > problem with including "extra" header files (other than the obvious 
  15. > restrictions on the namespace)?
  16. >  
  17. > BTW, looking at the SVR4 code there is nothing in <unistd.h> that 
  18. > would require it to be included for setuid().  There do not seem to 
  19. > be any symbols in the header file that are prohibited.  However, this 
  20. > is a standards questions and reading the .h files is cheating!
  21.  
  22. At least for the case of implementations claiming to conform to ANSI C,
  23. POSIX.1-1988 does indeed require that <unistd.h> must contain a
  24. prototype for setuid().  Here's the relevant text, from section 2.8.3:
  25.  
  26.     Implementations claiming C Standard Language-Dependent Support
  27.     shall declare function prototypes for all functions.
  28.  
  29.     Implementations claiming Common Usage C Language-Dependent
  30.     Support shall declare the result type for all functions not
  31.     returning a "plain" _int_.
  32.  
  33.     These function prototypes (if required) shall appear in the
  34.     headers listed below.  If a function is not listed below, it
  35.     shall have its prototype appear in <unistd.h>, which is
  36.     presumed to be #include-ed whenever any function declared in it
  37.     is used, whether or not it is mentioned in the Synopsis
  38.     section for that function.
  39.  
  40. ------------------------------------------------------------------------
  41. Bob Goudreau                +1 919 248 6231
  42. Data General Corporation
  43. 62 Alexander Drive            goudreau@dg-rtp.dg.com
  44. Research Triangle Park, NC  27709    ...!mcnc!rti!xyzzy!goudreau
  45. USA
  46.  
  47.  
  48. Volume-Number: Volume 21, Number 35
  49.  
  50.