ptypes.inc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2001 by Free Pascal development team
  5. This file implements all the base types and limits required
  6. for a minimal POSIX compliant subset required to port the compiler
  7. to a new OS.
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. {***********************************************************************}
  15. { POSIX TYPE DEFINITIONS }
  16. {***********************************************************************}
  17. {$I ctypes.inc}
  18. {$packrecords c}
  19. type
  20. dev_t = cuint32; { used for device numbers }
  21. TDev = dev_t;
  22. pDev = ^dev_t;
  23. gid_t = cuint32; { used for group IDs }
  24. TGid = gid_t;
  25. pGid = ^gid_t;
  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 = pointer;
  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. {
  113. $Log$
  114. Revision 1.8 2004-09-09 20:29:06 jonas
  115. * fixed definition of pthread_mutex_t for non-linux targets (and for
  116. linux as well, actually).
  117. * base libpthread definitions are now in ptypes.inc, included in unixtype
  118. They sometimes have an extra underscore in front of their name, in
  119. case they were also exported by the packages/base/pthreads unit, so
  120. they can keep their original name there
  121. * cthreadds unit now imports systuils, because it uses exceptions (it
  122. already did so before as well)
  123. * fixed many linux definitions of libpthread functions in pthrlinux.inc
  124. (integer -> cint etc)
  125. + added culonglong type to ctype.inc
  126. Revision 1.7 2004/08/25 21:42:11 jonas
  127. * fixed pthread type definitions for darwin and made them generic
  128. Revision 1.6 2004/05/16 13:03:27 peter
  129. * remove duplicate wordsinsigset
  130. Revision 1.5 2004/01/04 20:08:45 jonas
  131. * moved SIG_MAXSIG and wordsinsigset constants from bunxtype.inc to
  132. ptypes.inc (already there for Darwin)
  133. Revision 1.4 2004/01/04 01:11:28 marco
  134. * a new qod port of the freebsd rtl. To be refined in the coming days.
  135. Revision 1.3 2003/01/17 22:13:47 marco
  136. * some updates
  137. Revision 1.5 2003/01/03 13:11:32 marco
  138. * split into ptypes and ctypes
  139. }