ptypes.inc 5.6 KB

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