types.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. /*
  7. * Basic system types and major/minor device constructing/busting macros.
  8. */
  9. #if !defined(_SYS_TYPES_H)
  10. #define _SYS_TYPES_H
  11. #ifdef __STDC__
  12. #if !defined(_SIZE_T)
  13. #define _SIZE_T
  14. typedef unsigned int size_t; /* type returned by sizeof */
  15. #endif /* _SIZE_T */
  16. #if !defined(_TIME_T)
  17. #define _TIME_T
  18. typedef unsigned long time_t;
  19. #endif /* TIME_T */
  20. #endif
  21. #if !defined(_POSIX_SOURCE)
  22. /* major part of a device */
  23. #define major(x) ((int)(((unsigned)(x)>>8)&0377))
  24. /* minor part of a device */
  25. #define minor(x) ((int)((x)&0377))
  26. /* make a device number */
  27. #define makedev(x,y) ((dev_t)(((x)<<8) | (y)))
  28. typedef unsigned char u_char;
  29. typedef unsigned short u_short;
  30. typedef unsigned int u_int;
  31. typedef unsigned long u_long;
  32. typedef struct _physadr { int r[1]; } *physadr;
  33. typedef long daddr_t;
  34. typedef char * caddr_t;
  35. #if defined(__BSD4_2)
  36. typedef u_long ino_t;
  37. #else
  38. typedef u_short ino_t;
  39. #endif
  40. typedef long swblk_t;
  41. #include <sys/stdtypes.h>
  42. typedef long label_t[14];
  43. typedef short dev_t;
  44. typedef long off_t;
  45. /* system V compatibility: */
  46. typedef unsigned int uint;
  47. typedef unsigned short ushort;
  48. typedef unsigned char uchar_t;
  49. typedef short cnt_t;
  50. typedef long paddr_t;
  51. typedef long key_t;
  52. #else /* _POSIX_SOURCE */
  53. #if defined(_MINIX)
  54. typedef unsigned short dev_t; /* hold (major|minor) device pair */
  55. typedef unsigned char gid_t; /* group id */
  56. typedef unsigned short ino_t; /* i-node number */
  57. typedef unsigned short mode_t; /* mode number within an i-node */
  58. typedef unsigned char nlink_t; /* number-of-links field within an i-node */
  59. typedef long off_t; /* offsets within a file */
  60. typedef int pid_t; /* type for pids (must be signed) */
  61. typedef unsigned short uid_t; /* user id */
  62. #endif /* _MINIX */
  63. #endif /* _POSIX_SOURCE */
  64. #endif /* _SYS_TYPES_H */