|
@@ -1,56 +1,144 @@
|
|
{
|
|
{
|
|
$Id$
|
|
$Id$
|
|
- Copyright (c) 2000-2002 by Marco van de Voort
|
|
|
|
|
|
+ This file is part of the Free Pascal run time library.
|
|
|
|
+ Copyright (c) 2001 by Free Pascal development team
|
|
|
|
|
|
- Some non POSIX BSD types used internally in the system unit.
|
|
|
|
|
|
+ Types and structures for the BaseUnix unit.
|
|
|
|
|
|
- This program is free software; you can redistribute it and/or modify
|
|
|
|
- it under the terms of the GNU General Public License as published by
|
|
|
|
- the Free Software Foundation; either version 2 of the License, or
|
|
|
|
- (at your option) any later version.
|
|
|
|
|
|
+ See the file COPYING.FPC, included in this distribution,
|
|
|
|
+ for details about the copyright.
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
- GNU General Public License for more details.
|
|
|
|
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
- You should have received a copy of the GNU General Public License
|
|
|
|
- along with this program; if not, write to the Free Software
|
|
|
|
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
+ ***********************************************************************}
|
|
|
|
|
|
- ****************************************************************************
|
|
|
|
-}
|
|
|
|
|
|
+{***********************************************************************}
|
|
|
|
+{ Base Unix Structures }
|
|
|
|
+{***********************************************************************}
|
|
|
|
+
|
|
|
|
+{$IFDEF FPC_IS_SYSTEM}
|
|
|
|
+ {$i ptypes.inc}
|
|
|
|
+{$ENDIF}
|
|
|
|
|
|
-(*
|
|
|
|
-Type
|
|
|
|
- timezone = packed record
|
|
|
|
- tz_minuteswest,
|
|
|
|
- tz_dsttime : cint;
|
|
|
|
- end;
|
|
|
|
- ptimezone =^timezone;
|
|
|
|
- TTimeZone = timezone;
|
|
|
|
- rusage = packed record
|
|
|
|
- ru_utime : timeval; { user time used }
|
|
|
|
- ru_stime : timeval; { system time used }
|
|
|
|
- ru_maxrss : clong; { max resident set size }
|
|
|
|
- ru_ixrss : clong; { integral shared memory size }
|
|
|
|
- ru_idrss : clong; { integral unshared data " }
|
|
|
|
- ru_isrss : clong; { integral unshared stack " }
|
|
|
|
- ru_minflt : clong; { page reclaims }
|
|
|
|
- ru_majflt : clong; { page faults }
|
|
|
|
- ru_nswap : clong; { swaps }
|
|
|
|
- ru_inblock : clong; { block input operations }
|
|
|
|
- ru_oublock : clong; { block output operations }
|
|
|
|
- ru_msgsnd : clong; { messages sent }
|
|
|
|
- ru_msgrcv : clong; { messages received }
|
|
|
|
- ru_nsignals : clong; { signals received }
|
|
|
|
- ru_nvcsw : clong; { voluntary context switches }
|
|
|
|
- ru_nivcsw : clong; { involuntary " }
|
|
|
|
- end;
|
|
|
|
-// #define ru_last ru_nivcsw
|
|
|
|
-// #define ru_first ru_ixrss
|
|
|
|
-{ auto generated by a c prog, statmacr.c}
|
|
|
|
-*)
|
|
|
|
|
|
+CONST
|
|
|
|
+ FD_MAXFDSET = 1024;
|
|
|
|
+ BITSINWORD = 8*sizeof(longint);
|
|
|
|
+ wordsinsigset = SIG_MAXSIG DIV BITSINWORD; // words in sigset_t
|
|
|
|
+ wordsinfdset = FD_MAXFDSET DIV BITSINWORD; // words in fdset_t
|
|
|
|
+ ln2bitsinword = 5; { 32bit : ln(32)/ln(2)=5 }
|
|
|
|
+ ln2bitmask = 1 shl ln2bitsinword - 1;
|
|
|
|
+
|
|
|
|
+ UTSNAME_LENGTH = 256; { 256 + 1 in pchar format }
|
|
|
|
+ UTSNAME_NODENAME_LENGTH = 256;
|
|
|
|
+
|
|
|
|
+ ST_FSTYPSZ = 16; {* array size for file system type name *}
|
|
|
|
+
|
|
|
|
+TYPE
|
|
|
|
+ blksize_t = longint;
|
|
|
|
+ blkcnt_t = longint;
|
|
|
|
+
|
|
|
|
+ { file characteristics services }
|
|
|
|
+ stat = packed record { verify the alignment of the members }
|
|
|
|
+ st_dev : dev_t;
|
|
|
|
+ st_pad1 : array[1..3] of longint; { reserve for dev expansion }
|
|
|
|
+ st_ino : ino_t;
|
|
|
|
+ st_mode : mode_t;
|
|
|
|
+ st_nlink : nlink_t;
|
|
|
|
+ st_uid : uid_t;
|
|
|
|
+ st_gid : gid_t;
|
|
|
|
+ st_rdev : dev_t;
|
|
|
|
+ st_pad2 : array[1..2] of longint;
|
|
|
|
+ st_size : off_t;
|
|
|
|
+ st_pad3 : longint; {* reserve pad for future off_t expansion *}
|
|
|
|
+ st_atime : time_t;
|
|
|
|
+ st_atimens : longint; { access time nanosecond field }
|
|
|
|
+ st_mtime : time_t;
|
|
|
|
+ st_mtimens : longint; { modification time nanosecond field }
|
|
|
|
+ st_ctime : time_t;
|
|
|
|
+ st_ctimens : longint; { modification time nanosecond field }
|
|
|
|
+ st_blksize : blksize_t;
|
|
|
|
+ st_blocks : blkcnt_t;
|
|
|
|
+ st_fstype : array[0..ST_FSTYPSZ-1] of char;
|
|
|
|
+ st_pad4 : array[1..8] of longint;
|
|
|
|
+ end;
|
|
|
|
+ TStat = Stat;
|
|
|
|
+ PStat = ^Stat;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ { system information services }
|
|
|
|
+ utsname = packed record { don't forget to verify the alignment }
|
|
|
|
+ sysname : array[0..UTSNAME_LENGTH] of char;
|
|
|
|
+ nodename : array[0..UTSNAME_LENGTH] of char;
|
|
|
|
+ release : array[0..UTSNAME_LENGTH] of char;
|
|
|
|
+ version : array[0..UTSNAME_LENGTH] of char;
|
|
|
|
+ machine : array[0..UTSNAME_LENGTH] of char;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ { directory services }
|
|
|
|
+ pdirent = ^dirent;
|
|
|
|
+ dirent = packed record { directory entry record - verify alignment }
|
|
|
|
+ d_ino : ino_t; {* "inode number" of entry *}
|
|
|
|
+ d_off : off_t; {* offset of disk directory entry *}
|
|
|
|
+ d_reclen : word; {* length of this record *}
|
|
|
|
+ d_name : array[0..255] of char; { name of file }
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ pdir = ^dir;
|
|
|
|
+ dir = packed record
|
|
|
|
+ d_fd : cint; {* file descriptor *}
|
|
|
|
+ d_loc : cint; {* offset in block *}
|
|
|
|
+ d_size : cint; {* amount of valid data *}
|
|
|
|
+ d_buf : pchar; { directory block }
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+{***********************************************************************}
|
|
|
|
+{ POSIX CONSTANT ROUTINE DEFINITIONS }
|
|
|
|
+{***********************************************************************}
|
|
|
|
+CONST
|
|
|
|
+ { access routine - these maybe OR'ed together }
|
|
|
|
+ F_OK = 0; { test for existence of file }
|
|
|
|
+ R_OK = 4; { test for read permission on file }
|
|
|
|
+ W_OK = 2; { test for write permission on file }
|
|
|
|
+ X_OK = 1; { test for execute or search permission }
|
|
|
|
+ { seek routine }
|
|
|
|
+ SEEK_SET = 0; { seek from beginning of file }
|
|
|
|
+ SEEK_CUR = 1; { seek from current position }
|
|
|
|
+ SEEK_END = 2; { seek from end of file }
|
|
|
|
+ { open routine }
|
|
|
|
+ { File access modes for `open' and `fcntl'. }
|
|
|
|
+ O_RDONLY = 0; { Open read-only. }
|
|
|
|
+ O_WRONLY = 1; { Open write-only. }
|
|
|
|
+ O_RDWR = 2; { Open read/write. }
|
|
|
|
+ { Bits OR'd into the second argument to open. }
|
|
|
|
+ O_CREAT = $100; { Create file if it doesn't exist. }
|
|
|
|
+ O_EXCL = $400; { Fail if file already ??????. }
|
|
|
|
+ O_TRUNC = $200; { Truncate file to zero length. }
|
|
|
|
+ O_NOCTTY = $800; { Don't assign a controlling terminal. }
|
|
|
|
+ { File status flags for `open' and `fcntl'. }
|
|
|
|
+ O_APPEND = $08; { Writes append to the file. }
|
|
|
|
+ O_NONBLOCK = $80; { Non-blocking I/O. }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ { mode_t possible values }
|
|
|
|
+ S_IRUSR = $100; { Read permission for owner }
|
|
|
|
+ S_IWUSR = $080; { Write permission for owner }
|
|
|
|
+ S_IXUSR = $040; { Exec permission for owner }
|
|
|
|
+ S_IRGRP = $020; { Read permission for group }
|
|
|
|
+ S_IWGRP = $010; { Write permission for group }
|
|
|
|
+ S_IXGRP = $008; { Exec permission for group }
|
|
|
|
+ S_IROTH = $004; { Read permission for world }
|
|
|
|
+ S_IWOTH = $002; { Write permission for world }
|
|
|
|
+ S_IXOTH = $001; { Exec permission for world }
|
|
|
|
+
|
|
|
|
+ { Used for waitpid }
|
|
|
|
+ WNOHANG = $40; { don't block waiting }
|
|
|
|
+ WUNTRACED = $04; { report status of stopped children }
|
|
|
|
|
|
Const
|
|
Const
|
|
S_IFMT = 61440;
|
|
S_IFMT = 61440;
|
|
@@ -71,47 +159,17 @@ CONST
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-{
|
|
|
|
- $Log$
|
|
|
|
- Revision 1.1 2005-02-10 17:30:54 peter
|
|
|
|
- * renamed to solaris
|
|
|
|
-
|
|
|
|
- Revision 1.1 2005/02/07 22:17:26 peter
|
|
|
|
- * updated for 1.9.x unix rtl
|
|
|
|
-
|
|
|
|
- Revision 1.7 2005/02/06 12:16:52 peter
|
|
|
|
- * bsd thread updates
|
|
|
|
-
|
|
|
|
- Revision 1.6 2004/12/02 11:22:11 marco
|
|
|
|
- * tz_ prefixed for timezone
|
|
|
|
|
|
+{$i signal.inc}
|
|
|
|
|
|
- Revision 1.5 2003/09/27 13:45:58 peter
|
|
|
|
- * fpnanosleep exported in baseunix
|
|
|
|
- * fpnanosleep has pointer arguments to be C compliant
|
|
|
|
|
|
|
|
- Revision 1.4 2003/09/17 11:52:05 marco
|
|
|
|
- * stat macro fixes voor BSD
|
|
|
|
-
|
|
|
|
- Revision 1.3 2003/09/15 07:23:51 marco
|
|
|
|
- * fix
|
|
|
|
-
|
|
|
|
- Revision 1.2 2003/09/14 20:15:01 marco
|
|
|
|
- * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
|
|
|
|
-
|
|
|
|
- Revision 1.1 2003/01/05 19:01:28 marco
|
|
|
|
- * FreeBSD compiles now with baseunix mods.
|
|
|
|
-
|
|
|
|
- Revision 1.4 2002/10/27 17:21:29 marco
|
|
|
|
- * Only "difficult" functions + execvp + termios + rewinddir left to do
|
|
|
|
-
|
|
|
|
- Revision 1.3 2002/10/27 11:58:30 marco
|
|
|
|
- * Modifications from Saturday.
|
|
|
|
-
|
|
|
|
- Revision 1.2 2002/09/07 16:01:17 peter
|
|
|
|
- * old logs removed and tabs fixed
|
|
|
|
-
|
|
|
|
- Revision 1.1 2002/08/19 12:29:11 marco
|
|
|
|
- * First working POSIX *BSD system unit.
|
|
|
|
|
|
+{
|
|
|
|
+ $Log$
|
|
|
|
+ Revision 1.2 2005-02-13 22:13:20 peter
|
|
|
|
+ * get solaris back in shape
|
|
|
|
|
|
|
|
+ Revision 1.1 2005/02/10 17:30:54 peter
|
|
|
|
+ * renamed to solaris
|
|
|
|
|
|
|
|
+ Revision 1.1 2004/11/06 22:22:28 florian
|
|
|
|
+ * some sunos stuff from 1.0.x merged
|
|
}
|
|
}
|