systypes.inc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. }
  26. SysCallRegs=record
  27. reg1,reg2,reg3,reg4,reg5,reg6 : longint;
  28. end;
  29. PSysCallRegs=^SysCallRegs;
  30. TSysCallRegs=SysCallRegs;
  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. Stat =record {BSD version}
  67. dev, { inode's device }
  68. ino : cardinal; { inode's number }
  69. mode, { inode protection mode }
  70. nlink : word; { number of hard links }
  71. uid, { user ID of the file's owner }
  72. gid, { group ID of the file's group }
  73. dev_t : cardinal; { device type }
  74. atime, { time of last access }
  75. atime_nsec, { nsec of last access }
  76. mtime, { time of last data modification }
  77. mtime_nsec, { nsec of last data modification }
  78. ctime, { time of last file status change }
  79. ctime_nsec : longint; { nsec of last file status change }
  80. size, { file size, in bytes }
  81. blocks : Int64; { blocks allocated for file }
  82. blksze, { optimal blocksize for I/O }
  83. flags, { user defined flags for file }
  84. filegen : cardinal; { file generation number }
  85. lspare : longint;
  86. qspare : array[0..1] of int64;
  87. end;
  88. PStat=^Stat;
  89. TStat=Stat;
  90. Statfs = packed record
  91. spare2, { place holder}
  92. bsize, { fundamental block size}
  93. iosize, { optimal block size }
  94. blocks, { total blocks}
  95. bfree, { blocks free}
  96. bavail, { block available for mortal users}
  97. files, { Total file nodes}
  98. ffree : longint; { file nodes free}
  99. fsid : array[0..1] of longint;
  100. fowner : longint; {mounter uid}
  101. ftype : longint;
  102. fflags : longint; {copy of mount flags}
  103. spare : array [0..1] of longint; { For later use }
  104. fstypename : array[0..15] of char;
  105. mountpoint : array[0..89] of char;
  106. mnfromname : array[0..89] of char;
  107. end;
  108. PStatFS=^StatFS;
  109. TStatFS=StatFS;
  110. fdSet=array[0..7] of longint;{=256 bits}
  111. pfdset=^fdset;
  112. TFDSet=fdset;
  113. timeval = packed record
  114. sec,usec:int64;
  115. end;
  116. ptimeval=^timeval;
  117. TTimeVal=timeval;
  118. timezone = packed record
  119. minuteswest,dsttime:longint;
  120. end;
  121. ptimezone =^timezone;
  122. TTimeZone = timezone;
  123. utsname = packed record
  124. sysname,
  125. nodename,
  126. release,
  127. version,
  128. machine,
  129. domainname : Array[0..64] of char;
  130. end;
  131. PUTSName=^UTSName;
  132. TUTSName=UTSName;
  133. {
  134. $Log$
  135. Revision 1.8 2000-04-16 16:08:30 marco
  136. * Updated PDir to BSD libc layout. (which is totally different from Linux)
  137. Revision 1.7 2000/04/10 15:46:52 marco
  138. * worked all day. probably a lot changed
  139. Revision 1.5 2000/03/17 12:58:57 marco
  140. * some changes to ftruncate based procs. Added a "0" as extra parameter
  141. Revision 1.4 2000/02/04 16:55:47 marco
  142. * Fixed tdir, some params need to be 32-bit
  143. Revision 1.3 2000/02/03 17:05:55 marco
  144. * Some types fixed/ported.
  145. Revision 1.2 2000/02/02 16:45:38 marco
  146. * Typo in STAT record
  147. Revision 1.1 2000/02/02 16:36:09 marco
  148. * Initial version. Copy of linux version, with BSD stat.
  149. }