bunxtype.inc 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. Types and structures for the BaseUnix unit.
  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. {***********************************************************************}
  13. { Base Unix Structures }
  14. {***********************************************************************}
  15. {$IFDEF FPC_IS_SYSTEM}
  16. {$i ptypes.inc}
  17. {$ENDIF}
  18. CONST
  19. UTSNAME_LENGTH = 256; { 256 + 1 in pchar format }
  20. UTSNAME_NODENAME_LENGTH = 256;
  21. ST_FSTYPSZ = 16; {* array size for file system type name *}
  22. TYPE
  23. { the following type definitions are compiler dependant }
  24. { and system dependant }
  25. cint = longint; { minimum range is : 32-bit }
  26. cuint = cardinal; { minimum range is : 32-bit }
  27. dev_t = longint; { used for device numbers }
  28. gid_t = longint; { used for group IDs }
  29. ino_t = cardinal; { used for file serial numbers }
  30. mode_t = cardinal; { used for file attributes }
  31. nlink_t = cardinal; { used for link counts }
  32. off_t = longint; { used for file sizes }
  33. pid_t = longint; { used as process identifier }
  34. size_t = cardinal; { as definied in the C standard }
  35. ssize_t = longint; { used by function for returning number of bytes }
  36. uid_t = longint; { used for user ID type }
  37. time_t = longint; { used for returning the time }
  38. blksize_t = longint;
  39. blkcnt_t = longint;
  40. { file characteristics services }
  41. stat = packed record { verify the alignment of the members }
  42. st_dev : dev_t;
  43. st_pad1 : array[1..3] of longint; { reserve for dev expansion }
  44. st_ino : ino_t;
  45. st_mode : mode_t;
  46. st_nlink : nlink_t;
  47. st_uid : uid_t;
  48. st_gid : gid_t;
  49. st_rdev : dev_t;
  50. st_pad2 : array[1..2] of longint;
  51. st_size : off_t;
  52. st_pad3 : longint; {* reserve pad for future off_t expansion *}
  53. st_atime : time_t;
  54. st_atimens : longint; { access time nanosecond field }
  55. st_mtime : time_t;
  56. st_mtimens : longint; { modification time nanosecond field }
  57. st_ctime : time_t;
  58. st_ctimens : longint; { modification time nanosecond field }
  59. st_blksize : blksize_t;
  60. st_blocks : blkcnt_t;
  61. st_fstype : array[0..ST_FSTYPSZ-1] of char;
  62. st_pad4 : array[1..8] of longint;
  63. end;
  64. TStat = Stat;
  65. PStat = ^Stat;
  66. { system information services }
  67. utsname = packed record { don't forget to verify the alignment }
  68. sysname : array[0..UTSNAME_LENGTH] of char;
  69. nodename : array[0..UTSNAME_LENGTH] of char;
  70. release : array[0..UTSNAME_LENGTH] of char;
  71. version : array[0..UTSNAME_LENGTH] of char;
  72. machine : array[0..UTSNAME_LENGTH] of char;
  73. end;
  74. { directory services }
  75. pdirent = ^dirent;
  76. dirent = packed record { directory entry record - verify alignment }
  77. d_ino : ino_t; {* "inode number" of entry *}
  78. d_off : off_t; {* offset of disk directory entry *}
  79. d_reclen : word; {* length of this record *}
  80. d_name : array[0..255] of char; { name of file }
  81. end;
  82. pdir = ^dir;
  83. dir = packed record
  84. d_fd : cint; {* file descriptor *}
  85. d_loc : cint; {* offset in block *}
  86. d_size : cint; {* amount of valid data *}
  87. d_buf : pchar; { directory block }
  88. end;
  89. {***********************************************************************}
  90. { POSIX CONSTANT ROUTINE DEFINITIONS }
  91. {***********************************************************************}
  92. CONST
  93. { access routine - these maybe OR'ed together }
  94. F_OK = 0; { test for existence of file }
  95. R_OK = 4; { test for read permission on file }
  96. W_OK = 2; { test for write permission on file }
  97. X_OK = 1; { test for execute or search permission }
  98. { seek routine }
  99. SEEK_SET = 0; { seek from beginning of file }
  100. SEEK_CUR = 1; { seek from current position }
  101. SEEK_END = 2; { seek from end of file }
  102. { open routine }
  103. { File access modes for `open' and `fcntl'. }
  104. O_RDONLY = 0; { Open read-only. }
  105. O_WRONLY = 1; { Open write-only. }
  106. O_RDWR = 2; { Open read/write. }
  107. { Bits OR'd into the second argument to open. }
  108. O_CREAT = $100; { Create file if it doesn't exist. }
  109. O_EXCL = $400; { Fail if file already ??????. }
  110. O_TRUNC = $200; { Truncate file to zero length. }
  111. O_NOCTTY = $800; { Don't assign a controlling terminal. }
  112. { File status flags for `open' and `fcntl'. }
  113. O_APPEND = $08; { Writes append to the file. }
  114. O_NONBLOCK = $80; { Non-blocking I/O. }
  115. { mode_t possible values }
  116. S_IRUSR = $100; { Read permission for owner }
  117. S_IWUSR = $080; { Write permission for owner }
  118. S_IXUSR = $040; { Exec permission for owner }
  119. S_IRGRP = $020; { Read permission for group }
  120. S_IWGRP = $010; { Write permission for group }
  121. S_IXGRP = $008; { Exec permission for group }
  122. S_IROTH = $004; { Read permission for world }
  123. S_IWOTH = $002; { Write permission for world }
  124. S_IXOTH = $001; { Exec permission for world }
  125. { Used for waitpid }
  126. WNOHANG = $40; { don't block waiting }
  127. WUNTRACED = $04; { report status of stopped children }
  128. { POSIX limits, used for buffer and stack allocation }
  129. ARG_MAX = 1048320; { Maximum number of argument size }
  130. { Maximum number of bytes in filename - depends on file system }
  131. { type, and no define possible, TRUE value is available through}
  132. { pathconf variable. }
  133. NAME_MAX = 1024; { put a big value , just in case }
  134. PATH_MAX = 1024; { Maximum number of bytes in pathname }
  135. {$i signal.inc}
  136. {
  137. $Log$
  138. Revision 1.1 2004-11-06 22:22:28 florian
  139. * some sunos stuff from 1.0.x merged
  140. }