Browse Source

* include file cleanup part 2

peter 20 years ago
parent
commit
4534feb917

+ 0 - 270
rtl/bsd/bunxtype.inc

@@ -1,270 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Free Pascal development team
-
-    Types and structures for baseunix unit, also used in system.
-
-    This file implements all the types/constants which must
-    be defined to port FPC to a new POSIX compliant OS.
-
-    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,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{***********************************************************************}
-{                         POSIX STRUCTURES                              }
-{***********************************************************************}
-
-{$ifdef FPC_IS_SYSTEM}
-{$i ptypes.inc}
-{$ENDIF}
-
-{$ifdef cpupowerpc}
-  {$ifdef netbsd}
-    {$define netbsdpowerpc}
-  {$endif}
-{$endif}
-
-//      CONST SYS_NMLN=65;
-
-// Can't find these two in Posix and in FreeBSD
-//CONST
-//    _UTSNAME_LENGTH = ;
-//    _UTSNAME_NODENAME_LENGTH = ;
-
-CONST                		// OS specific parameters for general<fd,sig>set behaviour
-   BITSINWORD      = 8*sizeof(longint);
-   FD_MAXFDSET	   = 1024;
-   ln2bitsinword   = 5;         { 32bit : ln(32)/ln(2)=5 } 
-   ln2bitmask	   = 1 shl ln2bitsinword - 1;
-   wordsinfdset    = FD_MAXFDSET DIV BITSINWORD;        // words in fdset_t   
-   wordsinsigset   = SIG_MAXSIG  DIV BITSINWORD;
-
-TYPE
-   { system information services }
-   utsname = record
-              sysname : Array[0..SYS_NMLN-1] OF Char;   // Name of this OS
-              nodename: Array[0..SYS_NMLN-1] OF Char;   // Name of this network node.
-              release : Array[0..SYS_NMLN-1] OF Char;   // Release level.
-              version : Array[0..SYS_NMLN-1] OF Char;   // Version level.
-              machine : Array[0..SYS_NMLN-1] OF Char;   // Hardware type.
-             end;
-  TUtsName= utsname;
-  pUtsName= ^utsname;
-
-  { file characteristics services }
-   stat    = record { the types are real}
-        st_dev        : dev_t;             // inode's device
-        st_ino        : ino_t;             // inode's number
-        st_mode       : mode_t;            // inode protection mode
-        st_nlink      : nlink_t;           // number of hard links
-        st_uid        : uid_t;             // user ID of the file's owner
-        st_gid        : gid_t;             // group ID of the file's group
-        st_rdev       : dev_t;             // device type
-        st_atime      : time_t;            // time of last access
-        st_atimensec  : clong;             // nsec of last access
-        st_mtime      : time_t;            // time of last data modification
-        st_mtimensec  : clong;             // nsec of last data modification
-        st_ctime      : time_t;            // time of last file status change
-        st_ctimensec  : clong;             // nsec of last file status change
-{$ifdef netbsdPowerpc}
-	st_padd1	      : cint;
-{$endif}
-        st_size       : off_t;             // file size, in bytes
-        st_blocks     : cint64;            // blocks allocated for file
-        st_blksize    : cuint32;           // optimal blocksize for I/O
-        st_flags      : cuint32;           // user defined flags for file
-        st_gen        : cuint32;           // file generation number
-{$ifdef netbsdPowerpc}
-	st_padd2	      : cint;
-{$endif}
-{$ifndef NetBSD}
-        st_lspare     : cint32;
-{$endif}
-        st_qspare     : array[0..1] Of cint64;
-   end;
-   TStat = stat;
-   pStat = ^stat;
-
-  { directory services }
-   dirent  = record
-        d_fileno      : cuint32;                        // file number of entry
-        d_reclen      : cuint16;                        // length of this record
-        d_type        : cuint8;                         // file type, see below
-        d_namlen      : cuint8;                         // length of string in d_name
-        d_name        : array[0..(255 + 1)-1] of char;  // name must be no longer than this
-   end;
-   TDirent = dirent;
-   pDirent = ^dirent;
-
-   dir     = packed record
-        dd_fd     : cint;         // file descriptor associated with directory
-        dd_loc    : clong;        // offset in current buffer
-        dd_size   : clong;        // amount of data returned by getdirentries
-        dd_buf    : pchar;        // data buffer
-        dd_len    : cint;         // size of data buffer
-{$ifdef netbsdpowerpc}
-	dd_pad1   : cint;
-        dd_seek   : cint64;        // magic cookie returned by getdirentries
-{$else}
-        dd_seek   : clong;        // magic cookie returned by getdirentries
-{$endif}
-        dd_rewind : clong;        // magic cookie for rewinding
-        dd_flags  : cint;         // flags for readdir
-   end;
-   TDir    = dir;
-   pDir    = ^dir;
-
-   utimbuf  = record
-	        actime  : time_t;
-	        modtime : time_t;
-	        end;
-   TUtimBuf = utimbuf;
-   putimbuf = ^utimbuf;
-
-   flock    = record
-		l_start : off_t;	{ starting offset }
-		l_len	: off_t;	{ len = 0 means until end of file }
-		l_pid 	: pid_t;	{ lock owner }
-		l_type	: cshort;	{ lock type: read/write, etc. }
-		l_whence: cshort;	{ type of l_start }
-                end;
-   TFlock   = flock;
-   pFlock   = ^flock;
-
- tms = packed record
-	 tms_utime  : clock_t;	{ User CPU time }
-	 tms_stime  : clock_t;	{ System CPU time }
-	 tms_cutime : clock_t;	{ User CPU time of terminated child procs }
-	 tms_cstime : clock_t;	{ System CPU time of terminated child procs }
-	 end;
- TTms= tms;
- pTms= ^tms;
-
- TFDSet    = ARRAY[0..(FD_MAXFDSET div 32)-1] of Cardinal;
- pFDSet    = ^TFDSet;
-
-{***********************************************************************}
-{                  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     =  $200;        { Create file if it doesn't exist.  }
-    O_EXCL      =  $800;        { Fail if file already exists.      }
-    O_TRUNC     =  $400;        { Truncate file to zero length.     }
-    O_NOCTTY    = $8000;        { Don't assign a controlling terminal. }
-    { File status flags for `open' and `fcntl'.  }
-    O_APPEND    =     8;        { Writes append to the file.        }
-    O_NONBLOCK  =     4;        { Non-blocking I/O.                 }
-
-    { mode_t possible values                                 }
-    S_IRUSR =  %0100000000;     { Read permission for owner   }
-    S_IWUSR =  %0010000000;     { Write permission for owner  }
-    S_IXUSR =  %0001000000;     { Exec  permission for owner  }
-    S_IRGRP =  %0000100000;     { Read permission for group   }
-    S_IWGRP =  %0000010000;     { Write permission for group  }
-    S_IXGRP =  %0000001000;     { Exec permission for group   }
-    S_IROTH =  %0000000100;     { Read permission for world   }
-    S_IWOTH =  %0000000010;     { Write permission for world  }
-    S_IXOTH =  %0000000001;     { Exec permission for world   }
-
-    { Used for waitpid }
-    WNOHANG   =          1;     { don't block waiting               }
-    WUNTRACED =          2;     { report status of stopped children }
-
-
-  { For File control mechanism }
-  F_GetFd  = 1;
-  F_SetFd  = 2;
-  F_GetFl  = 3;
-  F_SetFl  = 4;
-  F_GetLk  = 5;
-  F_SetLk  = 6;
-  F_SetLkW = 7;
-  F_SetOwn = 8;
-  F_GetOwn = 9;
-
-
-
-    {*************************************************************************}
-    {                               SIGNALS                                   }
-    {*************************************************************************}
-
-{$i signal.inc}
-
-// function geterrno:longint;
-// procedure seterrno(i:longint);
-
-{
-  $Log$
-  Revision 1.9  2004-03-04 22:15:16  marco
-   * UnixType changes. Please report problems to me.
-
-  Revision 1.8  2004/02/29 13:46:52  marco
-   * forgotten?
-
-  Revision 1.7  2004/01/04 20:08:45  jonas
-    * moved SIG_MAXSIG and wordsinsigset constants from bunxtype.inc to
-      ptypes.inc (already there for Darwin)
-
-  Revision 1.6  2003/11/30 12:40:29  marco
-   * fix from sebastian
-
-  Revision 1.5  2003/11/19 17:11:40  marco
-   * termio unit
-
-  Revision 1.4  2003/09/14 20:15:01  marco
-   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
-
-  Revision 1.3  2003/08/21 22:23:34  olle
-    - removed parameter from fpc_iocheck
-
-  Revision 1.2  2003/06/01 16:35:27  marco
-   * Several small fixes to harmonize the *BSD rtls and Linux.
-
-  Revision 1.1  2003/01/03 15:45:21  marco
-   * Renamed to bunxtype.inc (from osposixh.inc), some minor changes
-      (as introduced going from posix unit to baseunix)
-
-  Revision 1.6  2002/10/27 17:21:29  marco
-   * Only "difficult" functions + execvp + termios + rewinddir left to do
-
-  Revision 1.5  2002/10/27 11:58:30  marco
-   * Modifications from Saturday.
-
-  Revision 1.4  2002/09/07 16:01:17  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.3  2002/08/21 07:03:16  marco
-   * Fixes from Tuesday.
-
-  Revision 1.2  2002/08/19 12:29:11  marco
-   * First working POSIX *BSD system unit.
-
-  Revision 1.1  2002/08/03 19:34:19  marco
-   * Initial *BSD versions. Seems that OpenBSD doesn't need much change,
-      NetBSD may need some fixes to stat record and ftruncate and lseek.
-      It is all close together, and it should be doable to have just one copy
-      of these for *BSD.
-
-}

+ 4 - 3
rtl/bsd/bunxdefs.inc → rtl/bsd/osdefs.inc

@@ -22,13 +22,14 @@
 
 {$define usedomain}		// Allow uname with "domain" entry.
 				// (which is a GNU extension)
-{$define posixworkaround}	// Temporary ugly workaround for signal handler.
-				// (mainly until baseunix migration is complete)
 {$define hassysctl}             // Use sysctl unit
 
 {
   $Log$
-  Revision 1.1  2005-02-13 20:01:37  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.1  2005/02/13 20:01:37  peter
     * include file cleanup
 
 }

+ 4 - 1
rtl/bsd/bunxmacr.inc → rtl/bsd/osmacro.inc

@@ -90,7 +90,10 @@ end;
 
 {
   $Log$
-  Revision 1.6  2005-02-13 20:01:37  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.6  2005/02/13 20:01:37  peter
     * include file cleanup
 
   Revision 1.5  2003/09/27 13:04:58  peter

+ 0 - 262
rtl/bsd/osmain.inc

@@ -14,265 +14,3 @@
 
  **********************************************************************}
 
-{*****************************************************************************
-                       Misc. System Dependent Functions
-*****************************************************************************}
-
-procedure System_exit;
-begin
-   Fpexit(cint(ExitCode));
-End;
-
-
-Function ParamCount: Longint;
-Begin
-  Paramcount:=argc-1
-End;
-
-
-function BackPos(c:char; const s: shortstring): integer;
-var
- i: integer;
-Begin
-  for i:=length(s) downto 0 do
-    if s[i] = c then break;
-  if i=0 then
-    BackPos := 0
-  else
-    BackPos := i;
-end;
-
-
- { variable where full path and filename and executable is stored }
- { is setup by the startup of the system unit.                    }
-var
- execpathstr : shortstring;
-
-function paramstr(l: longint) : string;
- var
-  s: string;
-  s1: string;
- begin
-   { stricly conforming POSIX applications  }
-   { have the executing filename as argv[0] }
-//   if l=0 then
-//     begin
-//       paramstr := execpathstr;
-//     end
-//   else
-     paramstr:=strpas(argv[l]);
- end;
-
-Procedure Randomize;
-Begin
-  randseed:=longint(Fptime(nil));
-End;
-
-
-{*****************************************************************************
-                          Low Level File Routines
-*****************************************************************************}
-
-{
-  The lowlevel file functions should take care of setting the InOutRes to the
-  correct value if an error has occured, else leave it untouched
-}
-
-Function PosixToRunError  (PosixErrno : longint) : longint;
-{
-  Convert ErrNo error to the correct Inoutres value
-}
-
-begin
-  if PosixErrNo=0 then { Else it will go through all the cases }
-   exit(0);
-  case PosixErrNo of
-   ESysENFILE,
-   ESysEMFILE : Inoutres:=4;
-   ESysENOENT : Inoutres:=2;
-    ESysEBADF : Inoutres:=6;
-   ESysENOMEM,
-   ESysEFAULT : Inoutres:=217;
-   ESysEINVAL : Inoutres:=218;
-    ESysEPIPE,
-    ESysEINTR,
-      ESysEIO,
-   ESysEAGAIN,
-   ESysENOSPC : Inoutres:=101;
- ESysENAMETOOLONG : Inoutres := 3;
-    ESysEROFS,
-   ESysEEXIST,
-   ESysENOTEMPTY,
-   ESysEACCES : Inoutres:=5;
-   ESysEISDIR : InOutRes:=5;
-  else
-    begin
-       InOutRes := Integer(PosixErrno);
-    end;
-  end;
- PosixToRunError:=InOutRes;
-end;
-
-Function Errno2InoutRes : longint;
-
-begin
-  Errno2InoutRes:=PosixToRunError(getErrno);
-  InoutRes:=Errno2InoutRes;
-end;
-
-{*****************************************************************************
-                         SystemUnit Initialization
-*****************************************************************************}
-
-function  reenable_signal(sig : longint) : boolean;
-var
-  e,oe : TSigSet;
-  i,j : byte;
-begin
-  fillchar(e,sizeof(e),#0);
-  fillchar(oe,sizeof(oe),#0);
-  { set is 1 based PM }
-  dec(sig);
-  i:=sig mod 32;
-  j:=sig div 32;
-  e[j]:=1 shl i;
-  fpsigprocmask(SIG_UNBLOCK,@e,@oe);
-  reenable_signal:=geterrno=0;
-end;
-
-{$i sighnd.inc}
-
-var
-  act: SigActionRec;
-
-Procedure InstallSignals;
-var
-  oldact: SigActionRec;
-begin
-  { Initialize the sigaction structure }
-  { all flags and information set to zero }
-  FillChar(act, sizeof(SigActionRec),0);
-  { initialize handler                    }
-  act.sa_handler :=@SignalToRunError;
-  act.sa_flags:=SA_SIGINFO;
-  FpSigAction(SIGFPE,act,oldact);
-  FpSigAction(SIGSEGV,act,oldact);
-  FpSigAction(SIGBUS,act,oldact);
-  FpSigAction(SIGILL,act,oldact);
-end;
-
-
-procedure SetupCmdLine;
-var
-  bufsize,
-  len,j,
-  size,i : longint;
-  found  : boolean;
-  buf    : pchar;
-
-  procedure AddBuf;
-  begin
-    reallocmem(cmdline,size+bufsize);
-    move(buf^,cmdline[size],bufsize);
-    inc(size,bufsize);
-    bufsize:=0;
-  end;
-
-begin
-  GetMem(buf,ARG_MAX);
-  size:=0;
-  bufsize:=0;
-  i:=0;
-  while (i<argc) do
-   begin
-     len:=strlen(argv[i]);
-     if len>ARG_MAX-2 then
-      len:=ARG_MAX-2;
-     found:=false;
-     for j:=1 to len do
-      if argv[i][j]=' ' then
-       begin
-         found:=true;
-         break;
-       end;
-     if bufsize+len>=ARG_MAX-2 then
-      AddBuf;
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     move(argv[i]^,buf[bufsize],len);
-     inc(bufsize,len);
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     if i<argc then
-      buf[bufsize]:=' '
-     else
-      buf[bufsize]:=#0;
-     inc(bufsize);
-     inc(i);
-   end;
-  AddBuf;
-  FreeMem(buf,ARG_MAX);
-end;
-
-{
-   $Log$
-   Revision 1.17  2005-02-06 13:06:20  peter
-     * moved file and dir functions to sysfile/sysdir
-     * win32 thread in systemunit
-
-   Revision 1.16  2004/10/25 15:38:59  peter
-     * compiler defined HEAP and HEAPSIZE removed
-
-   Revision 1.15  2004/07/17 15:20:55  jonas
-     * don't use O_CREATE when opening a file for appending (fixes tw1744)
-
-   Revision 1.14  2004/05/16 18:51:20  peter
-     * use thandle in do_*
-
-   Revision 1.13  2004/04/22 21:10:56  peter
-     * do_read/do_write addr argument changed to pointer
-
-   Revision 1.12  2004/01/06 15:42:05  marco
-    * o_creat added when o_append
-
-   Revision 1.11  2004/01/03 14:56:10  marco
-    * typo fix
-
-   Revision 1.10  2004/01/03 12:35:39  marco
-    * sighnd to separate file, like linux. Some comments removed
-
-   Revision 1.9  2003/12/30 12:26:21  marco
-    * FPC_USE_LIBC
-
-   Revision 1.8  2003/12/21 20:31:50  peter
-     * fix getdir when directory contains files that give EACCESS
-
-   Revision 1.7  2003/12/14 14:47:02  marco
-    * fix for repeating 'x' bug
-
-   Revision 1.6  2003/11/18 10:12:25  marco
-    * Small fixes for EAGAIN. bunxfunc only has comments added.
-
-   Revision 1.5  2003/10/27 17:12:45  marco
-    * fixes for signal handling.
-
-   Revision 1.4  2003/10/26 17:01:04  marco
-    * moved sigprocmask to system
-
-   Revision 1.3  2003/09/27 13:04:58  peter
-     * fpISxxx renamed
-
-   Revision 1.2  2003/05/29 20:54:09  marco
-    * progname fix.
-
-   Revision 1.1  2003/01/05 19:01:28  marco
-    * FreeBSD compiles now with baseunix mods.
-
-
-}

+ 4 - 49
rtl/bsd/ossysc.inc

@@ -16,33 +16,6 @@
  ****************************************************************************
 }
 
-{$i ostypes.inc}
-
-{$ifdef FPC_USE_LIBC}
-  {$Linklib c}
-
-  {$ifdef FPC_IS_SYSTEM}
-    {$i oscdeclh.inc}
-  {$endif}
-  {$i bunxmacr.inc}
-
-{$else}
-
-{*****************************************************************************
-                     --- Main:The System Call Self ---
-*****************************************************************************}
-
-{ The system designed for Linux can't be used for *BSD so easily, since
-  *BSD pushes arguments, instead of loading them to registers.}
-
-// Var ErrNo : Longint;
-
-{$I syscallh.inc}
-{$I syscall.inc}
-{$I sysnr.inc}
-{$I bunxmacr.inc}
-
-// Should be moved to a FreeBSD specific unit in the future.
 
 function Fptime( tloc:ptime): time_t; [public, alias : 'FPC_SYSC_TIME'];
 
@@ -559,30 +532,12 @@ begin
   fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
 end;
 
-{$endif}
-
-CONST
-  IOCtl_TCGETS=$5401;
-
-Function Do_IsDevice(Handle:Longint):boolean;
-{
-  Interface to Unix ioctl call.
-  Performs various operations on the filedescriptor Handle.
-  Ndx describes the operation to perform.
-  Data points to data needed for the Ndx function. The structure of this
-  data is function-dependent.
-}
-var
-  Data : array[0..255] of byte; {Large enough for termios info}
-begin
-  Do_IsDevice:=(Fpioctl(handle,IOCTL_TCGETS,@data)<>-1);
-end;
-
-
-
 {
  $Log$
- Revision 1.22  2005-02-13 20:01:37  peter
+ Revision 1.23  2005-02-13 21:47:56  peter
+   * include file cleanup part 2
+
+ Revision 1.22  2005/02/13 20:01:37  peter
    * include file cleanup
 
  Revision 1.21  2005/02/06 12:16:52  peter

+ 0 - 74
rtl/bsd/ossysch.inc

@@ -1,74 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2002 by Marco van de Voort
-
-    Header for functions/syscalls included in system, but not in POSIX.  To
-    implement unit UNIX, and/or other lowlevel unix routines.
-
-    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,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- ****************************************************************************
-}
-
-//Function Fpmmap(adr,len,prot,flags,fdes,off:longint):longint;  external name  'FPC_SYSC_MMAP';
-//Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name  'FPC_SYSC_MMAP';
-//Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
-//function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
-
-// Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name 'FPC_SYSC_MMAP';
-// Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
-
-
-{$ifndef FPC_USE_LIBC}
-//Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint;  external name  'FPC_SYSC_IOCTL';
-//Function FpGetPid:LongInt;   external name  'FPC_SYSC_GETPID';
-//Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint;  external name  'FPC_SYSC_READLINK';
-
-{ Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or  Unix/freebsd}
-//Function FpNanoSleep (req : ptimespec;rem : ptimespec) : cint; external name 'FPC_SYSC_NANOSLEEP';
-
-{ can be used for getdir?}
-//Function Fpgetcwd (path:pchar; siz:size_t):pchar; external name 'FPC_SYSC_GETCWD';
-{$endif}
-
-{
-  $Log$
-  Revision 1.9  2004-11-19 13:15:14  marco
-   * external rework. Mostly done.
-
-  Revision 1.8  2004/11/14 12:21:08  marco
-   * moved some calls from unix to baseunix. Darwin untested.
-
-  Revision 1.7  2003/12/30 12:26:21  marco
-   * FPC_USE_LIBC
-
-  Revision 1.6  2003/09/27 13:45:58  peter
-    * fpnanosleep exported in baseunix
-    * fpnanosleep has pointer arguments to be C compliant
-
-  Revision 1.5  2003/09/20 12:38:29  marco
-   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
-
-  Revision 1.4  2003/09/16 12:45:49  marco
-   * mmap typing fixes
-
-  Revision 1.3  2003/09/15 20:08:49  marco
-   * small fixes. FreeBSD now cycles
-
-  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 11:58:29  marco
-   * Modifications from Saturday.
-
-
-
-}

+ 245 - 38
rtl/bsd/ostypes.inc

@@ -1,27 +1,211 @@
 {
     $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 baseunix unit, also used in system.
 
-    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.
+    This file implements all the types/constants which must
+    be defined to port FPC to a new POSIX compliant OS.
+
+    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,
     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.
+ **********************************************************************}
 
- ****************************************************************************
-}
+{***********************************************************************}
+{                         POSIX STRUCTURES                              }
+{***********************************************************************}
+
+{$ifdef FPC_IS_SYSTEM}
+  {$i ptypes.inc}
+{$ENDIF}
+
+{$ifdef cpupowerpc}
+  {$ifdef netbsd}
+    {$define netbsdpowerpc}
+  {$endif}
+{$endif}
+
+//      CONST SYS_NMLN=65;
+
+// Can't find these two in Posix and in FreeBSD
+//CONST
+//    _UTSNAME_LENGTH = ;
+//    _UTSNAME_NODENAME_LENGTH = ;
+
+CONST                		// OS specific parameters for general<fd,sig>set behaviour
+   BITSINWORD      = 8*sizeof(longint);
+   FD_MAXFDSET	   = 1024;
+   ln2bitsinword   = 5;         { 32bit : ln(32)/ln(2)=5 } 
+   ln2bitmask	   = 1 shl ln2bitsinword - 1;
+   wordsinfdset    = FD_MAXFDSET DIV BITSINWORD;        // words in fdset_t   
+   wordsinsigset   = SIG_MAXSIG  DIV BITSINWORD;
+
+TYPE
+   { system information services }
+   utsname = record
+              sysname : Array[0..SYS_NMLN-1] OF Char;   // Name of this OS
+              nodename: Array[0..SYS_NMLN-1] OF Char;   // Name of this network node.
+              release : Array[0..SYS_NMLN-1] OF Char;   // Release level.
+              version : Array[0..SYS_NMLN-1] OF Char;   // Version level.
+              machine : Array[0..SYS_NMLN-1] OF Char;   // Hardware type.
+             end;
+  TUtsName= utsname;
+  pUtsName= ^utsname;
+
+  { file characteristics services }
+   stat    = record { the types are real}
+        st_dev        : dev_t;             // inode's device
+        st_ino        : ino_t;             // inode's number
+        st_mode       : mode_t;            // inode protection mode
+        st_nlink      : nlink_t;           // number of hard links
+        st_uid        : uid_t;             // user ID of the file's owner
+        st_gid        : gid_t;             // group ID of the file's group
+        st_rdev       : dev_t;             // device type
+        st_atime      : time_t;            // time of last access
+        st_atimensec  : clong;             // nsec of last access
+        st_mtime      : time_t;            // time of last data modification
+        st_mtimensec  : clong;             // nsec of last data modification
+        st_ctime      : time_t;            // time of last file status change
+        st_ctimensec  : clong;             // nsec of last file status change
+{$ifdef netbsdPowerpc}
+	st_padd1	      : cint;
+{$endif}
+        st_size       : off_t;             // file size, in bytes
+        st_blocks     : cint64;            // blocks allocated for file
+        st_blksize    : cuint32;           // optimal blocksize for I/O
+        st_flags      : cuint32;           // user defined flags for file
+        st_gen        : cuint32;           // file generation number
+{$ifdef netbsdPowerpc}
+	st_padd2	      : cint;
+{$endif}
+{$ifndef NetBSD}
+        st_lspare     : cint32;
+{$endif}
+        st_qspare     : array[0..1] Of cint64;
+   end;
+   TStat = stat;
+   pStat = ^stat;
+
+  { directory services }
+   dirent  = record
+        d_fileno      : cuint32;                        // file number of entry
+        d_reclen      : cuint16;                        // length of this record
+        d_type        : cuint8;                         // file type, see below
+        d_namlen      : cuint8;                         // length of string in d_name
+        d_name        : array[0..(255 + 1)-1] of char;  // name must be no longer than this
+   end;
+   TDirent = dirent;
+   pDirent = ^dirent;
+
+   dir     = packed record
+        dd_fd     : cint;         // file descriptor associated with directory
+        dd_loc    : clong;        // offset in current buffer
+        dd_size   : clong;        // amount of data returned by getdirentries
+        dd_buf    : pchar;        // data buffer
+        dd_len    : cint;         // size of data buffer
+{$ifdef netbsdpowerpc}
+	dd_pad1   : cint;
+        dd_seek   : cint64;        // magic cookie returned by getdirentries
+{$else}
+        dd_seek   : clong;        // magic cookie returned by getdirentries
+{$endif}
+        dd_rewind : clong;        // magic cookie for rewinding
+        dd_flags  : cint;         // flags for readdir
+   end;
+   TDir    = dir;
+   pDir    = ^dir;
+
+   utimbuf  = record
+	        actime  : time_t;
+	        modtime : time_t;
+	        end;
+   TUtimBuf = utimbuf;
+   putimbuf = ^utimbuf;
+
+   flock    = record
+		l_start : off_t;	{ starting offset }
+		l_len	: off_t;	{ len = 0 means until end of file }
+		l_pid 	: pid_t;	{ lock owner }
+		l_type	: cshort;	{ lock type: read/write, etc. }
+		l_whence: cshort;	{ type of l_start }
+                end;
+   TFlock   = flock;
+   pFlock   = ^flock;
+
+ tms = packed record
+	 tms_utime  : clock_t;	{ User CPU time }
+	 tms_stime  : clock_t;	{ System CPU time }
+	 tms_cutime : clock_t;	{ User CPU time of terminated child procs }
+	 tms_cstime : clock_t;	{ System CPU time of terminated child procs }
+	 end;
+ TTms= tms;
+ pTms= ^tms;
 
-Type
+ TFDSet    = ARRAY[0..(FD_MAXFDSET div 32)-1] of Cardinal;
+ pFDSet    = ^TFDSet;
+
+{***********************************************************************}
+{                  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     =  $200;        { Create file if it doesn't exist.  }
+    O_EXCL      =  $800;        { Fail if file already exists.      }
+    O_TRUNC     =  $400;        { Truncate file to zero length.     }
+    O_NOCTTY    = $8000;        { Don't assign a controlling terminal. }
+    { File status flags for `open' and `fcntl'.  }
+    O_APPEND    =     8;        { Writes append to the file.        }
+    O_NONBLOCK  =     4;        { Non-blocking I/O.                 }
+
+    { mode_t possible values                                 }
+    S_IRUSR =  %0100000000;     { Read permission for owner   }
+    S_IWUSR =  %0010000000;     { Write permission for owner  }
+    S_IXUSR =  %0001000000;     { Exec  permission for owner  }
+    S_IRGRP =  %0000100000;     { Read permission for group   }
+    S_IWGRP =  %0000010000;     { Write permission for group  }
+    S_IXGRP =  %0000001000;     { Exec permission for group   }
+    S_IROTH =  %0000000100;     { Read permission for world   }
+    S_IWOTH =  %0000000010;     { Write permission for world  }
+    S_IXOTH =  %0000000001;     { Exec permission for world   }
+
+    { Used for waitpid }
+    WNOHANG   =          1;     { don't block waiting               }
+    WUNTRACED =          2;     { report status of stopped children }
+
+
+  { For File control mechanism }
+  F_GetFd  = 1;
+  F_SetFd  = 2;
+  F_GetFl  = 3;
+  F_SetFl  = 4;
+  F_GetLk  = 5;
+  F_SetLk  = 6;
+  F_SetLkW = 7;
+  F_SetOwn = 8;
+  F_GetOwn = 9;
+
+
+type
   timezone = packed record
     tz_minuteswest,
     tz_dsttime  : cint;
@@ -69,43 +253,66 @@ CONST
   MAP_PRIVATE   =2;
   MAP_ANONYMOUS =$1000;
 
+    {*************************************************************************}
+    {                               SIGNALS                                   }
+    {*************************************************************************}
+
+{$i signal.inc}
 
 
 {
- $Log$
- Revision 1.7  2005-02-06 12:16:52  peter
-   * bsd thread updates
+  $Log$
+  Revision 1.8  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.9  2004/03/04 22:15:16  marco
+   * UnixType changes. Please report problems to me.
+
+  Revision 1.8  2004/02/29 13:46:52  marco
+   * forgotten?
+
+  Revision 1.7  2004/01/04 20:08:45  jonas
+    * moved SIG_MAXSIG and wordsinsigset constants from bunxtype.inc to
+      ptypes.inc (already there for Darwin)
+
+  Revision 1.6  2003/11/30 12:40:29  marco
+   * fix from sebastian
 
- Revision 1.6  2004/12/02 11:22:11  marco
-  * tz_ prefixed for timezone
+  Revision 1.5  2003/11/19 17:11:40  marco
+   * termio unit
 
- 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/14 20:15:01  marco
+   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
 
- Revision 1.4  2003/09/17 11:52:05  marco
-  * stat macro fixes voor BSD
+  Revision 1.3  2003/08/21 22:23:34  olle
+    - removed parameter from fpc_iocheck
 
- Revision 1.3  2003/09/15 07:23:51  marco
-  * fix
+  Revision 1.2  2003/06/01 16:35:27  marco
+   * Several small fixes to harmonize the *BSD rtls and Linux.
 
- 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/03 15:45:21  marco
+   * Renamed to bunxtype.inc (from osposixh.inc), some minor changes
+      (as introduced going from posix unit to baseunix)
 
- Revision 1.1  2003/01/05 19:01:28  marco
-  * FreeBSD compiles now with baseunix mods.
+  Revision 1.6  2002/10/27 17:21:29  marco
+   * Only "difficult" functions + execvp + termios + rewinddir left to do
 
- Revision 1.4  2002/10/27 17:21:29  marco
-  * Only "difficult" functions + execvp + termios + rewinddir left to do
+  Revision 1.5  2002/10/27 11:58:30  marco
+   * Modifications from Saturday.
 
- Revision 1.3  2002/10/27 11:58:30  marco
-  * Modifications from Saturday.
+  Revision 1.4  2002/09/07 16:01:17  peter
+    * old logs removed and tabs fixed
 
- Revision 1.2  2002/09/07 16:01:17  peter
-   * old logs removed and tabs fixed
+  Revision 1.3  2002/08/21 07:03:16  marco
+   * Fixes from Tuesday.
 
- Revision 1.1  2002/08/19 12:29:11  marco
-  * First working POSIX *BSD system unit.
+  Revision 1.2  2002/08/19 12:29:11  marco
+   * First working POSIX *BSD system unit.
 
+  Revision 1.1  2002/08/03 19:34:19  marco
+   * Initial *BSD versions. Seems that OpenBSD doesn't need much change,
+      NetBSD may need some fixes to stat record and ftruncate and lseek.
+      It is all close together, and it should be doable to have just one copy
+      of these for *BSD.
 
 }

+ 92 - 5
rtl/bsd/sysos.inc

@@ -82,14 +82,101 @@ end;
 
 { OS dependant parts  }
 
-{$I errno.inc}
-{$I bunxtype.inc}
-{$I ossysc.inc}
-{$I osmain.inc}
+{$I errno.inc}                          // error numbers
+{$I ostypes.inc}                        // c-types, unix base types, unix base structures
+{$I osmacro.inc}
+
+{$ifdef FPC_USE_LIBC}
+  {$Linklib c}
+  {$i oscdeclh.inc}
+{$else}
+  {$I syscallh.inc}
+  {$I syscall.inc}
+  {$I sysnr.inc}
+  {$I ossysc.inc}
+{$endif}
+
+
+{*****************************************************************************
+                            Error conversion
+*****************************************************************************}
+
+{
+  The lowlevel file functions should take care of setting the InOutRes to the
+  correct value if an error has occured, else leave it untouched
+}
+
+Function PosixToRunError  (PosixErrno : longint) : longint;
+{
+  Convert ErrNo error to the correct Inoutres value
+}
+
+begin
+  if PosixErrNo=0 then { Else it will go through all the cases }
+   exit(0);
+  case PosixErrNo of
+   ESysENFILE,
+   ESysEMFILE : Inoutres:=4;
+   ESysENOENT : Inoutres:=2;
+    ESysEBADF : Inoutres:=6;
+   ESysENOMEM,
+   ESysEFAULT : Inoutres:=217;
+   ESysEINVAL : Inoutres:=218;
+    ESysEPIPE,
+    ESysEINTR,
+      ESysEIO,
+   ESysEAGAIN,
+   ESysENOSPC : Inoutres:=101;
+ ESysENAMETOOLONG : Inoutres := 3;
+    ESysEROFS,
+   ESysEEXIST,
+   ESysENOTEMPTY,
+   ESysEACCES : Inoutres:=5;
+   ESysEISDIR : InOutRes:=5;
+  else
+    begin
+       InOutRes := Integer(PosixErrno);
+    end;
+  end;
+ PosixToRunError:=InOutRes;
+end;
+
+Function Errno2InoutRes : longint;
+
+begin
+  Errno2InoutRes:=PosixToRunError(getErrno);
+  InoutRes:=Errno2InoutRes;
+end;
+
+
+{*****************************************************************************
+                          Low Level File Routines
+*****************************************************************************}
+
+Function Do_IsDevice(Handle:Longint):boolean;
+{
+  Interface to Unix ioctl call.
+  Performs various operations on the filedescriptor Handle.
+  Ndx describes the operation to perform.
+  Data points to data needed for the Ndx function. The structure of this
+  data is function-dependent.
+}
+CONST
+  IOCtl_TCGETS=$5401;
+var
+  Data : array[0..255] of byte; {Large enough for termios info}
+begin
+  Do_IsDevice:=(Fpioctl(handle,IOCTL_TCGETS,@data)<>-1);
+end;
+
+
 
 {
    $Log$
-   Revision 1.3  2005-02-07 22:04:55  peter
+   Revision 1.4  2005-02-13 21:47:56  peter
+     * include file cleanup part 2
+
+   Revision 1.3  2005/02/07 22:04:55  peter
      * moved to unix
 
    Revision 1.2  2005/02/06 13:06:20  peter

+ 159 - 1
rtl/bsd/system.pp

@@ -50,6 +50,161 @@ Implementation
 
 {$I system.inc}
 
+{*****************************************************************************
+                       Misc. System Dependent Functions
+*****************************************************************************}
+
+procedure System_exit;
+begin
+   Fpexit(cint(ExitCode));
+End;
+
+
+Function ParamCount: Longint;
+Begin
+  Paramcount:=argc-1
+End;
+
+
+function BackPos(c:char; const s: shortstring): integer;
+var
+ i: integer;
+Begin
+  for i:=length(s) downto 0 do
+    if s[i] = c then break;
+  if i=0 then
+    BackPos := 0
+  else
+    BackPos := i;
+end;
+
+
+ { variable where full path and filename and executable is stored }
+ { is setup by the startup of the system unit.                    }
+var
+ execpathstr : shortstring;
+
+function paramstr(l: longint) : string;
+ var
+  s: string;
+  s1: string;
+ begin
+   { stricly conforming POSIX applications  }
+   { have the executing filename as argv[0] }
+//   if l=0 then
+//     begin
+//       paramstr := execpathstr;
+//     end
+//   else
+     paramstr:=strpas(argv[l]);
+ end;
+
+Procedure Randomize;
+Begin
+  randseed:=longint(Fptime(nil));
+End;
+
+
+{*****************************************************************************
+                         SystemUnit Initialization
+*****************************************************************************}
+
+function  reenable_signal(sig : longint) : boolean;
+var
+  e,oe : TSigSet;
+  i,j : byte;
+begin
+  fillchar(e,sizeof(e),#0);
+  fillchar(oe,sizeof(oe),#0);
+  { set is 1 based PM }
+  dec(sig);
+  i:=sig mod 32;
+  j:=sig div 32;
+  e[j]:=1 shl i;
+  fpsigprocmask(SIG_UNBLOCK,@e,@oe);
+  reenable_signal:=geterrno=0;
+end;
+
+{$i sighnd.inc}
+
+var
+  act: SigActionRec;
+
+Procedure InstallSignals;
+var
+  oldact: SigActionRec;
+begin
+  { Initialize the sigaction structure }
+  { all flags and information set to zero }
+  FillChar(act, sizeof(SigActionRec),0);
+  { initialize handler                    }
+  act.sa_handler :=@SignalToRunError;
+  act.sa_flags:=SA_SIGINFO;
+  FpSigAction(SIGFPE,act,oldact);
+  FpSigAction(SIGSEGV,act,oldact);
+  FpSigAction(SIGBUS,act,oldact);
+  FpSigAction(SIGILL,act,oldact);
+end;
+
+
+procedure SetupCmdLine;
+var
+  bufsize,
+  len,j,
+  size,i : longint;
+  found  : boolean;
+  buf    : pchar;
+
+  procedure AddBuf;
+  begin
+    reallocmem(cmdline,size+bufsize);
+    move(buf^,cmdline[size],bufsize);
+    inc(size,bufsize);
+    bufsize:=0;
+  end;
+
+begin
+  GetMem(buf,ARG_MAX);
+  size:=0;
+  bufsize:=0;
+  i:=0;
+  while (i<argc) do
+   begin
+     len:=strlen(argv[i]);
+     if len>ARG_MAX-2 then
+      len:=ARG_MAX-2;
+     found:=false;
+     for j:=1 to len do
+      if argv[i][j]=' ' then
+       begin
+         found:=true;
+         break;
+       end;
+     if bufsize+len>=ARG_MAX-2 then
+      AddBuf;
+     if found then
+      begin
+        buf[bufsize]:='"';
+        inc(bufsize);
+      end;
+     move(argv[i]^,buf[bufsize],len);
+     inc(bufsize,len);
+     if found then
+      begin
+        buf[bufsize]:='"';
+        inc(bufsize);
+      end;
+     if i<argc then
+      buf[bufsize]:=' '
+     else
+      buf[bufsize]:=#0;
+     inc(bufsize);
+     inc(i);
+   end;
+  AddBuf;
+  FreeMem(buf,ARG_MAX);
+end;
+
 procedure SysInitStdIO;
 begin
   OpenStdIO(Input,fmInput,StdInputHandle);
@@ -113,7 +268,10 @@ End.
 
 {
   $Log$
-  Revision 1.23  2005-02-06 12:16:52  peter
+  Revision 1.24  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.23  2005/02/06 12:16:52  peter
     * bsd thread updates
 
   Revision 1.22  2005/02/01 20:22:49  florian

+ 6 - 6
rtl/darwin/Makefile

@@ -1836,7 +1836,7 @@ SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
 include $(PROCINC)/makefile.cpu
 SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
 SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
-$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp $(SYSDEPS)
 	$(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
 objpas$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
@@ -1845,15 +1845,15 @@ dateutils$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT) sysutils$(PPUEXT) mat
 strings$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/strings.pp $(INC)/stringsi.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(SYSTEMUNIT)$(PPUEXT)
-baseunix$(PPUEXT) : unixtype$(PPUEXT) sysctl$(PPUEXT) errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+baseunix$(PPUEXT) : unixtype$(PPUEXT) sysctl$(PPUEXT) errno.inc ptypes.inc $(BSDINC)/ctypes.inc \
+  signal.inc $(UNIXINC)/bunxh.inc \
   $(BSDINC)/bunxsysc.inc \
-  $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
+  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 unixtype$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(UNIXINC)/unixtype.pp ptypes.inc $(BSDINC)/ctypes.inc $(SYSTEMUNIT)$(PPUEXT)
 unix$(PPUEXT) : unixtype$(PPUEXT) baseunix$(PPUEXT) unixutil$(PPUEXT) strings$(PPUEXT) $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-		 sysconst.inc $(UNIXINC)/timezone.inc \
-		 unixfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+		 unxconst.inc $(UNIXINC)/timezone.inc \
+		 unxfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 unixutil$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT)
 dynlibs$(PPUEXT) : dl$(PPUEXT)
 ctypes$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT)

+ 6 - 6
rtl/darwin/Makefile.fpc

@@ -106,7 +106,7 @@ SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 # System Units (System, Objpas, Strings)
 #
 
-$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp $(SYSDEPS)
         $(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
 
 objpas$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
@@ -125,17 +125,17 @@ strings$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/strings.pp $(INC)/stringsi.inc\
 # System Dependent Units
 #
 
-baseunix$(PPUEXT) : unixtype$(PPUEXT) sysctl$(PPUEXT) errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+baseunix$(PPUEXT) : unixtype$(PPUEXT) sysctl$(PPUEXT) errno.inc ptypes.inc $(BSDINC)/ctypes.inc \
+  signal.inc $(UNIXINC)/bunxh.inc \
   $(BSDINC)/bunxsysc.inc \
-  $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
+  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 
 unixtype$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(UNIXINC)/unixtype.pp ptypes.inc $(BSDINC)/ctypes.inc $(SYSTEMUNIT)$(PPUEXT)
 
 unix$(PPUEXT) : unixtype$(PPUEXT) baseunix$(PPUEXT) unixutil$(PPUEXT) strings$(PPUEXT) $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-                 sysconst.inc $(UNIXINC)/timezone.inc \
-                 unixfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+                 unxconst.inc $(UNIXINC)/timezone.inc \
+                 unxfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 unixutil$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT)
 

+ 4 - 1
rtl/darwin/sysconst.inc → rtl/darwin/unxconst.inc

@@ -107,7 +107,10 @@ type
 
 {
   $Log$
-  Revision 1.2  2005-02-06 12:16:52  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.2  2005/02/06 12:16:52  peter
     * bsd thread updates
 
   Revision 1.1  2003/05/20 23:56:40  florian

+ 4 - 1
rtl/darwin/unixfunc.inc → rtl/darwin/unxfunc.inc

@@ -62,7 +62,10 @@ end;
 
 {
   $Log$
-  Revision 1.1  2005-02-13 20:01:37  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.1  2005/02/13 20:01:37  peter
     * include file cleanup
 
   Revision 1.3  2004/07/01 18:34:53  jonas

+ 6 - 6
rtl/freebsd/Makefile

@@ -1974,7 +1974,7 @@ cprt0$(OEXT) : $(CPU_TARGET)/cprt0.as
 	$(AS) -o $(UNITTARGETDIRPREFIX)cprt0$(OEXT) $(CPU_TARGET)/cprt0.as
 gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as
 	$(AS) -o $(UNITTARGETDIRPREFIX)gprt0$(OEXT) $(CPU_TARGET)/gprt0.as
-$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp unxconst.inc $(SYSDEPS)
 	$(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
@@ -1984,14 +1984,14 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(SYSTEMUNIT)$(PPUEXT)
 unixtype$(PPUEXT): $(UNIXINC)/unixtype.pp $(BSDINC)/ctypes.inc ptypes.inc $(SYSTEMUNIT)$(PPUEXT)
-baseunix$(PPUEXT) : errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+baseunix$(PPUEXT) : errno.inc ptypes.inc $(BSDINC)/ctypes.inc \
+  signal.inc $(UNIXINC)/bunxh.inc \
   $(BSDINC)/bunxsysc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
-  $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
+  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-		 sysconst.inc $(UNIXINC)/timezone.inc \
-		 unixfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+		 unxconst.inc $(UNIXINC)/timezone.inc \
+		 unxfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 linux$(PPUEXT) : baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 dos$(PPUEXT) : $(UNIXINC)/dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
 	       unix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)

+ 6 - 6
rtl/freebsd/Makefile.fpc

@@ -127,7 +127,7 @@ gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as
 # System Units (System, Objpas, Strings)
 #
 
-$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp unxconst.inc $(SYSDEPS)
         $(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
 
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
@@ -148,16 +148,16 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 
 unixtype$(PPUEXT): $(UNIXINC)/unixtype.pp $(BSDINC)/ctypes.inc ptypes.inc $(SYSTEMUNIT)$(PPUEXT)
 
-baseunix$(PPUEXT) : errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+baseunix$(PPUEXT) : errno.inc ptypes.inc $(BSDINC)/ctypes.inc \
+  signal.inc $(UNIXINC)/bunxh.inc \
   $(BSDINC)/bunxsysc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
-  $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
+  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 
 
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-                 sysconst.inc $(UNIXINC)/timezone.inc \
-                 unixfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+                 unxconst.inc $(UNIXINC)/timezone.inc \
+                 unxfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 linux$(PPUEXT) : baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 

+ 4 - 1
rtl/freebsd/sysconst.inc → rtl/freebsd/unxconst.inc

@@ -113,7 +113,10 @@ type
 
 {
   $Log$
-  Revision 1.11  2005-02-06 13:06:20  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.11  2005/02/06 13:06:20  peter
     * moved file and dir functions to sysfile/sysdir
     * win32 thread in systemunit
 

+ 4 - 1
rtl/freebsd/unixfunc.inc → rtl/freebsd/unxfunc.inc

@@ -71,7 +71,10 @@ end;
 
 {
   $Log$
-  Revision 1.1  2005-02-13 20:01:37  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.1  2005/02/13 20:01:37  peter
     * include file cleanup
 
   Revision 1.20  2004/04/23 19:16:24  marco

+ 6 - 6
rtl/linux/Makefile

@@ -2181,7 +2181,7 @@ cprt21$(OEXT) : $(CPU_TARGET)/cprt21.as
 	$(AS) -o $(UNITTARGETDIRPREFIX)cprt21$(OEXT) $(CPU_TARGET)/cprt21.as
 gprt21$(OEXT) : $(CPU_TARGET)/gprt21.as
 	$(AS) -o $(UNITTARGETDIRPREFIX)gprt21$(OEXT) $(CPU_TARGET)/gprt21.as
-$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
 	$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
@@ -2191,13 +2191,13 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(SYSTEMUNIT)$(PPUEXT)
 unix$(PPUEXT) : unix.pp strings$(PPUEXT) baseunix$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-		 sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
-		 unixfunc.inc
+		 unxconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
+		 unxfunc.inc
 unixtype$(PPUEXT) : $(UNIXINC)/unixtype.pp ptypes.inc ctypes.inc $(SYSTEMUNIT)$(PPUEXT)
-baseunix$(PPUEXT) : errno.inc bunxtype.inc ptypes.inc ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc ostypes.inc \
+baseunix$(PPUEXT) : errno.inc ptypes.inc ctypes.inc \
+  $(UNIXINC)/bunxh.inc \
   bunxsysc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \
-  ostypes.inc ossysch.inc bunxmacr.inc $(UNIXINC)/gensigset.inc \
+  ostypes.inc osmacro.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 ports$(PPUEXT) : ports.pp unix$(PPUEXT) objpas$(PPUEXT)
 dl$(PPUEXT) : $(UNIXINC)/dl.pp $(SYSTEMUNIT)$(PPUEXT)

+ 6 - 6
rtl/linux/Makefile.fpc

@@ -140,7 +140,7 @@ gprt21$(OEXT) : $(CPU_TARGET)/gprt21.as
 # $(SYSTEMUNIT) Units ($(SYSTEMUNIT), Objpas, Strings)
 #
 
-$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
         $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
 
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
@@ -158,15 +158,15 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 #
 
 unix$(PPUEXT) : unix.pp strings$(PPUEXT) baseunix$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-                 sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
-                 unixfunc.inc
+                 unxconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
+                 unxfunc.inc
 
 unixtype$(PPUEXT) : $(UNIXINC)/unixtype.pp ptypes.inc ctypes.inc $(SYSTEMUNIT)$(PPUEXT)
 
-baseunix$(PPUEXT) : errno.inc bunxtype.inc ptypes.inc ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc ostypes.inc \
+baseunix$(PPUEXT) : errno.inc ptypes.inc ctypes.inc \
+  $(UNIXINC)/bunxh.inc \
   bunxsysc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \
-  ostypes.inc ossysch.inc bunxmacr.inc $(UNIXINC)/gensigset.inc \
+  ostypes.inc osmacro.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 
 ports$(PPUEXT) : ports.pp unix$(PPUEXT) objpas$(PPUEXT)

+ 0 - 327
rtl/linux/bunxtype.inc

@@ -1,327 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Free Pascal development team
-
-    Types and structures for the BaseUnix unit.
-
-    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,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- ***********************************************************************}
-
-{***********************************************************************}
-{                         Base Unix Structures				}
-{***********************************************************************}
-
-{$IFDEF FPC_IS_SYSTEM}
-{$i ptypes.inc}
-{$ENDIF}
-
-
-CONST
-//  SYS_NMLM 		     = 65;
-    UTSNAME_LENGTH 	     = SYS_NMLN;
-    UTSNAME_NODENAME_LENGTH  = UTSNAME_LENGTH;
-    {$ifdef usedomain}
-    UTSNAME_DOMAIN_LENGTH    = UTSNAME_LENGTH;
-    {$endif}
-
-   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;
-
-TYPE
-   Blksize_t  = cuint;
-   Blkcnt_t   = cuint;
-   Ino64_t    = cint64;
-   Off64_t    = cint64;
-
-   TBlkSize   = BlkSize_t;
-   PBlkSize   = ^BlkSize_t;
-   TBlkCnt    = Blkcnt_t;
-   PBlkCnt    = ^Blkcnt_t;
-   TIno64     = Ino64_t;
-   PIno64     = ^Ino64_t;
-   TOff64     = Off64_t;
-   POff64     = ^Off64_t;
-
-   { system information services }
-   UtsName   = Record
-                Sysname : Array[0..UTSNAME_LENGTH -1] OF Char;   // Name of this OS
-                Nodename: Array[0..UTSNAME_NODENAME_LENGTH-1] OF Char;   // Name of this network node.
-                Release : Array[0..UTSNAME_LENGTH -1] OF Char;   // Release level.
-                Version : Array[0..UTSNAME_LENGTH -1] OF Char;   // Version level.
-                Machine : Array[0..UTSNAME_LENGTH -1] OF Char;   // Hardware type.
-	       {$ifdef usedomain}
-	        Domain  : array[0..UTSNAME_DOMAIN_LENGTH-1] of char;  // Linux addition "Domain"
-	       {$endif}
-	       end;
-  TUtsName   = UtsName;
-  PUtsName   = TUtsName;
-
-
-{ Definition of (kernel) stat type }
-{ see kernel/include/asm-<cpu>/stat.h, include/linux/types.h and }
-{ include /include/asm-<cpu>/posix-types.h                       }
-
-{$i stat.inc}
-
-  TStat	     = Stat;
-  PStat	     = ^Stat;
-
-
-{$ifdef notused} // 64-bit support needs some work still :-)
-  { file characteristics services }
-   stat64    = record
-        st_dev        : dev_t;             // inode's device
-	pad1	      : cushort;
-	{$ifdef 64bitfs}		   // ??
-	__st_ino      : ino_t;
-	{$else}
-        st_ino        : ino_t;             // inode's number
-	{$endif}
-        st_mode       : mode_t;            // inode protection mode
-        st_nlink      : nlink_t;           // number of hard links
-        st_uid        : uid_t;             // user ID of the file's owner
-        st_gid        : gid_t;             // group ID of the file's group
-        st_rdev       : dev_t;             // device type
-	pad2	      : cushort;
-	{$ifdef 64bitfs}
-        st_size       : off64_t;            // file size, in bytes
-	{$else}
-        st_size       : off_t;             // file size, in bytes
- 	{$endif}
-        st_blksize    : blksize_t;           // optimal blocksize for I/O
-	{$ifdef 64bitfs}
-        st_blocks     : blkcnt64_t;            // blocks allocated for file
-	{$else}
- 	st_blocks     : blkcnt_t;            // blocks allocated for file
-	{$endif}
-        st_atime      : time_t;            // time of last access
-	unused1	      : culong;
-        st_mtime      : time_t;            // time of last data modification
-	unused2	      : culong;
-        st_ctime      : time_t;            // time of last file status change
-	unused3	      : culong;
-	{$ifdef 64bitfs}
-	st_ino	      : ino64_t
-	{$else}
-	unused4	      : culong;
-        unused5	      : culong;
-	{$endif}
-   end;
-{$endif}
-
-  { directory services }
-
-  Dirent     = packed record
-	       {$ifndef 64bitfs}
-        	d_fileno      : ino_t;                          // file number of entry
-        	d_off         : off_t;
-		{$else}
-        	d_fileno      : ino64_t;                        // file number of entry
-        	d_off         : off64_t;
-	       {$endif}
-		d_reclen      : cushort;                        // length of string in d_name
-	       {$ifdef Uselibc}	// Libc different from kernel record!
-        	d_type        : cuchar;                         // file type, see below
-	       {$endif}
-        	d_name        : array[0..(255 + 1)-1] of char;  // name must be no longer than this
-   	       end;
-  TDirent    = Dirent;
-  pDirent    = ^Dirent;
-
-{$ifdef oldreaddir}
-	   { Still old one. This is a userland struct}
-
-   Dir       = record
-                dd_fd     : integer;
-                dd_loc    : longint;
-                dd_size   : integer;
-                dd_buf    : pdirent;
-                {The following are used in libc, but NOT in the linux kernel sources ??}
-                dd_nextoff: longint;
-                dd_max : integer; {size of buf. Irrelevant, as buf is of type dirent}
-                dd_lock   : pointer;
-               end;
-{$else}
-	// new libc one. NOTE that off_t must be real, so 64-bit ifdef
-	// 64bitsfs
-   Dir       = Record	// packing doesn't matter. This is a userland struct.
-	        fd  	: cint;
-	        data	: pchar;
-	        allocation: size_t;
-	        _size     : size_t;
-	        offset    : size_t;
-	        filepos   : off_t;
-	        end;
-{$endif}
-
-   TDir	     = Dir;
-   pDir      = ^Dir;
-
-
-   UTimBuf   = Record
-	         actime  : time_t;
-	         modtime : time_t;
-	        end;
-
-   TUtimBuf  = UtimBuf;
-   pUtimBuf  = ^UtimBuf;
-
-   FLock     = Record
-		l_type	: cshort;	{ lock type: read/write, etc. }
-		l_whence: cshort;	{ type of l_start }
-		{$ifdef 64bitfs}
-		l_start : off64_t;	{ starting offset }
-		l_len	: off64_t;	{ len = 0 means until end of file }
-		{$else}
-		l_start : off_t;	{ starting offset }
-		l_len	: off_t;	{ len = 0 means until end of file }
-		{$endif}
-		l_pid 	: pid_t;	{ lock owner }
-	       End;
-
-   tms       = packed Record
-	 	tms_utime  : clock_t;	{ User CPU time }
-	 	tms_stime  : clock_t;	{ System CPU time }
-	 	tms_cutime : clock_t;	{ User CPU time of terminated child procs }
-	 	tms_cstime : clock_t;	{ System CPU time of terminated child procs }
-	       end;
-   TTms      = tms;
-   PTms	     = ^tms;
-
- TFDSet    = ARRAY[0..(FD_MAXFDSET div 32)-1] of Cardinal;
- pFDSet    = ^TFDSet;
-
-{***********************************************************************}
-{                  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. }
-{$ifdef sparc}
-    O_APPEND  =          8;
-    O_CREAT   =       $200;
-    O_TRUNC   =       $400;
-    O_EXCL    =       $800;
-    O_SYNC    =      $2000;
-    O_NONBLOCK =     $4000;
-    O_NDELAY  =      O_NONBLOCK or 4;
-    O_NOCTTY  =      $8000;
-    O_DIRECTORY =   $10000;
-    O_NOFOLLOW =    $20000; 
-    O_LARGEFILE =   $40000;
-    O_DIRECT  =    $100000; 
-{$else sparc}
-    O_CREAT   =        $40;
-    O_EXCL    =        $80;
-    O_NOCTTY  =       $100;
-    O_TRUNC   =       $200;
-    O_APPEND  =       $400;
-    O_NONBLOCK =      $800;
-    O_NDELAY  =     O_NONBLOCK;
-    O_SYNC    =      $1000;
-    O_DIRECT  =      $4000;
-    O_LARGEFILE =    $8000;
-    O_DIRECTORY =   $10000;
-    O_NOFOLLOW =    $20000;
-{$endif sparc}    
-
-    { mode_t possible values                                 }
-    S_IRUSR =  %0100000000;     { Read permission for owner   }
-    S_IWUSR =  %0010000000;     { Write permission for owner  }
-    S_IXUSR =  %0001000000;     { Exec  permission for owner  }
-    S_IRGRP =  %0000100000;     { Read permission for group   }
-    S_IWGRP =  %0000010000;     { Write permission for group  }
-    S_IXGRP =  %0000001000;     { Exec permission for group   }
-    S_IROTH =  %0000000100;     { Read permission for world   }
-    S_IWOTH =  %0000000010;     { Write permission for world  }
-    S_IXOTH =  %0000000001;     { Exec permission for world   }
-
-    { Used for waitpid }
-    WNOHANG   =          1;     { don't block waiting               }
-    WUNTRACED =          2;     { report status of stopped children }
-
-const
-
-  { For File control mechanism }
-  F_GetFd  = 1;
-  F_SetFd  = 2;
-  F_GetFl  = 3;
-  F_SetFl  = 4;
-  F_GetLk  = 5;
-  F_SetLk  = 6;
-  F_SetLkW = 7;
-  F_SetOwn = 8;
-  F_GetOwn = 9;
-
-    {*************************************************************************}
-    {                               SIGNALS                                   }
-    {*************************************************************************}
-
-{$i signal.inc}
-
-// function geterrno:longint;
-// procedure seterrno(i:longint);
-
-{
-  $Log$
-  Revision 1.10  2004-09-12 15:20:23  peter
-    * sparc has different values for O_ flags
-
-  Revision 1.9  2004/03/04 22:15:16  marco
-   * UnixType changes. Please report problems to me.
-
-  Revision 1.8  2004/02/22 15:00:27  marco
-   * genfdset word count added. Small fix for libc maxsigsetsize
-
-  Revision 1.7  2004/01/31 16:17:38  florian
-    * removed packed directive from Dir type because it's not properly aligned
-      and it's never passed to the OS
-
-  Revision 1.6  2003/12/31 20:17:06  marco
-   * sigset size adaption for FPC_USE_LIBC
-
-  Revision 1.5  2003/12/02 00:04:34  sg
-  * Fixed ln2bitmask
-
-  Revision 1.4  2003/11/19 10:56:15  marco
-   * some constants moved from System
-
-  Revision 1.3  2003/09/14 20:15:01  marco
-   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
-
-  Revision 1.2  2003/05/15 22:50:50  jonas
-    * the stat type is processor-dependent
-    * the dev_t tpye is processor dependent. Don't use it in the stat type
-      however, as that one is also used at a time where dev_t is already
-      defined as qword
-
-  Revision 1.1  2002/12/18 16:43:26  marco
-   * new unix rtl, linux part.....
-
-  Revision 1.1  2002/11/12 14:37:59  marco
-   * Parts of new unix rtl
-
-}

+ 8 - 3
rtl/linux/bunxdefs.inc → rtl/linux/osdefs.inc

@@ -25,12 +25,17 @@
 				// of userland getdents stuff.
 {$define usedomain}		// Allow uname with "domain" entry.
 				// (which is a GNU extension)
-{$define posixworkaround}	// Temporary ugly workaround for signal handler.
-				// (mainly until baseunix migration is complete)
+{$ifdef FPC_USE_LIBC}
+  {$define usegetcwd}
+{$endif}
+
 
 {
   $Log$
-  Revision 1.1  2005-02-13 20:01:38  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.1  2005/02/13 20:01:38  peter
     * include file cleanup
 
 }

+ 4 - 1
rtl/linux/bunxmacr.inc → rtl/linux/osmacro.inc

@@ -91,7 +91,10 @@ end;
 
 {
   $Log$
-  Revision 1.4  2005-02-13 20:01:38  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.4  2005/02/13 20:01:38  peter
     * include file cleanup
 
   Revision 1.3  2003/09/27 12:51:33  peter

+ 0 - 333
rtl/linux/osmain.inc

@@ -1,333 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-
-    POSIX Interface to the system unit
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This is the core of the system unit *nix systems (now FreeBSD
-     and Unix).
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-
-{*****************************************************************************
-                       Misc. System Dependent Functions
-*****************************************************************************}
-
-procedure haltproc(e:longint);cdecl;external name '_haltproc';
-
-procedure System_exit;
-begin
-  haltproc(ExitCode);
-End;
-
-
-Function ParamCount: Longint;
-Begin
-  Paramcount:=argc-1
-End;
-
-
-function BackPos(c:char; const s: shortstring): integer;
-var
- i: integer;
-Begin
-  for i:=length(s) downto 0 do
-    if s[i] = c then break;
-  if i=0 then
-    BackPos := 0
-  else
-    BackPos := i;
-end;
-
-
- { variable where full path and filename and executable is stored }
- { is setup by the startup of the system unit.                    }
-var
- execpathstr : shortstring;
-
-function paramstr(l: longint) : string;
- begin
-   { stricly conforming POSIX applications  }
-   { have the executing filename as argv[0] }
-   if l=0 then
-     begin
-       paramstr := execpathstr;
-     end
-   else
-     paramstr:=strpas(argv[l]);
- end;
-
-Procedure Randomize;
-Begin
-  randseed:=longint(Fptime(nil));
-End;
-
-
-{*****************************************************************************
-                          Low Level File Routines
-*****************************************************************************}
-
-{
-  The lowlevel file functions should take care of setting the InOutRes to the
-  correct value if an error has occured, else leave it untouched
-}
-
-Function PosixToRunError  (PosixErrno : longint) : longint;
-{
-  Convert ErrNo error to the correct Inoutres value
-}
-
-begin
-  if PosixErrNo=0 then { Else it will go through all the cases }
-   exit(0);
-  case PosixErrNo of
-   ESysENFILE,
-   ESysEMFILE : Inoutres:=4;
-   ESysENOENT : Inoutres:=2;
-    ESysEBADF : Inoutres:=6;
-   ESysENOMEM,
-   ESysEFAULT : Inoutres:=217;
-   ESysEINVAL : Inoutres:=218;
-    ESysEPIPE,
-    ESysEINTR,
-      ESysEIO,
-   ESysEAGAIN,
-   ESysENOSPC : Inoutres:=101;
- ESysENAMETOOLONG : Inoutres := 3;
-    ESysEROFS,
-   ESysEEXIST,
-   ESysENOTEMPTY,
-   ESysEACCES : Inoutres:=5;
-   ESysEISDIR : InOutRes:=5;
-  else
-    begin
-       InOutRes := Integer(PosixErrno);
-    end;
-  end;
- PosixToRunError:=InOutRes;
-end;
-
-
-Function Errno2InoutRes : longint;
-begin
-  Errno2InoutRes:=PosixToRunError(getErrno);
-  InoutRes:=Errno2InoutRes;
-end;
-
-
-{*****************************************************************************
-                         SystemUnit Initialization
-*****************************************************************************}
-
-// signal handler is arch dependant due to processorexception to language
-// exception translation
-
-{$i sighnd.inc}
-
-var
-  act: SigActionRec;
-
-Procedure InstallSignals;
-begin
-  { Initialize the sigaction structure }
-  { all flags and information set to zero }
-  FillChar(act, sizeof(SigActionRec),0);
-  { initialize handler                    }
-  act.sa_handler := SigActionHandler(@SignalToRunError);
-  act.sa_flags:=SA_SIGINFO
-{$ifdef cpux86_64}
-    or $4000000
-{$endif cpux86_64}
-    ;
-  FpSigAction(SIGFPE,@act,nil);
-  FpSigAction(SIGSEGV,@act,nil);
-  FpSigAction(SIGBUS,@act,nil);
-  FpSigAction(SIGILL,@act,nil);
-end;
-
-procedure SetupCmdLine;
-var
-  bufsize,
-  len,j,
-  size,i : longint;
-  found  : boolean;
-  buf    : pchar;
-
-  procedure AddBuf;
-  begin
-    reallocmem(cmdline,size+bufsize);
-    move(buf^,cmdline[size],bufsize);
-    inc(size,bufsize);
-    bufsize:=0;
-  end;
-
-begin
-  GetMem(buf,ARG_MAX);
-  size:=0;
-  bufsize:=0;
-  i:=0;
-  while (i<argc) do
-   begin
-     len:=strlen(argv[i]);
-     if len>ARG_MAX-2 then
-      len:=ARG_MAX-2;
-     found:=false;
-     for j:=1 to len do
-      if argv[i][j]=' ' then
-       begin
-         found:=true;
-         break;
-       end;
-     if bufsize+len>=ARG_MAX-2 then
-      AddBuf;
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     move(argv[i]^,buf[bufsize],len);
-     inc(bufsize,len);
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     if i<argc then
-      buf[bufsize]:=' '
-     else
-      buf[bufsize]:=#0;
-     inc(bufsize);
-     inc(i);
-   end;
-  AddBuf;
-  FreeMem(buf,ARG_MAX);
-end;
-
-{
- $Log$
- Revision 1.27  2005-02-06 13:06:20  peter
-   * moved file and dir functions to sysfile/sysdir
-   * win32 thread in systemunit
-
- Revision 1.26  2005/02/05 22:53:43  peter
-   * use typecasted sigactionhandler, needed for arm
-
- Revision 1.25  2005/02/03 21:42:17  peter
-   * readded magic value $4000000 for sa_flags for x86_64
-
- Revision 1.24  2005/01/31 20:13:24  peter
-   * rt_sigaction for all cpus
-
- Revision 1.23  2005/01/30 18:01:15  peter
-   * signal cleanup for linux
-   * sigactionhandler instead of tsigaction for bsds
-   * sigcontext moved to cpu dir
-
- Revision 1.22  2004/11/02 14:49:48  florian
-   * fixed baseunix.signal for CPU using rt_sigaction
-   * fixed it for x86_64 too
-
- Revision 1.21  2004/10/25 15:38:59  peter
-   * compiler defined HEAP and HEAPSIZE removed
-
- Revision 1.20  2004/08/04 19:27:09  florian
-   * fixed floating point and integer exception handling on sparc/linux
-
- Revision 1.19  2004/05/31 20:25:04  peter
-   * removed warnings
-
- Revision 1.18  2004/05/16 18:51:20  peter
-   * use thandle in do_*
-
- Revision 1.17  2004/05/01 15:59:17  florian
-   * x86_64 exception handling fixed
-
- Revision 1.16  2004/04/27 20:47:00  florian
-   * tried to fix x86-64 signal handling
-
- Revision 1.15  2004/04/22 21:16:35  peter
-   * do_write/do_read fix
-
- Revision 1.14  2004/03/27 14:33:45  florian
-   * tell sigaction to pass siginfo on arm
-
- Revision 1.13  2004/03/10 20:35:33  peter
-   * call _haltproc instead of exit(). This is required for libc linking
-
- Revision 1.12  2004/01/01 14:19:55  marco
-  * use_getcwd updates because FPC_USE_LIBC uses that
-
- Revision 1.11  2003/12/30 16:26:10  marco
-  * some more fixes. Testing on idefix
-
- Revision 1.10  2003/12/21 20:30:49  peter
-   * don't exit in getdir when fpstat gives a failure
-
- Revision 1.9  2003/12/14 14:28:36  peter
-   * only check errno if the syscall failed
-
- Revision 1.8  2003/11/01 01:58:11  marco
-  * more small fixes.
-
- Revision 1.7  2003/10/31 20:36:01  marco
-  * i386 specific fixes that hopefully fix texception4.
-        Only the "generic" signal handler was ported to the unix rtl.
-
- Revision 1.6  2003/09/27 12:51:33  peter
-   * fpISxxx macros renamed to C compliant fpS_ISxxx
-
- Revision 1.5  2003/05/01 08:05:23  florian
-   * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
-
- Revision 1.4  2002/12/24 19:45:40  peter
-   * Fix do_erase which was wrong with inoutres setting
-
- Revision 1.3  2002/12/23 22:23:43  peter
-   * fixed Getdir to not set Inoutres
-   * broken symlinks are now ignored in getdir instead of aborting
-     the search
-
- Revision 1.2  2002/12/18 20:43:27  peter
-   * removed stackcheck, the generic stackcheck is used
-   * fixed return value for error conversion when no error was passed
-
- Revision 1.1  2002/12/18 16:43:26  marco
-  * new unix rtl, linux part.....
-
- Revision 1.7  2002/11/14 12:18:03  marco
-  * fixed Fptime call to (NIL)
-
- Revision 1.6  2002/10/27 17:21:29  marco
-  * Only "difficult" functions + execvp + termios + rewinddir left to do
-
- Revision 1.5  2002/10/26 18:27:52  marco
-  * First series POSIX calls commits. Including getcwd.
-
- Revision 1.4  2002/09/07 16:01:26  peter
-   * old logs removed and tabs fixed
-
- Revision 1.3  2002/08/20 12:50:22  marco
-  * New errno handling. Should be libc compatible.
-
- Revision 1.2  2002/08/10 13:42:36  marco
-  * Fixes Posix dir copied to devel branch
-
- Revision 1.1.2.18  2002/03/10 11:45:02  carl
- * InOutRes := 16 with rmdir()
- * InOutRes := 5 more checking
-
- Revision 1.1.2.17  2002/03/03 15:11:51  carl
- * erase() bugfix (erasing a directory is done via rmdir() only!)
-
- Revision 1.1.2.16  2002/02/15 18:13:35  carl
- * bugfix for paramstr(0)
-
-}

+ 4 - 45
rtl/linux/ossysc.inc

@@ -15,28 +15,11 @@
 
  ****************************************************************************
 }
-{$I syscallh.inc}
-{$I ostypes.inc}
-
-{$ifdef FPC_USE_LIBC}
-
-  {$Linklib c}
-
-  {$ifdef FPC_IS_SYSTEM}
-    {$i oscdeclh.inc}
-  {$endif}
-  {$I bunxmacr.inc}
-
-{$else}
 
 {*****************************************************************************
                      --- Main:The System Call Self ---
 *****************************************************************************}
 
-{$I syscall.inc}
-{$I sysnr.inc}
-{$I bunxmacr.inc}
-
 function Fptime(tloc:pTime): TTime; [public, alias : 'FPC_SYSC_TIME'];
 
 begin
@@ -491,36 +474,12 @@ begin
  fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
 end;
 
-{$ENDIF}
-
-CONST
-  {Constansts Termios/Ioctl (used in Do_IsDevice) }
-  {$ifdef PowerPC}
-  IOCtl_TCGETS=$402c7413;
-  {$else}
-  IOCtl_TCGETS=$5401; // TCGETS is also in termios.inc, but the sysunix needs only this
-  {$endif}
-
-
-Function Do_IsDevice(Handle:THandle):boolean;
-{
-  Interface to Unix ioctl call.
-  Performs various operations on the filedescriptor Handle.
-  Ndx describes the operation to perform.
-  Data points to data needed for the Ndx function. The structure of this
-  data is function-dependent.
-}
-
-var
-  Data : array[0..255] of byte; {Large enough for termios info}
-begin
-  Do_IsDevice:=(Fpioctl(handle,IOCTL_TCGETS,@data)<>-1);
-end;
-
-
 {
  $Log$
- Revision 1.34  2005-02-13 20:01:38  peter
+ Revision 1.35  2005-02-13 21:47:56  peter
+   * include file cleanup part 2
+
+ Revision 1.34  2005/02/13 20:01:38  peter
    * include file cleanup
 
  Revision 1.33  2005/02/06 12:16:52  peter

+ 0 - 55
rtl/linux/ossysch.inc

@@ -1,55 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2002 by Marco van de Voort
-
-    Header file for calls used in System unit, but not exposed
-    in BaseUnix.
-
-    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,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- ****************************************************************************
-}
-
-//Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer;  external name 'FPC_SYSC_MMAP';
-//Function Fpmunmap(start:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
-//function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
-//Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;   external name 'FPC_SYSC_READLINK';
-//Function FpIOCtl(handle:cint;ndx:culong;Data: Pointer):cint;  external name 'FPC_SYSC_IOCTL';
-//Function FpGetPid:pid_t;   external name 'FPC_SYSC_GETPID';
-//Function FpNanoSleep(req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
-
-{
- $Log$
- Revision 1.8  2004-11-19 13:15:14  marco
-  * external rework. Mostly done.
-
- Revision 1.7  2004/11/14 12:21:08  marco
-  * moved some calls from unix to baseunix. Darwin untested.
-
- Revision 1.6  2003/11/19 11:46:55  marco
-  * changes due to the previous *BSD changes. Mainly moving constants from
-    unix to systypes.inc (which acts as unxtypes.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/20 15:10:30  marco
-  * small fixes. fcl now compiles
-
- Revision 1.3  2003/09/15 20:29:50  marco
-  * small 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  2002/12/18 16:43:26  marco
-  * new unix rtl, linux part.....
-
-
-}

+ 300 - 40
rtl/linux/ostypes.inc

@@ -1,10 +1,9 @@
 {
     $Id$
     This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Michael Van Canneyt,
-    member of the Free Pascal development team.
+    Copyright (c) 2001 by Free Pascal development team
 
-    OS dependant types internal to the Linux RTL.
+    Types and structures for the BaseUnix unit.
 
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
@@ -13,21 +12,196 @@
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
- **********************************************************************}
+ ***********************************************************************}
 
-Type
+{***********************************************************************}
+{                         Base Unix Structures                          }
+{***********************************************************************}
 
-{
- Linux system calls take arguments as follows :
-
-   i386    m68k    ppc
-   %eax    %d0     r0      System call number
-   %ebx    %d1     r3      first argument
-   %ecx    %d2     r4      second argument
-   %edx    %d3     r5      third argumens
-   %esi    %d3     r6      fourth argument
-   %edi    %d4     r7      fifth argument
-}
+{$IFDEF FPC_IS_SYSTEM}
+  {$i ptypes.inc}
+{$ENDIF}
+
+
+CONST
+//  SYS_NMLM                 = 65;
+    UTSNAME_LENGTH           = SYS_NMLN;
+    UTSNAME_NODENAME_LENGTH  = UTSNAME_LENGTH;
+    {$ifdef usedomain}
+    UTSNAME_DOMAIN_LENGTH    = UTSNAME_LENGTH;
+    {$endif}
+
+   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;
+
+
+TYPE
+   Blksize_t  = cuint;
+   Blkcnt_t   = cuint;
+   Ino64_t    = cint64;
+   Off64_t    = cint64;
+
+   TBlkSize   = BlkSize_t;
+   PBlkSize   = ^BlkSize_t;
+   TBlkCnt    = Blkcnt_t;
+   PBlkCnt    = ^Blkcnt_t;
+   TIno64     = Ino64_t;
+   PIno64     = ^Ino64_t;
+   TOff64     = Off64_t;
+   POff64     = ^Off64_t;
+
+   { system information services }
+   UtsName   = Record
+                Sysname : Array[0..UTSNAME_LENGTH -1] OF Char;   // Name of this OS
+                Nodename: Array[0..UTSNAME_NODENAME_LENGTH-1] OF Char;   // Name of this network node.
+                Release : Array[0..UTSNAME_LENGTH -1] OF Char;   // Release level.
+                Version : Array[0..UTSNAME_LENGTH -1] OF Char;   // Version level.
+                Machine : Array[0..UTSNAME_LENGTH -1] OF Char;   // Hardware type.
+               {$ifdef usedomain}
+                Domain  : array[0..UTSNAME_DOMAIN_LENGTH-1] of char;  // Linux addition "Domain"
+               {$endif}
+               end;
+  TUtsName   = UtsName;
+  PUtsName   = TUtsName;
+
+
+{ Definition of (kernel) stat type }
+{ see kernel/include/asm-<cpu>/stat.h, include/linux/types.h and }
+{ include /include/asm-<cpu>/posix-types.h                       }
+
+{$i stat.inc}
+
+  TStat      = Stat;
+  PStat      = ^Stat;
+
+
+{$ifdef notused} // 64-bit support needs some work still :-)
+  { file characteristics services }
+   stat64    = record
+        st_dev        : dev_t;             // inode's device
+        pad1          : cushort;
+        {$ifdef 64bitfs}                   // ??
+        __st_ino      : ino_t;
+        {$else}
+        st_ino        : ino_t;             // inode's number
+        {$endif}
+        st_mode       : mode_t;            // inode protection mode
+        st_nlink      : nlink_t;           // number of hard links
+        st_uid        : uid_t;             // user ID of the file's owner
+        st_gid        : gid_t;             // group ID of the file's group
+        st_rdev       : dev_t;             // device type
+        pad2          : cushort;
+        {$ifdef 64bitfs}
+        st_size       : off64_t;            // file size, in bytes
+        {$else}
+        st_size       : off_t;             // file size, in bytes
+        {$endif}
+        st_blksize    : blksize_t;           // optimal blocksize for I/O
+        {$ifdef 64bitfs}
+        st_blocks     : blkcnt64_t;            // blocks allocated for file
+        {$else}
+        st_blocks     : blkcnt_t;            // blocks allocated for file
+        {$endif}
+        st_atime      : time_t;            // time of last access
+        unused1       : culong;
+        st_mtime      : time_t;            // time of last data modification
+        unused2       : culong;
+        st_ctime      : time_t;            // time of last file status change
+        unused3       : culong;
+        {$ifdef 64bitfs}
+        st_ino        : ino64_t
+        {$else}
+        unused4       : culong;
+        unused5       : culong;
+        {$endif}
+   end;
+{$endif}
+
+  { directory services }
+
+  Dirent     = packed record
+               {$ifndef 64bitfs}
+                d_fileno      : ino_t;                          // file number of entry
+                d_off         : off_t;
+                {$else}
+                d_fileno      : ino64_t;                        // file number of entry
+                d_off         : off64_t;
+               {$endif}
+                d_reclen      : cushort;                        // length of string in d_name
+               {$ifdef Uselibc} // Libc different from kernel record!
+                d_type        : cuchar;                         // file type, see below
+               {$endif}
+                d_name        : array[0..(255 + 1)-1] of char;  // name must be no longer than this
+               end;
+  TDirent    = Dirent;
+  pDirent    = ^Dirent;
+
+{$ifdef oldreaddir}
+           { Still old one. This is a userland struct}
+
+   Dir       = record
+                dd_fd     : integer;
+                dd_loc    : longint;
+                dd_size   : integer;
+                dd_buf    : pdirent;
+                {The following are used in libc, but NOT in the linux kernel sources ??}
+                dd_nextoff: longint;
+                dd_max : integer; {size of buf. Irrelevant, as buf is of type dirent}
+                dd_lock   : pointer;
+               end;
+{$else}
+        // new libc one. NOTE that off_t must be real, so 64-bit ifdef
+        // 64bitsfs
+   Dir       = Record   // packing doesn't matter. This is a userland struct.
+                fd      : cint;
+                data    : pchar;
+                allocation: size_t;
+                _size     : size_t;
+                offset    : size_t;
+                filepos   : off_t;
+                end;
+{$endif}
+
+   TDir      = Dir;
+   pDir      = ^Dir;
+
+
+   UTimBuf   = Record
+                 actime  : time_t;
+                 modtime : time_t;
+                end;
+
+   TUtimBuf  = UtimBuf;
+   pUtimBuf  = ^UtimBuf;
+
+   FLock     = Record
+                l_type  : cshort;       { lock type: read/write, etc. }
+                l_whence: cshort;       { type of l_start }
+                {$ifdef 64bitfs}
+                l_start : off64_t;      { starting offset }
+                l_len   : off64_t;      { len = 0 means until end of file }
+                {$else}
+                l_start : off_t;        { starting offset }
+                l_len   : off_t;        { len = 0 means until end of file }
+                {$endif}
+                l_pid   : pid_t;        { lock owner }
+               End;
+
+   tms       = packed Record
+                tms_utime  : clock_t;   { User CPU time }
+                tms_stime  : clock_t;   { System CPU time }
+                tms_cutime : clock_t;   { User CPU time of terminated child procs }
+                tms_cstime : clock_t;   { System CPU time of terminated child procs }
+               end;
+   TTms      = tms;
+   PTms      = ^tms;
+
+ TFDSet    = ARRAY[0..(FD_MAXFDSET div 32)-1] of Cardinal;
+ pFDSet    = ^TFDSet;
 
   timezone = packed record
     tz_minuteswest,tz_dsttime:cint;
@@ -35,7 +209,68 @@ Type
   ptimezone =^timezone;
   TTimeZone = timezone;
 
-Const   // generated by statmacr.c
+{***********************************************************************}
+{                  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. }
+{$ifdef sparc}
+    O_APPEND  =          8;
+    O_CREAT   =       $200;
+    O_TRUNC   =       $400;
+    O_EXCL    =       $800;
+    O_SYNC    =      $2000;
+    O_NONBLOCK =     $4000;
+    O_NDELAY  =      O_NONBLOCK or 4;
+    O_NOCTTY  =      $8000;
+    O_DIRECTORY =   $10000;
+    O_NOFOLLOW =    $20000;
+    O_LARGEFILE =   $40000;
+    O_DIRECT  =    $100000;
+{$else sparc}
+    O_CREAT   =        $40;
+    O_EXCL    =        $80;
+    O_NOCTTY  =       $100;
+    O_TRUNC   =       $200;
+    O_APPEND  =       $400;
+    O_NONBLOCK =      $800;
+    O_NDELAY  =     O_NONBLOCK;
+    O_SYNC    =      $1000;
+    O_DIRECT  =      $4000;
+    O_LARGEFILE =    $8000;
+    O_DIRECTORY =   $10000;
+    O_NOFOLLOW =    $20000;
+{$endif sparc}
+
+    { mode_t possible values                                 }
+    S_IRUSR =  %0100000000;     { Read permission for owner   }
+    S_IWUSR =  %0010000000;     { Write permission for owner  }
+    S_IXUSR =  %0001000000;     { Exec  permission for owner  }
+    S_IRGRP =  %0000100000;     { Read permission for group   }
+    S_IWGRP =  %0000010000;     { Write permission for group  }
+    S_IXGRP =  %0000001000;     { Exec permission for group   }
+    S_IROTH =  %0000000100;     { Read permission for world   }
+    S_IWOTH =  %0000000010;     { Write permission for world  }
+    S_IXOTH =  %0000000001;     { Exec permission for world   }
+
+    { Used for waitpid }
+    WNOHANG   =          1;     { don't block waiting               }
+    WUNTRACED =          2;     { report status of stopped children }
+
+  { File types }
   S_IFMT  = 61440; { type of file mask}
   S_IFIFO = 4096;  { named pipe (fifo)}
   S_IFCHR = 8192;  { character special}
@@ -45,43 +280,68 @@ Const   // generated by statmacr.c
   S_IFLNK = 40960; { symbolic link }
   S_IFSOCK= 49152; { socket }
 
-const
   { Constansts for MMAP }
   MAP_PRIVATE   =2;
   MAP_ANONYMOUS =$20;
 
 
+  { For File control mechanism }
+  F_GetFd  = 1;
+  F_SetFd  = 2;
+  F_GetFl  = 3;
+  F_SetFl  = 4;
+  F_GetLk  = 5;
+  F_SetLk  = 6;
+  F_SetLkW = 7;
+  F_SetOwn = 8;
+  F_GetOwn = 9;
+
+    {*************************************************************************}
+    {                               SIGNALS                                   }
+    {*************************************************************************}
+
+{$i signal.inc}
+
 {
- $Log$
- Revision 1.10  2005-02-13 20:01:38  peter
-   * include file cleanup
+  $Log$
+  Revision 1.11  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.10  2004/09/12 15:20:23  peter
+    * sparc has different values for O_ flags
+
+  Revision 1.9  2004/03/04 22:15:16  marco
+   * UnixType changes. Please report problems to me.
 
- Revision 1.9  2004/12/02 11:23:06  marco
-  * tz_ added to ttimezoen fields
+  Revision 1.8  2004/02/22 15:00:27  marco
+   * genfdset word count added. Small fix for libc maxsigsetsize
 
- Revision 1.8  2004/02/06 23:06:16  florian
-   - killed tsyscallregs
+  Revision 1.7  2004/01/31 16:17:38  florian
+    * removed packed directive from Dir type because it's not properly aligned
+      and it's never passed to the OS
 
- Revision 1.7  2004/02/06 21:17:41  daniel
-   * Revert back to longint (it broke make cycle)
+  Revision 1.6  2003/12/31 20:17:06  marco
+   * sigset size adaption for FPC_USE_LIBC
 
- Revision 1.6  2004/02/06 15:58:21  florian
-   * fixed x86-64 assembler problems
+  Revision 1.5  2003/12/02 00:04:34  sg
+  * Fixed ln2bitmask
 
- 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/11/19 10:56:15  marco
+   * some constants moved from System
 
- Revision 1.4  2003/09/17 11:24:46  marco
-  * fixes for new macro's
+  Revision 1.3  2003/09/14 20:15:01  marco
+   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
 
- Revision 1.3  2003/09/14 20:15:01  marco
-  * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
+  Revision 1.2  2003/05/15 22:50:50  jonas
+    * the stat type is processor-dependent
+    * the dev_t tpye is processor dependent. Don't use it in the stat type
+      however, as that one is also used at a time where dev_t is already
+      defined as qword
 
- Revision 1.2  2002/12/18 16:43:26  marco
-  * new unix rtl, linux part.....
+  Revision 1.1  2002/12/18 16:43:26  marco
+   * new unix rtl, linux part.....
 
- Revision 1.1  2002/11/12 14:37:59  marco
-  * Parts of new unix rtl
+  Revision 1.1  2002/11/12 14:37:59  marco
+   * Parts of new unix rtl
 
 }

+ 94 - 4
rtl/linux/sysos.inc

@@ -61,14 +61,104 @@ end;
 { OS dependant parts  }
 
 {$I errno.inc}                          // error numbers
-{$I bunxtype.inc}                       // c-types, unix base types, unix base structures
-{$I ossysc.inc}                         // base syscalls
-{$I osmain.inc}                         // base wrappers *nix RTL (derivatives)
+{$I ostypes.inc}                        // c-types, unix base types, unix base structures
+{$I osmacro.inc}
+
+{$ifdef FPC_USE_LIBC}
+  {$Linklib c}
+  {$i oscdeclh.inc}
+{$else}
+  {$I syscallh.inc}
+  {$I syscall.inc}
+  {$I sysnr.inc}
+  {$I ossysc.inc}
+{$endif}
+
+
+{*****************************************************************************
+                            Error conversion
+*****************************************************************************}
+
+{
+  The lowlevel file functions should take care of setting the InOutRes to the
+  correct value if an error has occured, else leave it untouched
+}
+
+Function PosixToRunError  (PosixErrno : longint) : longint;
+{
+  Convert ErrNo error to the correct Inoutres value
+}
+
+begin
+  if PosixErrNo=0 then { Else it will go through all the cases }
+   exit(0);
+  case PosixErrNo of
+   ESysENFILE,
+   ESysEMFILE : Inoutres:=4;
+   ESysENOENT : Inoutres:=2;
+    ESysEBADF : Inoutres:=6;
+   ESysENOMEM,
+   ESysEFAULT : Inoutres:=217;
+   ESysEINVAL : Inoutres:=218;
+    ESysEPIPE,
+    ESysEINTR,
+      ESysEIO,
+   ESysEAGAIN,
+   ESysENOSPC : Inoutres:=101;
+ ESysENAMETOOLONG : Inoutres := 3;
+    ESysEROFS,
+   ESysEEXIST,
+   ESysENOTEMPTY,
+   ESysEACCES : Inoutres:=5;
+   ESysEISDIR : InOutRes:=5;
+  else
+    begin
+       InOutRes := Integer(PosixErrno);
+    end;
+  end;
+ PosixToRunError:=InOutRes;
+end;
+
+
+Function Errno2InoutRes : longint;
+begin
+  Errno2InoutRes:=PosixToRunError(getErrno);
+  InoutRes:=Errno2InoutRes;
+end;
+
+
+{*****************************************************************************
+                          Low Level File Routines
+*****************************************************************************}
+
+Function Do_IsDevice(Handle:THandle):boolean;
+{
+  Interface to Unix ioctl call.
+  Performs various operations on the filedescriptor Handle.
+  Ndx describes the operation to perform.
+  Data points to data needed for the Ndx function. The structure of this
+  data is function-dependent.
+}
+const
+{$ifdef PowerPC}
+  IOCtl_TCGETS=$402c7413;
+{$else}
+  IOCtl_TCGETS=$5401; // TCGETS is also in termios.inc, but the sysunix needs only this
+{$endif}
+var
+  Data : array[0..255] of byte; {Large enough for termios info}
+begin
+  Do_IsDevice:=(Fpioctl(handle,IOCTL_TCGETS,@data)<>-1);
+end;
+
 
 
 {
    $Log$
-   Revision 1.4  2005-02-13 20:01:38  peter
+   Revision 1.5  2005-02-13 21:47:56  peter
+     * include file cleanup part 2
+
+   Revision 1.4  2005/02/13 20:01:38  peter
      * include file cleanup
 
    Revision 1.3  2005/02/07 22:04:55  peter

+ 150 - 7
rtl/linux/system.pp

@@ -25,13 +25,10 @@
 Unit {$ifdef VER1_0}Syslinux{$else}System{$endif};
 
 Interface
-{$define oldreaddir}
-{$define usedomain}
-{$define posixworkaround}
+
 {$define FPC_IS_SYSTEM}
-{$ifdef FPC_USE_LIBC}
-{$define usegetcwd}
-{$endif}
+
+{$i osdefs.inc}
 
 {$I sysunixh.inc}
 
@@ -41,6 +38,149 @@ Implementation
 {$I system.inc}
 
 
+{*****************************************************************************
+                       Misc. System Dependent Functions
+*****************************************************************************}
+
+procedure haltproc(e:longint);cdecl;external name '_haltproc';
+
+procedure System_exit;
+begin
+  haltproc(ExitCode);
+End;
+
+
+Function ParamCount: Longint;
+Begin
+  Paramcount:=argc-1
+End;
+
+
+function BackPos(c:char; const s: shortstring): integer;
+var
+ i: integer;
+Begin
+  for i:=length(s) downto 0 do
+    if s[i] = c then break;
+  if i=0 then
+    BackPos := 0
+  else
+    BackPos := i;
+end;
+
+
+ { variable where full path and filename and executable is stored }
+ { is setup by the startup of the system unit.                    }
+var
+ execpathstr : shortstring;
+
+function paramstr(l: longint) : string;
+ begin
+   { stricly conforming POSIX applications  }
+   { have the executing filename as argv[0] }
+   if l=0 then
+     begin
+       paramstr := execpathstr;
+     end
+   else
+     paramstr:=strpas(argv[l]);
+ end;
+
+Procedure Randomize;
+Begin
+  randseed:=longint(Fptime(nil));
+End;
+
+
+{*****************************************************************************
+                         SystemUnit Initialization
+*****************************************************************************}
+
+// signal handler is arch dependant due to processorexception to language
+// exception translation
+
+{$i sighnd.inc}
+
+var
+  act: SigActionRec;
+
+Procedure InstallSignals;
+begin
+  { Initialize the sigaction structure }
+  { all flags and information set to zero }
+  FillChar(act, sizeof(SigActionRec),0);
+  { initialize handler                    }
+  act.sa_handler := SigActionHandler(@SignalToRunError);
+  act.sa_flags:=SA_SIGINFO
+{$ifdef cpux86_64}
+    or $4000000
+{$endif cpux86_64}
+    ;
+  FpSigAction(SIGFPE,@act,nil);
+  FpSigAction(SIGSEGV,@act,nil);
+  FpSigAction(SIGBUS,@act,nil);
+  FpSigAction(SIGILL,@act,nil);
+end;
+
+procedure SetupCmdLine;
+var
+  bufsize,
+  len,j,
+  size,i : longint;
+  found  : boolean;
+  buf    : pchar;
+
+  procedure AddBuf;
+  begin
+    reallocmem(cmdline,size+bufsize);
+    move(buf^,cmdline[size],bufsize);
+    inc(size,bufsize);
+    bufsize:=0;
+  end;
+
+begin
+  GetMem(buf,ARG_MAX);
+  size:=0;
+  bufsize:=0;
+  i:=0;
+  while (i<argc) do
+   begin
+     len:=strlen(argv[i]);
+     if len>ARG_MAX-2 then
+      len:=ARG_MAX-2;
+     found:=false;
+     for j:=1 to len do
+      if argv[i][j]=' ' then
+       begin
+         found:=true;
+         break;
+       end;
+     if bufsize+len>=ARG_MAX-2 then
+      AddBuf;
+     if found then
+      begin
+        buf[bufsize]:='"';
+        inc(bufsize);
+      end;
+     move(argv[i]^,buf[bufsize],len);
+     inc(bufsize,len);
+     if found then
+      begin
+        buf[bufsize]:='"';
+        inc(bufsize);
+      end;
+     if i<argc then
+      buf[bufsize]:=' '
+     else
+      buf[bufsize]:=#0;
+     inc(bufsize);
+     inc(i);
+   end;
+  AddBuf;
+  FreeMem(buf,ARG_MAX);
+end;
+
+
 procedure SysInitStdIO;
 begin
   OpenStdIO(Input,fmInput,StdInputHandle);
@@ -98,7 +238,10 @@ End.
 
 {
   $Log$
-  Revision 1.22  2005-02-06 11:20:52  peter
+  Revision 1.23  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.22  2005/02/06 11:20:52  peter
     * threading in system unit
     * removed systhrds unit
 

+ 5 - 9
rtl/linux/sysconst.inc → rtl/linux/unxconst.inc

@@ -14,14 +14,6 @@
  **********************************************************************}
 
 Const
-
-
-
-  { Things for LSEEK call }
-  Seek_set = 0;
-  Seek_Cur = 1;
-  Seek_End = 2;
-
   { Things for OPEN call - after linux/fcntl.h }
   Open_Accmode   = 3;
   Open_RdOnly    = 0;
@@ -94,9 +86,13 @@ Const
   {$else}
   IOCtl_TCGETS=$5401; // TCGETS is also in termios.inc, but the sysunix needs only this
   {$endif}
+
 {
   $Log$
-  Revision 1.12  2005-02-13 20:01:38  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.12  2005/02/13 20:01:38  peter
     * include file cleanup
 
   Revision 1.11  2004/11/14 12:21:08  marco

+ 4 - 1
rtl/linux/unixfunc.inc → rtl/linux/unxfunc.inc

@@ -59,7 +59,10 @@ end;
 
 {
   $Log$
-  Revision 1.1  2005-02-13 20:01:38  peter
+  Revision 1.1  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.1  2005/02/13 20:01:38  peter
     * include file cleanup
 
   Revision 1.27  2004/04/28 20:48:20  peter

+ 45 - 57
rtl/solaris/bunxmacr.inc

@@ -1,51 +1,52 @@
 {
-    $Id$
+   $Id$
     Copyright (c) 2000-2002 by Marco van de Voort
 
-    The *BSD POSIX macro's that are used both in the Baseunix unit as the
+    The "linux" posixy macro's that are used both in the Baseunx unit as the
     system unit. Not aliased via public names because I want these to be
     inlined as much as possible in the future.
 
-    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.
+    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.
 
-    This program is distributed in the hope that it will be useful,
-    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.
+    This program is distributed in the hope that it will be useful, 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.
 
-    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.
+    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.
 
- ****************************************************************************}
+ ****************************************************************************
+}
 
-function FPS_ISDIR(m : TMode): boolean;
+function FpS_ISDIR(m : TMode): boolean;
 
 begin
- FPS_ISDIR:=((m and S_IFMT) = S_IFDIR);
+  FpS_ISDIR:=((m and S_IFMT) = S_IFDIR);
 end;
 
-function FPS_ISCHR(m : TMode): boolean;
+function FpS_ISCHR(m : TMode): boolean;
 begin
- FPS_ISCHR:=((m and S_IFMT) = S_IFCHR);
+  FpS_ISCHR:=((m and S_IFMT) = S_IFCHR);
 end;
 
-function FPS_ISBLK(m : TMode): boolean;
+function FpS_ISBLK(m : TMode): boolean;
 begin
- FPS_ISBLK:=((m and S_IFMT) = S_IFBLK);
+ FpS_ISBLK:=((m and S_IFMT) = S_IFBLK);
 end;
 
-function FPS_ISREG(m : TMode): boolean;
+function FpS_ISREG(m : TMode): boolean;
 begin
- FPS_ISREG:=((m and S_IFMT) = S_IFREG);
+ FpS_ISREG:=((m and S_IFMT) = S_IFREG);
 end;
 
-function FPS_ISFIFO(m : TMode): boolean;
+function FpS_ISFIFO(m : TMode): boolean;
 begin
- FPS_ISFIFO:=((m and S_IFMT) = S_IFIFO);
+ FpS_ISFIFO:=((m and S_IFMT) = S_IFIFO);
 end;
 
 Function FPS_ISLNK(m:TMode):boolean;
@@ -60,26 +61,26 @@ begin
  FPS_ISSOCK:=((m and S_IFMT) = S_IFSOCK);
 end;
 
-function wifexited(status : cint): cint;
+function wifexited(status : cint): boolean;
 begin
- wifexited:=cint((status AND 127) =0);
+ wifexited:=(status AND $7f) =0;
 end;
 
 function wexitstatus(status : cint): cint;
 begin
- wexitstatus:=(status and 127) shr 8;
+ wexitstatus:=(status and $FF00) shr 8;
 end;
 
 function wstopsig(status : cint): cint;
 begin
- wstopsig:=(status and 127) shr 8;
+ wstopsig:=(status and $FF00) shr 8;
 end;
 
 const wstopped=127;
 
-function wifsignaled(status : cint): cint;
+function wifsignaled(status : cint): boolean;
 begin
- wifsignaled:=cint(((status and 127)<>wstopped) and ((status and 127)<>0));
+ wifsignaled:=((status and $FF)<>wstopped) and ((status and 127)<>0);
 end;
 
 function wtermsig(status : cint):cint;
@@ -90,38 +91,25 @@ end;
 
 {
   $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.5  2003/09/27 13:04:58  peter
-    * fpISxxx renamed
-
-  Revision 1.4  2003/09/17 11:52:05  marco
-   * stat macro fixes voor BSD
-
-  Revision 1.3  2003/09/14 20:15:01  marco
-   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
-
-  Revision 1.2  2003/01/21 15:34:59  marco
-   * fix octal that broke 1.0.x
+  Revision 1.2  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
 
-  Revision 1.1  2003/01/05 19:01:28  marco
-   * FreeBSD compiles now with baseunix mods.
+  Revision 1.4  2005/02/13 20:01:38  peter
+    * include file cleanup
 
-  Revision 1.4  2002/11/12 14:19:46  marco
-   * fixes to macro
+  Revision 1.3  2003/09/27 12:51:33  peter
+    * fpISxxx macros renamed to C compliant fpS_ISxxx
 
-  Revision 1.3  2002/10/26 18:27:51  marco
-   * First series POSIX calls commits. Including getcwd.
+  Revision 1.2  2003/09/17 11:24:46  marco
+   * fixes for new macro's
 
-  Revision 1.2  2002/09/07 16:01:17  peter
-    * old logs removed and tabs fixed
+  Revision 1.1  2002/12/18 16:43:26  marco
+   * new unix rtl, linux part.....
 
-  Revision 1.1  2002/08/19 12:29:11  marco
-   * First working POSIX *BSD system unit.
+  Revision 1.2  2002/11/12 15:31:33  marco
+   * Killed octal codes for 1.0.x compilability.
 
+  Revision 1.1  2002/11/12 14:37:59  marco
+   * Parts of new unix rtl
 
 }

+ 6 - 1
rtl/solaris/system.pp

@@ -17,6 +17,8 @@ unit System;
 
 interface
 
+{$define FPC_IS_SYSTEM}
+
 { include system-independent routine headers }
 
 {$I sysunixh.inc}
@@ -84,7 +86,10 @@ End.
 
 {
  $Log$
- Revision 1.2  2005-02-10 17:30:54  peter
+ Revision 1.3  2005-02-13 21:47:56  peter
+   * include file cleanup part 2
+
+ Revision 1.2  2005/02/10 17:30:54  peter
    * renamed to solaris
 
  Revision 1.5  2005/02/07 22:17:26  peter

+ 7 - 4
rtl/unix/baseunix.pp

@@ -19,7 +19,7 @@ Interface
 
 Uses UnixType;
 
-{$i bunxdefs.inc}       { Compile time defines }
+{$i osdefs.inc}       { Compile time defines }
 
 {$i aliasptp.inc}
 
@@ -30,8 +30,8 @@ Uses UnixType;
 {$endif}
 
 {$i errno.inc}          { Error numbers }
-{$i bunxtype.inc}       { Types }
 {$i ostypes.inc}
+
 {$ifdef FPC_USE_LIBC}
   const clib = 'c';
   {$i oscdeclh.inc}
@@ -86,13 +86,16 @@ end;
   {$i settimeo.inc}
 {$endif}
 
-{$i bunxmacr.inc}       { macro implenenations }
+{$i osmacro.inc}        { macro implenenations }
 {$i bunxovl.inc}        { redefs and overloads implementation }
 
 end.
 {
   $Log$
-  Revision 1.1  2005-02-13 20:01:38  peter
+  Revision 1.2  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.1  2005/02/13 20:01:38  peter
     * include file cleanup
 
   Revision 1.14  2004/12/02 18:24:35  marco

+ 12 - 20
rtl/unix/unix.pp

@@ -20,18 +20,8 @@ Uses BaseUnix,UnixType;
 
 {$i aliasptp.inc}
 
-//type
-//   pathstr = string[255];
-
-{$define POSIXWORKAROUND}
-{ Get Types and Constants }
-{$i sysconst.inc}
-
-{Get error numbers, some more signal definitions and other OS dependant
- types (that are not POSIX) }
-{i errno.inc}
-{$I signal.inc}
-{$i ostypes.inc}
+{ Get Types and Constants only exported in this unit }
+{$i unxconst.inc}
 
 // We init to zero to be able to put timezone stuff under IFDEF, and still
 // keep the code working.
@@ -200,10 +190,10 @@ Function  FSearch  (const path:AnsiString;dirlist:AnsiString):AnsiString;
 procedure SigRaise (sig:integer);
 
 {$ifdef FPC_USE_LIBC}
-const clib = 'c';
-{$i unxdeclh.inc}
+  const clib = 'c';
+  {$i unxdeclh.inc}
 {$else}
-{$i unxsysch.inc} //  calls used in system and not reexported from baseunix
+  {$i unxsysch.inc} //  calls used in system and not reexported from baseunix
 {$endif}
 
 {******************************************************************************
@@ -219,16 +209,15 @@ Uses Strings{$ifndef FPC_USE_LIBC},Syscall{$endif};
 {$i unxovl.inc}
 
 {$ifndef FPC_USE_LIBC}
-{$i syscallh.inc}
-{$i ossysch.inc}
-{$i unxsysc.inc}
+  {$i syscallh.inc}
+  {$i unxsysc.inc}
 {$endif}
 
 { Get the definitions of textrec and filerec }
 {$i textrec.inc}
 {$i filerec.inc}
 
-{$i unixfunc.inc}   { Platform specific implementations }
+{$i unxfunc.inc}   { Platform specific implementations }
 
 Function getenv(name:string):Pchar; external name 'FPC_SYSC_FPGETENV';
 
@@ -1228,7 +1217,10 @@ End.
 
 {
   $Log$
-  Revision 1.82  2005-02-13 20:01:38  peter
+  Revision 1.83  2005-02-13 21:47:56  peter
+    * include file cleanup part 2
+
+  Revision 1.82  2005/02/13 20:01:38  peter
     * include file cleanup
 
   Revision 1.81  2005/02/06 11:20:52  peter