systypes.inc 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Michael Van Canneyt,
  5. member of the Free Pascal development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. type
  13. {
  14. Linux system calls take arguments as follows :
  15. i386/m68k:
  16. %eax/%d0 : System call number
  17. %ebx/%d1 : first argument
  18. %ecx/%d2 : second argument
  19. %edx/%d3 : third argumens
  20. %esi/%d3 : fourth argument
  21. %edi/%d4 : fifth argument
  22. That is why we define a special type, with only these arguments
  23. To make it processor independent, we don't give any system dependent
  24. names, but the rather abstract reg1,reg2 etc;
  25. SysCallRegs=record
  26. reg1,reg2,reg3,reg4,reg5,reg6 : longint;
  27. end;
  28. PSysCallRegs=^SysCallRegs;
  29. TSysCallRegs=SysCallRegs;
  30. }
  31. { The following are records for system calls BSD updated }
  32. dirent = packed record
  33. ino : cardinal; { This is not inode number, but "a number
  34. unique for each file on a filesystem"}
  35. reclen : word;
  36. d_type,
  37. namlen : byte;
  38. name : array [0..255] of char;
  39. end;
  40. pdirent =^dirent;
  41. TDirEnt = dirent;
  42. TDir= packed record {BSD libc record.}
  43. fd : longint; { file descriptor associated with directory }
  44. loc, { offset in current buffer }
  45. size : cardinal; { amount of data returned by getdirentries}
  46. buf : pdirent; { data buffer, actually a pchar}
  47. len : longint; { size of data buffer }
  48. seek, { magic cookie returned by getdirentries}
  49. rewind: cardinal; { magic cookie for rewinding}
  50. flags : longint; { flags for readdir }
  51. end;
  52. (* Linux kernel record
  53. TDir = packed record
  54. fd : longint;
  55. loc : longint;
  56. size : integer;
  57. buf : pdirent;
  58. {The following are used in libc, but NOT in the linux kernel sources ??}
  59. nextoff: longint;
  60. dd_max : integer; {size of buf. Irrelevant, as buf is of type dirent}
  61. lock : pointer;
  62. dummy : array[0..1023] of char;
  63. end; *)
  64. PDir =^TDir;
  65. {$packrecords C}
  66. type
  67. dev_t = cardinal; // taken from sysunix.getdir to avoid ifdef's.
  68. Stat =record {BSD version}
  69. dev, { inode's device }
  70. ino : cardinal; { inode's number }
  71. mode, { inode protection mode }
  72. nlink : longint; { number of hard links }
  73. uid, { user ID of the file's owner }
  74. gid, { group ID of the file's group }
  75. dev_t : cardinal; { device type }
  76. atime, { time of last access }
  77. atime_nsec, { nsec of last access }
  78. mtime, { time of last data modification }
  79. mtime_nsec, { nsec of last data modification }
  80. ctime, { time of last file status change }
  81. ctime_nsec : longint; { nsec of last file status change }
  82. size, { file size, in bytes }
  83. blocks : Int64; { blocks allocated for file }
  84. blksze, { optimal blocksize for I/O }
  85. flags, { user defined flags for file }
  86. filegen : cardinal; { file generation number }
  87. // lspare : longint;
  88. qspare : array[0..1] of int64;
  89. end;
  90. PStat=^Stat;
  91. TStat=Stat;
  92. TStatfs = packed record
  93. spare2, { place holder}
  94. bsize, { fundamental block size}
  95. iosize, { optimal block size }
  96. blocks, { total blocks}
  97. bfree, { blocks free}
  98. bavail, { block available for mortal users}
  99. files, { Total file nodes}
  100. ffree : longint; { file nodes free}
  101. fsid : array[0..1] of longint;
  102. fowner : longint; {mounter uid}
  103. ftype : longint;
  104. fflags : longint; {copy of mount flags}
  105. spare : array [0..1] of longint; { For later use }
  106. fstypename : array[0..15] of char;
  107. mountpoint : array[0..89] of char;
  108. mnfromname : array[0..89] of char;
  109. end;
  110. PStatFS=^TStatFS;
  111. fdSet=array[0..7] of longint;{=256 bits}
  112. pfdset=^fdset;
  113. TFDSet=fdset;
  114. timeval = packed record
  115. sec,usec:longint;
  116. end;
  117. ptimeval=^timeval;
  118. TTimeVal=timeval;
  119. timespec = packed record
  120. tv_sec,tv_nsec:longint;
  121. end;
  122. timezone = packed record
  123. minuteswest,dsttime:longint;
  124. end;
  125. ptimezone =^timezone;
  126. TTimeZone = timezone;
  127. utsname = packed record
  128. sysname,
  129. nodename,
  130. release,
  131. version,
  132. machine,
  133. domainname : Array[0..64] of char;
  134. end;
  135. PUTSName=^UTSName;
  136. TUTSName=UTSName;
  137. {
  138. $Log$
  139. Revision 1.3 2003-01-21 15:39:45 marco
  140. * NetBSD first rtl. Still not 100%, but close
  141. Revision 1.2 2003/01/17 22:13:47 marco
  142. * some updates
  143. Revision 1.1.2.2 2001/08/30 23:00:18 marco
  144. * Fix for stat record.
  145. Revision 1.1.2.1 2001/08/10 11:07:17 pierre
  146. New NetBSD files taken and adapted from FreeBSD
  147. Revision 1.1.2.5 2001/03/12 15:01:39 marco
  148. * [Solaris] introduced dev_t
  149. Revision 1.1.2.4 2001/01/20 16:54:51 marco
  150. * Fixed timeval. Must have thought that long=int64 when I did initial port?
  151. Revision 1.1.2.3 2000/10/30 14:36:07 marco
  152. * timespec from int64 to longint.
  153. Revision 1.1.2.2 2000/10/24 12:14:37 pierre
  154. + timespec type for syscall_nr_nanosleep
  155. Revision 1.1.2.1 2000/09/16 11:19:08 marco
  156. * Moved files from BSD to FreeBSD directory, with some small changes
  157. Revision 1.1.2.1 2000/09/10 16:12:14 marco
  158. Initial signals, sockets and clone
  159. Revision 1.1 2000/07/13 06:30:33 michael
  160. + Initial import
  161. Revision 1.8 2000/04/16 16:08:30 marco
  162. * Updated PDir to BSD libc layout. (which is totally different from Linux)
  163. Revision 1.7 2000/04/10 15:46:52 marco
  164. * worked all day. probably a lot changed
  165. Revision 1.5 2000/03/17 12:58:57 marco
  166. * some changes to ftruncate based procs. Added a "0" as extra parameter
  167. Revision 1.4 2000/02/04 16:55:47 marco
  168. * Fixed tdir, some params need to be 32-bit
  169. Revision 1.3 2000/02/03 17:05:55 marco
  170. * Some types fixed/ported.
  171. Revision 1.2 2000/02/02 16:45:38 marco
  172. * Typo in STAT record
  173. Revision 1.1 2000/02/02 16:36:09 marco
  174. * Initial version. Copy of linux version, with BSD stat.
  175. }