ptypes.inc 5.6 KB

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