2
0

ptypes.inc 5.4 KB

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