ptypes.inc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. fsblkcnt_t = clonglong;
  20. TStatfs = record
  21. bsize : culong;
  22. frsize : culong;
  23. blocks : fsblkcnt_t;
  24. bfree : fsblkcnt_t;
  25. bavail : fsblkcnt_t;
  26. files : fsblkcnt_t;
  27. ffree : fsblkcnt_t;
  28. favail : fsblkcnt_t;
  29. fsid : culong;
  30. flag : culong;
  31. namemax : culong;
  32. end;
  33. PStatFS=^TStatFS;
  34. mbstate_t = record
  35. converter : pointer;
  36. charset : array[0..63] of char;
  37. count : cuint;
  38. data : array[0..1023+8] of char; { 1024 bytes for data, 8 for alignment space }
  39. end;
  40. pmbstate_t = ^mbstate_t;
  41. dev_t = cint32; { used for device numbers }
  42. TDev = dev_t;
  43. pDev = ^dev_t;
  44. gid_t = cint32; { used for group IDs }
  45. TGid = gid_t;
  46. pGid = ^gid_t;
  47. TIOCtlRequest = cuLong;
  48. ino_t = cint64; { used for file serial numbers }
  49. TIno = ino_t;
  50. pIno = ^ino_t;
  51. mode_t = cuint32; { used for file attributes }
  52. TMode = mode_t;
  53. pMode = ^mode_t;
  54. nlink_t = cint32; { used for link counts }
  55. TnLink = nlink_t;
  56. pnLink = ^nlink_t;
  57. off_t = cint64; { used for file sizes }
  58. TOff = off_t;
  59. pOff = ^off_t;
  60. pid_t = cint32; { used as process identifier }
  61. TPid = pid_t;
  62. pPid = ^pid_t;
  63. {$ifdef cpu64}
  64. size_t = cuint64; { as definied in the C standard}
  65. ssize_t = cint64; { used by function for returning number of bytes }
  66. time_t = cint64; { used for returning the time }
  67. {$else}
  68. size_t = cuint32; { as definied in the C standard}
  69. ssize_t = cint32; { used by function for returning number of bytes }
  70. time_t = clong; { used for returning the time }
  71. {$endif}
  72. wint_t = cint32;
  73. TSize = size_t;
  74. pSize = ^size_t;
  75. psize_t = pSize;
  76. TsSize = ssize_t;
  77. psSize = ^ssize_t;
  78. uid_t = cuint32; { used for user ID type }
  79. TUid = Uid_t;
  80. pUid = ^Uid_t;
  81. clock_t = cint32;
  82. suseconds_t = cint32;
  83. useconds_t = cuint32;
  84. TClock = clock_t;
  85. pClock = ^clock_t;
  86. // TTime = time_t; // Not allowed in system unit, -> unixtype
  87. pTime = ^time_t;
  88. ptime_t = ^time_t;
  89. wchar_t = cint32;
  90. pwchar_t = ^wchar_t;
  91. socklen_t= cuint32;
  92. TSocklen = socklen_t;
  93. pSocklen = ^socklen_t;
  94. timeval = record
  95. tv_sec: time_t;
  96. tv_usec: suseconds_t;
  97. end;
  98. ptimeval = ^timeval;
  99. TTimeVal = timeval;
  100. timespec = record
  101. tv_sec : time_t;
  102. tv_nsec : clong;
  103. end;
  104. ptimespec= ^timespec;
  105. Ttimespec= timespec;
  106. pthread_t = culong;
  107. sched_param = record
  108. __sched_priority: cint;
  109. end;
  110. pthread_attr_t = record
  111. __detachstate: cint;
  112. __schedpolicy: cint;
  113. __schedparam: sched_param;
  114. __inheritsched: cint;
  115. __scope: cint;
  116. __guardsize: size_t;
  117. __stackaddr_set: cint;
  118. __stackaddr: pointer;
  119. __stacksize: size_t;
  120. end;
  121. _pthread_fastlock = record
  122. __status: clong;
  123. __spinlock: cint;
  124. end;
  125. pthread_mutex_t = record
  126. __m_reserved: cint;
  127. __m_count: cint;
  128. __m_owner: pointer;
  129. __m_kind: cint;
  130. __m_lock: _pthread_fastlock;
  131. end;
  132. pthread_mutexattr_t = record
  133. __mutexkind: cint;
  134. end;
  135. pthread_cond_t = record
  136. __c_lock: _pthread_fastlock;
  137. __c_waiting: pointer;
  138. __padding: array[0..48-1-sizeof(_pthread_fastlock)-sizeof(pointer)-sizeof(clonglong)] of byte;
  139. __align: clonglong;
  140. end;
  141. pthread_condattr_t = record
  142. __dummy: cint;
  143. end;
  144. pthread_key_t = cuint;
  145. pthread_rwlock_t = record
  146. __rw_readers: cint;
  147. __rw_writer: pointer;
  148. __rw_read_waiting: pointer;
  149. __rw_write_waiting: pointer;
  150. __rw_kind: cint;
  151. __rw_pshared: cint;
  152. end;
  153. pthread_rwlockattr_t = record
  154. __lockkind: cint;
  155. __pshared: cint;
  156. end;
  157. sem_t = record
  158. __sem_lock: _pthread_fastlock;
  159. __sem_value: cint;
  160. __sem_waiting: pointer;
  161. end;
  162. rlim_t = int64;
  163. TRlim = rlim_t;
  164. CONST
  165. _PTHREAD_MUTEX_TIMED_NP = 0;
  166. _PTHREAD_MUTEX_RECURSIVE_NP = 3;
  167. _PTHREAD_MUTEX_ERRORCHECK_NP = 2;
  168. _PTHREAD_MUTEX_ADAPTIVE_NP = 3;
  169. _PTHREAD_MUTEX_NORMAL = 1;
  170. _PTHREAD_MUTEX_RECURSIVE = _PTHREAD_MUTEX_RECURSIVE_NP;
  171. _PTHREAD_MUTEX_ERRORCHECK = _PTHREAD_MUTEX_ERRORCHECK_NP;
  172. _PTHREAD_MUTEX_DEFAULT = 0;
  173. _PTHREAD_MUTEX_FAST_NP = _PTHREAD_MUTEX_ADAPTIVE_NP;
  174. _PTHREAD_KEYS_MAX = 256;
  175. _PTHREAD_STACK_MIN = 1024;
  176. CONST
  177. { System limits, POSIX value in parentheses, used for buffer and stack allocation }
  178. ARG_MAX = 65536; {4096} { Maximum number of argument size }
  179. NAME_MAX = 255; {14} { Maximum number of bytes in filename }
  180. PATH_MAX = 1024; {255} { Maximum number of bytes in pathname }
  181. SYS_NMLN = 32; {BSD utsname struct limit}
  182. SIG_MAXSIG = 64; { __MAX_SIGNO in signal.h }
  183. const
  184. { For getting/setting priority }
  185. Prio_Process = 0;
  186. Prio_PGrp = 1;
  187. Prio_User = 2;