osposixh.inc 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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 types used in POSIX for BeOS
  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. { POSIX TYPE DEFINITIONS }
  14. {***********************************************************************}
  15. type
  16. { the following type definitions are compiler dependant }
  17. { and system dependant }
  18. cint = longint; { minimum range is : 32-bit }
  19. cuint = cardinal; { minimum range is : 32-bit }
  20. dev_t = cint; { used for device numbers }
  21. gid_t = cuint; { used for group IDs }
  22. ino_t = int64; { used for file serial numbers }
  23. mode_t = cuint; { used for file attributes }
  24. nlink_t = cint; { used for link counts }
  25. off_t = int64; { used for file sizes }
  26. pid_t = cint; { used as process identifier }
  27. size_t = cint; { as definied in the C standard }
  28. ssize_t = cint; { used by function for returning number of bytes }
  29. uid_t = cuint; { used for user ID type }
  30. time_t = cint; { used for returning the time }
  31. sigset_t = cuint; { used for additional signal }
  32. {***********************************************************************}
  33. { POSIX STRUCTURES }
  34. {***********************************************************************}
  35. CONST
  36. _UTSNAME_LENGTH = 32;
  37. _UTSNAME_NODENAME_LENGTH = _UTSNAME_LENGTH;
  38. TYPE
  39. { system information services }
  40. utsname = packed record { don't forget to verify the alignment }
  41. { Name of this implementation of the operating systems (POSIX) }
  42. sysname : array[0.._UTSNAME_LENGTH+1] of char;
  43. { Name of this node (POSIX) }
  44. nodename : array[0.._UTSNAME_NODENAME_LENGTH+1] of char;
  45. { Current release level of this implementation (POSIX) }
  46. release : array[0.._UTSNAME_LENGTH+1] of char;
  47. { Current version level of this release (POSX) }
  48. version : array[0.._UTSNAME_LENGTH+1] of char;
  49. { Name of the hardware type on which the system is running (POSIX) }
  50. machine : array[0.._UTSNAME_LENGTH+1] of char;
  51. end;
  52. { file characteristics services }
  53. stat = packed record { verify the alignment of the members }
  54. st_dev : dev_t; { Device containing the file (POSIX) }
  55. st_ino : ino_t; { File serial number (POSIX) }
  56. st_mode: mode_t; { File mode (POSIX) }
  57. st_nlink: nlink_t; { Link count (POSIX) }
  58. st_uid: uid_t; { User ID of the file's owner. (POSIX)}
  59. st_gid: gid_t; { Group ID of the file's group.(POSIX)}
  60. st_size : off_t; { Size of file, in bytes. (POSIX)}
  61. st_rdev : dev_t; { Device type (not used). }
  62. st_blksize: cardinal;{ Preferred block size for I/O. }
  63. st_atime: time_t; { Time of last access (POSIX) }
  64. st_mtime: time_t; { Time of last modification (POSIX) }
  65. st_ctime: time_t; { Time of last status change (POSIX) }
  66. st_crtime: time_t; { Time of creation }
  67. end;
  68. { directory services }
  69. pdirent = ^dirent;
  70. dirent = packed record { directory entry record - verify alignment }
  71. d_dev: dev_t;
  72. d_pdev: dev_t;
  73. d_fileno: ino_t;
  74. d_pino: ino_t;
  75. d_reclen:word;
  76. d_name:array[0..255] of char; { Filename in DIRENT (POSIX) }
  77. end;
  78. pdir = ^dir;
  79. dir = packed record
  80. fd : cint; { file descriptor }
  81. ent : dirent; { directory entry }
  82. end;
  83. sighandler_t = procedure (signo: cint); cdecl;
  84. { signal services }
  85. sigactionrec = packed record
  86. sa_handler : sighandler_t; { pointer to a function (POSIX.1) }
  87. sa_mask : sigset_t; { additional signal masks (POSIX.1) }
  88. sa_flags : cint; { special flags for signals (POSIX.1) }
  89. sa_userdata : pointer;
  90. end;
  91. {***********************************************************************}
  92. { POSIX CONSTANT ROUTINE DEFINITIONS }
  93. {***********************************************************************}
  94. CONST
  95. { access routine - these maybe OR'ed together }
  96. F_OK = 0; { test for existence of file }
  97. R_OK = 4; { test for read permission on file }
  98. W_OK = 2; { test for write permission on file }
  99. X_OK = 1; { test for execute or search permission }
  100. { seek routine }
  101. SEEK_SET = 0; { seek from beginning of file }
  102. SEEK_CUR = 1; { seek from current position }
  103. SEEK_END = 2; { seek from end of file }
  104. { open routine }
  105. { File access modes for `open' and `fcntl'. }
  106. O_RDONLY = 0; { Open read-only. }
  107. O_WRONLY = 1; { Open write-only. }
  108. O_RDWR = 2; { Open read/write. }
  109. { Bits OR'd into the second argument to open. }
  110. O_CREAT =$0200; { Create file if it doesn't exist. }
  111. O_EXCL =$0100; { Fail if file already exists. }
  112. O_TRUNC =$0400; { Truncate file to zero length. }
  113. O_NOCTTY =$1000; { Don't assign a controlling terminal. }
  114. { File status flags for `open' and `fcntl'. }
  115. O_APPEND =$0800; { Writes append to the file. }
  116. O_NONBLOCK =$0080; { Non-blocking I/O. }
  117. { mode_t possible values }
  118. S_IRUSR = $0100; { Read permission for owner }
  119. S_IWUSR = $0080; { Write permission for owner }
  120. S_IXUSR = $0040; { Exec permission for owner }
  121. S_IRGRP = S_IRUSR shr 3; { Read permission for group }
  122. S_IWGRP = S_IWUSR shr 3; { Write permission for group }
  123. S_IXGRP = S_IWUSR shr 3; { Exec permission for group }
  124. S_IROTH = S_IRGRP shr 3; { Read permission for world }
  125. S_IWOTH = S_IWGRP shr 3; { Write permission for world }
  126. S_IXOTH = S_IXGRP shr 3; { Exec permission for world }
  127. { Used for waitpid }
  128. WNOHANG = 1; { don't block waiting }
  129. WUNTRACED = 2; { report status of stopped children }
  130. {************************ signals *****************************}
  131. { more can be provided. Herein are only included the required }
  132. { values. }
  133. {**************************************************************}
  134. SIGABRT = 6; { abnormal termination }
  135. SIGALRM = 14; { alarm clock (used with alarm() }
  136. SIGFPE = 8; { illegal arithmetic operation }
  137. SIGHUP = 1; { Hangup }
  138. SIGILL = 4; { Illegal instruction }
  139. SIGINT = 2; { Interactive attention signal }
  140. SIGKILL = 9; { Kill, cannot be caught }
  141. SIGPIPE = 7; { Broken pipe signal }
  142. SIGQUIT = 3; { Interactive termination signal }
  143. SIGSEGV = 11; { Detection of invalid memory reference }
  144. SIGTERM = 15; { Termination request }
  145. SIGUSR1 = 18; { Application defined signal 1 }
  146. SIGUSR2 = 19; { Application defined signal 2 }
  147. SIGCHLD = 5; { Child process terminated / stopped }
  148. SIGCONT = 12; { Continue if stopped }
  149. SIGSTOP = 10; { Stop signal. cannot be cuaght }
  150. SIGSTP = 13; { Interactive stop signal }
  151. SIGTTIN = 16; { Background read from TTY }
  152. SIGTTOU = 17; { Background write to TTY }
  153. SIGBUS = SIGSEGV; { Access to undefined memory }
  154. { POSIX limits }
  155. ARG_MAX = 128*1024; { Maximum number of arguments }
  156. NAME_MAX = 256; { Maximum number of bytes in a filename }
  157. PATH_MAX = 1024; { Maximum number of bytes in a pathname }
  158. {
  159. $Log$
  160. Revision 1.2 2003-01-08 22:32:28 marco
  161. * Small fixes and quick merge with 1.0.x. At least the compiler builds now,
  162. but it could crash hard, since there are lots of unimplemented funcs.
  163. Revision 1.1.2.7 2001/07/21 19:17:11 carl
  164. + added MAX_ARGS define
  165. Revision 1.1.2.6 2001/07/08 04:45:28 carl
  166. + updated type definitions
  167. Revision 1.1.2.5 2001/07/07 15:41:42 carl
  168. + added missing definitions
  169. Revision 1.1.2.4 2001/07/07 04:38:54 carl
  170. + added missing S_X constants
  171. Revision 1.1.2.3 2001/07/06 12:07:05 carl
  172. * correct definitions
  173. Revision 1.1.2.2 2001/07/06 11:59:35 carl
  174. + added missing constants
  175. (still missing mode_t bit definitions)
  176. Revision 1.1.2.1 2001/07/06 02:59:56 carl
  177. + first revision for BeOS
  178. }