unix.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #undef _BSD_EXTENSION /* avoid multiple def'n if predefined */
  10. #undef _PLAN9_SOURCE
  11. #undef _POSIX_SOURCE
  12. #undef _RESEARCH_SOURCE
  13. #undef _SUSV2_SOURCE
  14. #define _BSD_EXTENSION
  15. #define _PLAN9_SOURCE
  16. #define _POSIX_SOURCE
  17. #define _RESEARCH_SOURCE
  18. #define _SUSV2_SOURCE
  19. #include <stdlib.h>
  20. #include <stdarg.h>
  21. #include <string.h>
  22. #include <unistd.h>
  23. #include <fcntl.h>
  24. #include <signal.h>
  25. #include <inttypes.h>
  26. #ifndef NSIG
  27. #define NSIG 32
  28. #endif
  29. /* plan 9 compatibility */
  30. #define RFPROC 1
  31. #define RFFDG 1
  32. #define RFNOTEG 1
  33. #define uintptr uintptr_t
  34. char *strdup(const char *);
  35. #define nil ((void*)0)
  36. /* in case uchar, etc. are built-in types */
  37. #define uchar _fmtuchar
  38. #define ushort _fmtushort
  39. #define uint _fmtuint
  40. #define ulong _fmtulong
  41. #define vlong _fmtvlong
  42. #define uvlong _fmtuvlong
  43. typedef unsigned char uchar;
  44. typedef unsigned short ushort;
  45. typedef unsigned int uint;
  46. typedef unsigned long ulong;
  47. typedef unsigned long long uvlong;
  48. #define OREAD O_RDONLY
  49. #define OWRITE O_WRONLY
  50. #define ORDWR O_RDWR
  51. #define OCEXEC 0