ptypes.inc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2001 by Free Pascal development team
  4. This file implements all the base types and limits required
  5. for a minimal POSIX compliant subset required to port the compiler
  6. to a new OS.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {***********************************************************************}
  14. { POSIX TYPE DEFINITIONS }
  15. {***********************************************************************}
  16. {$I ctypes.inc}
  17. {$packrecords c}
  18. type
  19. dev_t = cuint32; { used for device numbers }
  20. TDev = dev_t;
  21. pDev = ^dev_t;
  22. gid_t = cuint32; { used for group IDs }
  23. TGid = gid_t;
  24. pGid = ^gid_t;
  25. TIOCtlRequest = cuLong;
  26. ino_t = clong; { used for file serial numbers }
  27. TIno = ino_t;
  28. pIno = ^ino_t;
  29. mode_t = cuint32; { used for file attributes }
  30. TMode = mode_t;
  31. pMode = ^mode_t;
  32. nlink_t = cuint32; { used for link counts }
  33. TnLink = nlink_t;
  34. pnLink = ^nlink_t;
  35. off_t = cint64; { used for file sizes }
  36. TOff = off_t;
  37. pOff = ^off_t;
  38. pid_t = cint32; { used as process identifier }
  39. TPid = pid_t;
  40. pPid = ^pid_t;
  41. size_t = cuint32; { as definied in the C standard}
  42. TSize = size_t;
  43. pSize = ^size_t;
  44. ssize_t = cint32; { used by function for returning number of bytes }
  45. TsSize = ssize_t;
  46. psSize = ^ssize_t;
  47. uid_t = cuint32; { used for user ID type }
  48. TUid = Uid_t;
  49. pUid = ^Uid_t;
  50. clock_t = culong;
  51. TClock = clock_t;
  52. pClock = ^clock_t;
  53. time_t = clong; { used for returning the time }
  54. TTime = time_t;
  55. pTime = ^time_t;
  56. ptime_t = ^time_t;
  57. socklen_t= cuint32;
  58. TSocklen = socklen_t;
  59. pSocklen = ^socklen_t;
  60. timeval = packed record
  61. tv_sec,
  62. tv_usec : clong;
  63. end;
  64. ptimeval= ^timeval;
  65. TTimeval= timeval;
  66. timespec = packed record
  67. tv_sec : time_t;
  68. tv_nsec : clong;
  69. end;
  70. ptimespec= ^timespec;
  71. Ttimespec= timespec;
  72. pthread_t = pointer;
  73. pthread_attr_t = pointer;
  74. pthread_mutex_t = {$i pmutext.inc}
  75. pthread_mutexattr_t = pointer;
  76. pthread_cond_t = pointer;
  77. pthread_condattr_t = pointer;
  78. pthread_key_t = cint;
  79. pthread_rwlock_t = pointer;
  80. pthread_rwlockattr_t = pointer;
  81. sem_t = pointer;
  82. {
  83. Mutex types (Single UNIX Specification, Version 2, 1997).
  84. Note that a mutex attribute with one of the following types:
  85. PTHREAD_MUTEX_NORMAL
  86. PTHREAD_MUTEX_RECURSIVE
  87. MUTEX_TYPE_FAST (deprecated)
  88. MUTEX_TYPE_COUNTING_FAST (deprecated)
  89. will deviate from POSIX specified semantics.
  90. }
  91. pthread_mutextype = (
  92. { Default POSIX mutex }
  93. _PTHREAD_MUTEX_ERRORCHECK := 1,
  94. { Recursive mutex }
  95. _PTHREAD_MUTEX_RECURSIVE := 2,
  96. { No error checking }
  97. _PTHREAD_MUTEX_NORMAL := 3,
  98. _MUTEX_TYPE_MAX
  99. );
  100. const
  101. _PTHREAD_MUTEX_DEFAULT = _PTHREAD_MUTEX_ERRORCHECK;
  102. _MUTEX_TYPE_FAST = _PTHREAD_MUTEX_NORMAL;
  103. _MUTEX_TYPE_COUNTING_FAST = _PTHREAD_MUTEX_RECURSIVE;
  104. _PTHREAD_KEYS_MAX = 256;
  105. _PTHREAD_STACK_MIN = 1024;
  106. { System limits, POSIX value in parentheses, used for buffer and stack allocation }
  107. ARG_MAX = 256*1024; {4096} { Maximum number of argument size }
  108. NAME_MAX = 255; {14} { Maximum number of bytes in filename }
  109. PATH_MAX = 1024; {255} { Maximum number of bytes in pathname }
  110. SYS_NMLN = 32; {BSD utsname struct limit}
  111. SIG_MAXSIG = 128; // highest signal version
  112. wordsinsigset = 4; // words in sigset_t