ptypes.inc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. { Introduced defines
  18. - 64bitarch (for 64-bits Linux systems, test system was idefix (in ctypes)
  19. - 64bitfs (should be on if libc switches to a 64-bit system.
  20. All three tested systems (PPC,Alpha,2x i386) gave the same POSIX limits,
  21. and all three 32-bit systems returned completely identical types too
  22. (everything 32-bit except dev_t, which is assumed to be a result of devfs
  23. introduction)
  24. }
  25. {$I ctypes.inc}
  26. Type
  27. {$ifndef VER_1_0} // maybe wrong (kernel vs libc)
  28. dev_t = cuint64; { used for device numbers }
  29. {$else}
  30. dev_t = int64;
  31. {$endif}
  32. TDev = dev_t;
  33. pDev = ^dev_t;
  34. kDev_t = cushort; // Linux has two different device conventions
  35. TkDev = KDev_t; // kernel and glibc. This is kernel.
  36. pkDev = ^kdev_t;
  37. gid_t = cuint32; { used for group IDs }
  38. TGid = gid_t;
  39. pGid = ^gid_t;
  40. ino_t = clong; { used for file serial numbers }
  41. TIno = ino_t;
  42. pIno = ^ino_t;
  43. mode_t = cuint32; { used for file attributes }
  44. TMode = mode_t;
  45. pMode = ^mode_t;
  46. nlink_t = cuint32; { used for link counts }
  47. TnLink = nlink_t;
  48. pnLink = ^nlink_t;
  49. {$ifdef 64BitArch}
  50. off_t = cint64; { used for file sizes }
  51. {$else}
  52. {$ifdef 64BitFS}
  53. off_t = cint64;
  54. {$else}
  55. off_t = cint;
  56. {$endif}
  57. {$endif}
  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 64bitarch}
  64. size_t = cuint64; { as definied in the C standard}
  65. ssize_t = cint64; { used by function for returning number of bytes }
  66. clock_t = cuint64;
  67. time_t = cint64; { used for returning the time }
  68. {$else}
  69. size_t = cuint32; { as definied in the C standard}
  70. ssize_t = cint32; { used by function for returning number of bytes }
  71. clock_t = culong;
  72. time_t = clong; { used for returning the time }
  73. {$endif}
  74. TSize = size_t;
  75. pSize = ^size_t;
  76. TSSize = ssize_t;
  77. pSSize = ^ssize_t;
  78. TClock = clock_t;
  79. pClock = ^clock_t;
  80. TTime = time_t;
  81. pTime = ^time_t;
  82. ptime_t = ^time_t;
  83. uid_t = cuint32; { used for user ID type }
  84. TUid = uid_t;
  85. pUid = ^uid_t;
  86. socklen_t= cuint32;
  87. TSockLen = socklen_t;
  88. pSockLen = ^socklen_t;
  89. timeval = packed record
  90. tv_sec,
  91. tv_usec:clong;
  92. end;
  93. ptimeval = ^timeval;
  94. TTimeVal = timeval;
  95. timespec = packed record
  96. tv_sec : time_t;
  97. tv_nsec : clong;
  98. end;
  99. ptimespec = ^timespec;
  100. TTimeSpec = timespec;
  101. TStatfs = packed record
  102. fstype, { File system type }
  103. bsize, { Optimal block trensfer size }
  104. blocks, { Data blocks in system }
  105. bfree, { free blocks in system }
  106. bavail, { Available free blocks to non-root users }
  107. files, { File nodes in system }
  108. ffree, { Free file nodes in system }
  109. fsid, { File system ID }
  110. namelen : longint; { Maximum name length in system }
  111. spare : array [0..6] of longint; { For later use }
  112. end;
  113. PStatFS=^TStatFS;
  114. CONST
  115. { System limits, POSIX value in parentheses, used for buffer and stack allocation }
  116. { took idefix' values}
  117. ARG_MAX = 131072; {4096} { Maximum number of argument size }
  118. NAME_MAX = 255; {14} { Maximum number of bytes in filename }
  119. PATH_MAX = 4095; {255} { Maximum number of bytes in pathname }
  120. SYS_NMLM = 65;
  121. {
  122. $Log$
  123. Revision 1.7 2004-01-11 09:56:20 jonas
  124. * moved tstatfs from systypes.inc to ptypes.inc to fix make cycle with
  125. -dFPC_USE_LIBC (systypes.inc is now completely commented out)
  126. Revision 1.6 2003/12/30 12:46:40 marco
  127. * ptime_t
  128. Revision 1.5 2003/09/27 13:45:58 peter
  129. * fpnanosleep exported in baseunix
  130. * fpnanosleep has pointer arguments to be C compliant
  131. Revision 1.4 2003/09/14 20:15:01 marco
  132. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  133. Revision 1.3 2002/12/18 16:43:26 marco
  134. * new unix rtl, linux part.....
  135. Revision 1.2 2002/11/12 14:28:40 marco
  136. * some updates
  137. Revision 1.1 2002/10/29 16:47:17 marco
  138. * Linux versions
  139. }