ptypes.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. uid_t = cuint32; { used for user ID type }
  83. TUid = uid_t;
  84. pUid = ^uid_t;
  85. socklen_t= cuint32;
  86. TSockLen = socklen_t;
  87. pSockLen = ^socklen_t;
  88. timeval = packed record
  89. tv_sec,
  90. tv_usec:clong;
  91. end;
  92. ptimeval = ^timeval;
  93. TTimeVal = timeval;
  94. timespec = packed record
  95. tv_sec : time_t;
  96. tv_nsec : clong;
  97. end;
  98. ptimespec = ^timespec;
  99. TTimeSpec = timespec;
  100. CONST
  101. { System limits, POSIX value in parentheses, used for buffer and stack allocation }
  102. { took idefix' values}
  103. ARG_MAX = 131072; {4096} { Maximum number of argument size }
  104. NAME_MAX = 255; {14} { Maximum number of bytes in filename }
  105. PATH_MAX = 4095; {255} { Maximum number of bytes in pathname }
  106. SYS_NMLM = 65;
  107. {
  108. $Log$
  109. Revision 1.5 2003-09-27 13:45:58 peter
  110. * fpnanosleep exported in baseunix
  111. * fpnanosleep has pointer arguments to be C compliant
  112. Revision 1.4 2003/09/14 20:15:01 marco
  113. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  114. Revision 1.3 2002/12/18 16:43:26 marco
  115. * new unix rtl, linux part.....
  116. Revision 1.2 2002/11/12 14:28:40 marco
  117. * some updates
  118. Revision 1.1 2002/10/29 16:47:17 marco
  119. * Linux versions
  120. }