home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.31 / text0095.txt < prev    next >
Encoding:
Text File  |  1993-07-15  |  1.0 KB  |  33 lines

  1. Submitted-by: willcox@urbana.mcd.mot.com (David A Willcox)
  2.  
  3. karish@mindcraft.com (Chuck Karish) writes:
  4. >Note that the rules will be different for systems that support
  5. >multi-threaded processes, because errno may have to be a
  6. >function instead of an integral type.
  7.  
  8. No, not really.  POSIX.4a (pthreads) has the same requirement for
  9. errno as ANSI C, relaxing a bit the requirement that's in POSIX.1.
  10. POSIX.1 says that errno must be specifically "extern int errno;"
  11. POSIX.4a and ANSI C only require errno to be "a modifiable lvalue that
  12. has type int."  The following both satisfy POSIX.4a and ANSI C, and are
  13. just fine for threads:
  14.  
  15.     #define errno (*__errno)
  16.     extern int *__errno;
  17.  
  18.     #define errno (*__errno())
  19.     extern int (*__errno())
  20.  
  21. The following is NOT fine; it would violate ANSI C:
  22.  
  23.     #define errno __errno()
  24.  
  25. David A. Willcox        "Just say 'NO' to universal drug testing"
  26. Motorola MCG - Urbana        UUCP: ...!uiucuxc!udc!willcox
  27. 1101 E. University Ave.        INET: willcox@urbana.mcd.mot.com
  28. Urbana, IL 61801        FONE: 217-384-8534
  29.  
  30.  
  31. Volume-Number: Volume 31, Number 97
  32.  
  33.