瀏覽代碼

* include file cleanup

peter 20 年之前
父節點
當前提交
ae8b7b153b

+ 34 - 0
rtl/bsd/bunxdefs.inc

@@ -0,0 +1,34 @@
+{
+    $Id$
+    Copyright (c) 2000-2002 by Marco van de Voort
+
+    Target dependent defines used when compileing the baseunix unit
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.
+
+ ****************************************************************************}
+
+{$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
+    * include file cleanup
+
+}

+ 8 - 5
rtl/bsd/bunxmacr.inc

@@ -60,9 +60,9 @@ 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 127) =0;
 end;
 
 function wexitstatus(status : cint): cint;
@@ -77,9 +77,9 @@ 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 127)<>wstopped) and ((status and 127)<>0);
 end;
 
 function wtermsig(status : cint):cint;
@@ -90,7 +90,10 @@ end;
 
 {
   $Log$
-  Revision 1.5  2003-09-27 13:04:58  peter
+  Revision 1.6  2005-02-13 20:01:37  peter
+    * include file cleanup
+
+  Revision 1.5  2003/09/27 13:04:58  peter
     * fpISxxx renamed
 
   Revision 1.4  2003/09/17 11:52:05  marco

+ 0 - 73
rtl/bsd/bunxmain.inc

@@ -1,73 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2002 by Marco van de Voort.
-
-    Implementation of the POSIX unit for *BSD. In practice only includes
-    other files, or specifies libc bindings.
-
-    The conditional FPC_USELIBC can be used to switch from libc to syscall
-    usage for basic primitives, but it is best to use unit POSIX if
-    possible. Note that the system unit must also be compiled using uselibc.
-
-    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.
-
- ****************************************************************************
-}
-
-{I ostypes.inc}
-{$I bunxmacr.inc}
-
-{$ifdef FPC_USE_LIBC}
-   {$Linklib c}
-
-{   var
-     Errno : cint; external name 'errno';}
-   
-
-{$else}
-   {$i sysdeclh.inc}
-{$endif}
-
-{$I bunxfunc.inc}
-
-{
- $Log$
- Revision 1.5  2004-11-14 12:21:08  marco
-  * moved some calls from unix to baseunix. Darwin untested.
-
- Revision 1.4  2004/05/31 18:03:51  jonas
-   * moved fpgeterrno/fpseterrno declarations to before their actual usage
-
- Revision 1.3  2003/12/30 12:26:21  marco
-  * FPC_USE_LIBC
-
- 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/05 19:01:28  marco
-  * FreeBSD compiles now with baseunix mods.
-
- Revision 1.8  2002/10/27 17:21:29  marco
-  * Only "difficult" functions + execvp + termios + rewinddir left to do
-
- Revision 1.7  2002/10/27 11:58:30  marco
-  * Modifications from Saturday.
-
- Revision 1.6  2002/10/26 18:27:51  marco
-  * First series POSIX calls commits. Including getcwd.
-
- Revision 1.5  2002/09/07 16:01:17  peter
-   * old logs removed and tabs fixed
-
- Revision 1.4  2002/08/21 07:03:16  marco
-  * Fixes from Tuesday.
-
- Revision 1.3  2002/08/19 12:29:11  marco
-  * First working POSIX *BSD system unit.
-
-}

+ 4 - 23
rtl/bsd/bunxfunc.inc → rtl/bsd/bunxsysc.inc

@@ -16,23 +16,6 @@
 
  **********************************************************************}
 
-{$ifndef FPC_USE_LIBC}
-{$i syscallh.inc}       // do_syscall declarations themselves
-{$i sysnr.inc}          // syscall numbers.
-{$i ossysch.inc}        // external interface to syscalls in system unit.
-{$endif}
-{$i genfuncs.inc}       // generic calls. (like getenv)
-
-
-{$I gensigset.inc}     // general sigset funcs implementation.
-{$I genfdset.inc}      // general fdset funcs.
-
-{$ifndef FPC_USE_LIBC}
-{  $ ifndef ver1_0}
-// Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
-{   $ endif}
-{$USER BLA!}
-
 Function FPKill(Pid:pid_t;Sig:cint):cint;
 {
   Send signal 'sig' to a process, or a group of processes.
@@ -551,14 +534,12 @@ begin
  fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
 end;
 
-
-{$endif}
-
-
-
 {
  $Log$
- Revision 1.10  2004-11-19 13:15:14  marco
+ Revision 1.1  2005-02-13 20:01:37  peter
+   * include file cleanup
+
+ Revision 1.10  2004/11/19 13:15:14  marco
   * external rework. Mostly done.
 
  Revision 1.9  2004/11/14 12:21:08  marco

+ 8 - 39
rtl/bsd/ossysc.inc

@@ -20,46 +20,12 @@
 
 {$ifdef FPC_USE_LIBC}
   {$Linklib c}
-  // Out of date atm.
 
-{$ifdef FPC_IS_SYSTEM}
-{$i oscdeclh.inc}
-{$endif}
-{$I bunxmacr.inc}
+  {$ifdef FPC_IS_SYSTEM}
+    {$i oscdeclh.inc}
+  {$endif}
+  {$i bunxmacr.inc}
 
-{   var
-     Errno : cint; external name 'errno';
-
-    function Fptime(tloc:ptime_t): time_t; cdecl; external name 'time';
-    function Fpopen(const path: pchar; flags : cint; mode: mode_t):cint; cdecl; external name 'open';
-    function Fpclose(fd : cint): cint; cdecl; external name 'close';
-    function Fplseek(fd : cint; offset : off_t; whence : cint): off_t; cdecl; external name 'lseek';
-    function Fpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; cdecl; external name 'read';
-    function Fpwrite(fd: cint;const buf:pchar; nbytes : size_t): ssize_t; cdecl; external name 'write';
-    function Fpunlink(const path: pchar): cint; cdecl; external name 'unlink';
-    function Fprename(const old : pchar; const newpath: pchar): cint; cdecl;external name 'rename';
-    function Fpstat(const path: pchar; var buf : stat): cint; cdecl; external name 'stat';
-    function Fpchdir(const path : pchar): cint; cdecl; external name 'chdir';
-    function Fpmkdir(const path : pchar; mode: mode_t):cint; cdecl; external name 'mkdir';
-    function Fprmdir(const path : pchar): cint; cdecl; external name 'rmdir';
-    function Fpopendir(const dirname : pchar): pdir; cdecl; external name 'opendir';
-    function Fpreaddir(var dirp : dir) : pdirent;cdecl; external name 'readdir';
-    function Fpclosedir(var dirp : dir): cint; cdecl; external name 'closedir';
-    procedure Fpexit(status : cint); cdecl; external name '_exit';
-    function Fpsigaction(sig: cint; var act : sigactionrec; var oact : sigactionrec): cint; cdecl; external name 'sigaction';
-    function Fpftruncate(fd : cint; flength : off_t): cint; cdecl; external name 'ftruncate';
-    function Fprename(const old : pchar; const newpath: pchar): cint; cdecl;external name 'rename';
-    function Fpfstat(fd : cint; var sb : stat): cint; cdecl; external name 'fstat';
-    function Fpfork : pid_t; cdecl; external name 'fork';
-    function Fpexecve(const path : pchar; const argv : ppchar; const envp: ppchar): cint; cdecl; external name 'execve';
-    function Fpwaitpid(pid : pid_t; tat_loc : pcint; options: cint): pid_t; cdecl; external name 'waitpid';
-    function Fpaccess(const pathname : pchar; amode : cint): cint; cdecl; external name 'access';
-
-    function Fpuname(var name: utsname): cint; cdecl; external name 'uname';
-
-    function FpDup(oldd:cint):cint; cdecl; external name 'dup';
-    function FpDup2(oldd:cint;newd:cint):cint; cdecl; external name 'dup2';
-}
 {$else}
 
 {*****************************************************************************
@@ -616,7 +582,10 @@ end;
 
 {
  $Log$
- Revision 1.21  2005-02-06 12:16:52  peter
+ Revision 1.22  2005-02-13 20:01:37  peter
+   * include file cleanup
+
+ Revision 1.21  2005/02/06 12:16:52  peter
    * bsd thread updates
 
  Revision 1.20  2004/11/14 12:21:08  marco

+ 0 - 35
rtl/bsd/unxsysc.inc

@@ -1,35 +0,0 @@
-{
-   $Id$
-   This file is part of the Free Pascal run time library.
-   Copyright (c) 2003 Marco van de Voort
-   member of the Free Pascal development team.
-
-   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.
-
-**********************************************************************}
-
-
-{
-   $Log$
-   Revision 1.8  2004-11-14 12:21:08  marco
-    * moved some calls from unix to baseunix. Darwin untested.
-
-   Revision 1.7  2004/11/03 15:00:43  marco
-    * Pathstr eliminated
-
-   Revision 1.6  2004/07/03 22:48:49  marco
-    * small fix for 1.0.x cycling
-
-   Revision 1.5  2004/04/22 16:22:10  marco
-    * fpnice fixes
-
-   Revision 1.4  2004/01/01 17:07:21  marco
-    * few small freebsd fixes backported from debugging linux
-
-
-}

+ 16 - 16
rtl/darwin/Makefile

@@ -1,10 +1,10 @@
 #
-# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/01/31]
+# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/02/09]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-sunos i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-sunos x86_64-linux x86_64-freebsd arm-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd arm-linux
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) sunos qnx
+UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
 FORCE:
 .PHONY: FORCE
@@ -277,7 +277,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs dos dl objects printer sockets sysutils typinfo classes math varutils charset ucomplex getopts heaptrc lineinfo errors terminfo termio video crt mouse keyboard console variants types sysctl dateutils sysconst cthreads strutils rtlconst
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs dos dl objects printer sockets sysutils typinfo classes math varutils charset ucomplex getopts heaptrc lineinfo errors terminfo termio video crt mouse keyboard console variants types sysctl dateutils sysconst cthreads strutils rtlconst
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -343,7 +343,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs dos dl objects printer sockets sysutils typinfo classes math varutils charset ucomplex getopts heaptrc lineinfo errors terminfo termio video crt mouse keyboard console variants types sysctl dateutils sysconst cthreads strutils rtlconst
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings sysctl baseunix unixutil unix initc cmem matrix dynlibs dos dl objects printer sockets sysutils typinfo classes math varutils charset ucomplex getopts heaptrc lineinfo errors terminfo termio video crt mouse keyboard console variants types sysctl dateutils sysconst cthreads strutils rtlconst
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -376,7 +376,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst rtlconst
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst rtlconst
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -442,7 +442,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst rtlconst
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst rtlconst
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -476,7 +476,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -542,7 +542,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -575,7 +575,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -641,7 +641,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -937,7 +937,7 @@ BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=sun
@@ -1063,7 +1063,7 @@ STATICLIBEXT=.a
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 PPUEXT=.ppu
 ASMEXT=.s
@@ -1846,14 +1846,14 @@ 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)/bunxmain.inc $(BSDINC)/ostypes.inc \
-  $(BSDINC)/bunxfunc.inc \
+  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+  $(BSDINC)/bunxsysc.inc \
   $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.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 \
-		 unixsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+		 unixfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 unixutil$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT)
 dynlibs$(PPUEXT) : dl$(PPUEXT)
 ctypes$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT)

+ 3 - 3
rtl/darwin/Makefile.fpc

@@ -126,8 +126,8 @@ strings$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(INC)/strings.pp $(INC)/stringsi.inc\
 #
 
 baseunix$(PPUEXT) : unixtype$(PPUEXT) sysctl$(PPUEXT) errno.inc $(BSDINC)/bunxtype.inc ptypes.inc $(BSDINC)/ctypes.inc \
-  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/bunxmain.inc $(BSDINC)/ostypes.inc \
-  $(BSDINC)/bunxfunc.inc \
+  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+  $(BSDINC)/bunxsysc.inc \
   $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 
@@ -135,7 +135,7 @@ unixtype$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT) $(UNIXINC)/unixtype.pp ptypes.inc $(B
 
 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 \
-                 unixsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+                 unixfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 unixutil$(PPUEXT) : $(SYSTEMUNIT)$(PPUEXT)
 

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

@@ -62,7 +62,10 @@ end;
 
 {
   $Log$
-  Revision 1.3  2004-07-01 18:34:53  jonas
+  Revision 1.1  2005-02-13 20:01:37  peter
+    * include file cleanup
+
+  Revision 1.3  2004/07/01 18:34:53  jonas
     * adapted second pclose as well
 
   Revision 1.2  2004/07/01 18:28:15  jonas

+ 20 - 20
rtl/freebsd/Makefile

@@ -1,10 +1,10 @@
 #
-# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/01/31]
+# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/02/09]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-sunos i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-sunos x86_64-linux x86_64-freebsd arm-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd arm-linux
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) sunos qnx
+UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
 FORCE:
 .PHONY: FORCE
@@ -283,7 +283,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconst initc cmem matrix dl termio  printer sysutils typinfo types classes math varutils dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial variants dateutils sysconst cthreads strutils convutils dos objects
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconst initc cmem matrix dl termio  printer sysutils typinfo types classes math varutils dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial variants dateutils sysconst cthreads strutils convutils dos objects
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -349,7 +349,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconst initc cmem matrix dl termio  printer sysutils typinfo types classes math varutils dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial variants dateutils sysconst cthreads strutils convutils dos objects
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseunix unixutil unix rtlconst initc cmem matrix dl termio  printer sysutils typinfo types classes math varutils dynlibs $(CPU_UNITS) charset ucomplex crt getopts heaptrc lineinfo errors sockets ipc terminfo video mouse keyboard console serial variants dateutils sysconst cthreads strutils convutils dos objects
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -382,7 +382,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_LOADERS+=prt0 cprt0 gprt0
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_LOADERS+=prt0 cprt0 gprt0
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -448,7 +448,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_LOADERS+=prt0 cprt0 gprt0
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_LOADERS+=prt0 cprt0 gprt0
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -481,7 +481,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -547,7 +547,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils sysconst
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -581,7 +581,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -647,7 +647,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -680,7 +680,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -746,7 +746,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -1042,7 +1042,7 @@ BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=sun
@@ -1168,7 +1168,7 @@ STATICLIBEXT=.a
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 PPUEXT=.ppu
 ASMEXT=.s
@@ -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 syscalls.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
 	$(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
@@ -1985,13 +1985,13 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.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)/bunxmain.inc $(BSDINC)/ostypes.inc \
-  $(BSDINC)/bunxfunc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
+  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+  $(BSDINC)/bunxsysc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
   $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-		 syscalls.inc sysconst.inc $(UNIXINC)/timezone.inc \
-		 unixsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+		 sysconst.inc $(UNIXINC)/timezone.inc \
+		 unixfunc.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)

+ 5 - 5
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 syscalls.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(BSDINC)/$(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
         $(COMPILER) -Us -Sg $(BSDINC)/$(SYSTEMUNIT).pp
 
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
@@ -149,15 +149,15 @@ 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)/bunxmain.inc $(BSDINC)/ostypes.inc \
-  $(BSDINC)/bunxfunc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
+  signal.inc $(UNIXINC)/bunxh.inc $(BSDINC)/ostypes.inc \
+  $(BSDINC)/bunxsysc.inc $(BSDPROCINC)/syscallh.inc sysnr.inc \
   $(BSDINC)/ostypes.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 
 
 unix$(PPUEXT) : $(UNIXINC)/unix.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-                 syscalls.inc sysconst.inc $(UNIXINC)/timezone.inc \
-                 unixsysc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+                 sysconst.inc $(UNIXINC)/timezone.inc \
+                 unixfunc.inc baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 linux$(PPUEXT) : baseunix$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 

+ 0 - 58
rtl/freebsd/syscalls.inc

@@ -1,58 +0,0 @@
-{
-    $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.
-
-    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.
-
- **********************************************************************}
-
-{BSD version of the syscalls required to implement SysLinux.}
-
-{No debugging for syslinux include !}
-{$IFDEF SYS_LINUX}
-  {$UNDEF SYSCALL_DEBUG}
-{$ENDIF SYS_LINUX}
-
-{*****************************************************************************
-                     --- Main:The System Call Self ---
-*****************************************************************************}
-
-{
-Function fpmmap(adr:pointer;len:TSize;prot:cint;flags:cint;fdes:cint;off:TOff):cint;  // moved from sysunix.inc, used in sbrk
-begin
- {$ifdef LITTLE_ENDIAN}
-  fpmmap:=do_syscall(syscall_nr_mmap,Adr,Len,Prot,Flags,fdes,lo(off),0);
- {$else}
-  fpmmap:=do_syscall(syscall_nr_mmap,TSysParam(Adr),TSysParam(Len),Prot,Flags,fdes,0,lo(off));
- {$endif}
-end;
-}
-
-{
-  $Log$
-  Revision 1.13  2003-09-16 12:58:35  marco
-   * fixje voor mmap parameter typering veranderingen
-
-  Revision 1.12  2003/09/14 20:15:01  marco
-   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
-
-  Revision 1.11  2003/06/01 16:35:28  marco
-   * Several small fixes to harmonize the *BSD rtls and Linux.
-
-  Revision 1.10  2003/01/05 19:02:29  marco
-   * Should now work with baseunx. (gmake all works)
-
-  Revision 1.9  2002/09/07 16:01:17  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.8  2002/05/06 07:27:39  marco
-   * Fixed a readdir bug, already fixed in januari in 1.0.x
-
-}

+ 130 - 0
rtl/freebsd/unixfunc.inc

@@ -0,0 +1,130 @@
+{
+   $Id$
+   This file is part of the Free Pascal run time library.
+   Copyright (c) 2000 by Marco van de Voort
+     member of the Free Pascal development team.
+
+   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.
+
+**********************************************************************}
+
+{$ifndef HAS_LIBC_PIPING}
+Function PClose(Var F:file) : cint;
+var
+  pl : ^cint;
+  res : cint;
+
+begin
+  fpclose(filerec(F).Handle);
+{ closed our side, Now wait for the other - this appears to be needed ?? }
+  pl:=@(filerec(f).userdata[2]);
+  fpwaitpid(pl^,@res,0);
+  pclose:=res shr 8;
+end;
+
+Function PClose(Var F:text) :cint;
+var
+  pl  : ^longint;
+  res : longint;
+
+begin
+  fpclose(Textrec(F).Handle);
+{ closed our side, Now wait for the other - this appears to be needed ?? }
+  pl:=@(textrec(f).userdata[2]);
+  fpwaitpid(pl^,@res,0);
+  pclose:=res shr 8;
+end;
+{$ENDIF}
+
+
+Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
+{
+  Sets up a pair of file variables, which act as a pipe. The first one can
+  be read from, the second one can be written to.
+  If the operation was unsuccesful, linuxerror is set.
+}
+var
+  ret  : longint;
+  errn : cint;
+  {$ifdef FPC_USE_LIBC}
+   fdis : array[0..1] of cint;
+  {$endif}
+begin
+{$ifndef FPC_USE_LIBC}
+ ret:=intAssignPipe(pipe_in,pipe_out,errn);
+ if ret=-1 Then
+  fpseterrno(errn);
+{$ELSE}
+ fdis[0]:=pipe_in;
+ fdis[1]:=pipe_out;
+ ret:=pipe(fdis);
+ pipe_in:=fdis[0];
+ pipe_out:=fdis[1];
+{$ENDIF}
+ AssignPipe:=ret;
+end;
+
+{
+  $Log$
+  Revision 1.1  2005-02-13 20:01:37  peter
+    * include file cleanup
+
+  Revision 1.20  2004/04/23 19:16:24  marco
+   * flock -> fpflock because of conflicting structure name
+
+  Revision 1.19  2004/03/04 22:15:16  marco
+   * UnixType changes. Please report problems to me.
+
+  Revision 1.18  2004/01/01 17:07:21  marco
+   * few small freebsd fixes backported from debugging linux
+
+  Revision 1.17  2003/12/30 12:32:30  marco
+  *** empty log message ***
+
+  Revision 1.16  2003/11/19 17:11:40  marco
+   * termio unit
+
+  Revision 1.15  2003/11/19 10:12:02  marco
+   * more cleanups
+
+  Revision 1.14  2003/11/17 10:05:51  marco
+   * threads for FreeBSD. Not working tho
+
+  Revision 1.13  2003/11/14 16:21:59  marco
+   * linuxerror elimination
+
+  Revision 1.12  2003/11/09 12:00:16  marco
+   * pipe fix
+
+  Revision 1.11  2003/09/20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.10  2003/09/15 20:08:49  marco
+   * small fixes. FreeBSD now cycles
+
+  Revision 1.9  2003/09/15 07:09:58  marco
+   * small fixes, round 1
+
+  Revision 1.8  2003/09/14 20:15:01  marco
+   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
+
+  Revision 1.7  2003/01/05 19:02:29  marco
+   * Should now work with baseunx. (gmake all works)
+
+  Revision 1.6  2002/10/18 12:19:59  marco
+   * Fixes to get the generic *BSD RTL compiling again + fixes for thread
+     support. Still problems left in fexpand. (inoutres?) Therefore fixed
+     sysposix not yet commited
+
+  Revision 1.5  2002/09/07 16:01:18  peter
+    * old logs removed and tabs fixed
+
+  Revision 1.4  2002/05/06 09:35:09  marco
+   * Some stuff from 1.0.x ported
+
+}

+ 0 - 334
rtl/freebsd/unixsysc.inc

@@ -1,334 +0,0 @@
-{
-   $Id$
-   This file is part of the Free Pascal run time library.
-   Copyright (c) 2000 by Marco van de Voort
-     member of the Free Pascal development team.
-
-   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 clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
-{NOT IMPLEMENTED YET UNDER BSD}
-begin // perhaps it is better to implement the hack from solaris then this msg
- HALT;
-END;
-
-  if (pointer(func)=nil) or (sp=nil) then
-   begin
-     Lfpseterrno(EsysEInval);
-     exit(-1);
-   end;
-  asm
-        { Insert the argument onto the new stack. }
-        movl    sp,%ecx
-        subl    $8,%ecx
-        movl    args,%eax
-        movl    %eax,4(%ecx)
-
-        { Save the function pointer as the zeroth argument.
-          It will be popped off in the child in the ebx frobbing below. }
-        movl    func,%eax
-        movl    %eax,0(%ecx)
-
-        { Do the system call }
-        pushl   %ebx
-        pushl   %ebx
-      //  movl    flags,%ebx
-        movl    $251,%eax
-        int     $0x80
-        popl    %ebx
-        popl    %ebx
-        test    %eax,%eax
-        jnz     .Lclone_end
-
-        { We're in the new thread }
-        subl    %ebp,%ebp       { terminate the stack frame }
-        call    *%ebx
-        { exit process }
-        movl    %eax,%ebx
-        movl    $1,%eax
-        int     $0x80
-
-.Lclone_end:
-        movl    %eax,__RESULT
-  end;
-end;
-}
-
-{$ifndef FPC_USE_LIBC}
-Function  fsync (fd : cint) : cint;
-
-begin
-  fsync:=do_syscall(syscall_nr_fsync,fd);
-end;
-
-Function  fpFlock (fd,mode : longint) : cint;
-
-begin
- fpFlock:=do_syscall(syscall_nr_flock,fd,mode);
-end;
-
-Function fStatFS(Fd:Longint;Var Info:tstatfs):cint;
-{
-  Get all information on a fileSystem, and return it in Info.
-  Fd is the file descriptor of a file/directory on the fileSystem
-  you wish to investigate.
-}
-
-begin
- fStatFS:=do_syscall(syscall_nr_fstatfs,fd,longint(@info));
-end;
-
-Function StatFS(path:pchar;Var Info:tstatfs):cint;
-{
-  Get all information on a fileSystem, and return it in Info.
-  Fd is the file descriptor of a file/directory on the fileSystem
-  you wish to investigate.
-}
-
-begin
- StatFS:=do_syscall(syscall_nr_statfs,longint(path),longint(@info));
-end;
-
-// needs oldfpccall;
-Function intAssignPipe(var pipe_in,pipe_out:longint;var errn:cint):cint; {$ifndef ver1_0} oldfpccall;{$endif} 
-{
-  Sets up a pair of file variables, which act as a pipe. The first one can
-  be read from, the second one can be written to.
-  If the operation was unsuccesful, linuxerror is set.
-}
-
-begin
- asm
-   mov $42,%eax
-   int $0x80
-   jb .Lerror
-   mov pipe_in,%ebx
-   mov %eax,(%ebx)
-   mov pipe_out,%ebx
-   mov $0,%eax
-   mov %edx,(%ebx)
-   mov %eax,%ebx
-   jmp .Lexit
-.Lerror:
-   mov %eax,%ebx
-   mov $-1,%eax
-.Lexit:
-   mov Errn,%edx
-   mov %ebx,(%edx)
- end;
-end;
-
-
-Function PClose(Var F:text) :cint;
-var
-  pl  : ^longint;
-  res : longint;
-
-begin
-  do_syscall(syscall_nr_close,Textrec(F).Handle);
-{ closed our side, Now wait for the other - this appears to be needed ?? }
-  pl:=@(textrec(f).userdata[2]);
-  fpwaitpid(pl^,@res,0);
-  pclose:=res shr 8;
-end;
-
-Function PClose(Var F:file) : cint;
-var
-  pl : ^cint;
-  res : cint;
-
-begin
-  do_syscall(syscall_nr_close,filerec(F).Handle);
-{ closed our side, Now wait for the other - this appears to be needed ?? }
-  pl:=@(filerec(f).userdata[2]);
-  fpwaitpid(pl^,@res,0);
-  pclose:=res shr 8;
-end;
-
-function MUnMap (P : Pointer; Size : size_t) : cint;
-
-begin
-  MUnMap:=do_syscall(syscall_nr_munmap,longint(P),Size);
-end;
-{$else}
-
-{$ifndef HAS_LIBC_PIPING}
-Function PClose(Var F:file) : cint;
-var
-  pl : ^cint;
-  res : cint;
-
-begin
-
-  fpclose(filerec(F).Handle);
-{ closed our side, Now wait for the other - this appears to be needed ?? }
-  pl:=@(filerec(f).userdata[2]);
-  fpwaitpid(pl^,@res,0);
-  pclose:=res shr 8;
-end;
-
-Function PClose(Var F:text) :cint;
-var
-  pl  : ^longint;
-  res : longint;
-
-begin
-  fpclose(Textrec(F).Handle);
-{ closed our side, Now wait for the other - this appears to be needed ?? }
-  pl:=@(textrec(f).userdata[2]);
-  fpwaitpid(pl^,@res,0);
-  pclose:=res shr 8;
-end;
-{$ENDIF}
-
-{$endif}
-// can't have oldfpccall here, linux doesn't need it.
-Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
-{
-  Sets up a pair of file variables, which act as a pipe. The first one can
-  be read from, the second one can be written to.
-  If the operation was unsuccesful, linuxerror is set.
-}
-var
-  ret  : longint;
-  errn : cint;
-  {$ifdef FPC_USE_LIBC}
-   fdis : array[0..1] of cint;
-  {$endif}
-begin
-{$ifndef FPC_USE_LIBC}
- ret:=intAssignPipe(pipe_in,pipe_out,errn);
- if ret=-1 Then
-  fpseterrno(errn);
-{$ELSE}
- fdis[0]:=pipe_in;
- fdis[1]:=pipe_out;
- ret:=pipe(fdis);
- pipe_in:=fdis[0];
- pipe_out:=fdis[1];
-{$ENDIF}
- AssignPipe:=ret;
-end;
-
-
-{
-function  intClone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; {$ifndef ver1_0} oldfpccall; {$endif}
- 
-
-var lerrno : Longint;
-    errset : Boolean;
-    Res    : Longint;	
-begin
-  errset:=false;
-  Res:=0;
-asm
-        pushl   %esi
-        movl    12(%ebp), %esi  // get stack addr
-        subl    $4, %esi
-        movl    20(%ebp), %eax  // get __arg
-        movl    %eax, (%esi)
-        subl    $4, %esi
-        movl    8(%ebp), %eax   // get __fn
-        movl    %eax, (%esi)
-        pushl   16(%ebp)
-        pushl   %esi
-        mov     syscall_nr_rfork, %eax
-        int     $0x80                  // call actualsyscall
-        jb      .L2
-        test    %edx, %edx
-        jz      .L1
-        movl    %esi,%esp
-        popl    %eax
-        call    %eax
-        addl    $8, %esp
-        call    halt            // Does not return
-.L2:
-        mov     %eax,LErrNo
-        mov     $true,Errset
-	mov	$-1,%eax
-//        jmp     .L1
-.L1:
-        addl    $8, %esp
-        popl    %esi
-	mov	%eax,Res
-end;
-  If ErrSet Then
-   fpSetErrno(LErrno);
-  intClone:=Res; 
-end;
-
-
-
-function  Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; 
-
-begin
-  Clone:=
-	intclone(tclonefunc(func),sp,flags,args);
-end;
-}
-
-
-{
-  $Log$
-  Revision 1.20  2004-04-23 19:16:24  marco
-   * flock -> fpflock because of conflicting structure name
-
-  Revision 1.19  2004/03/04 22:15:16  marco
-   * UnixType changes. Please report problems to me.
-
-  Revision 1.18  2004/01/01 17:07:21  marco
-   * few small freebsd fixes backported from debugging linux
-
-  Revision 1.17  2003/12/30 12:32:30  marco
-  *** empty log message ***
-
-  Revision 1.16  2003/11/19 17:11:40  marco
-   * termio unit
-
-  Revision 1.15  2003/11/19 10:12:02  marco
-   * more cleanups
-
-  Revision 1.14  2003/11/17 10:05:51  marco
-   * threads for FreeBSD. Not working tho
-
-  Revision 1.13  2003/11/14 16:21:59  marco
-   * linuxerror elimination
-
-  Revision 1.12  2003/11/09 12:00:16  marco
-   * pipe fix
-
-  Revision 1.11  2003/09/20 12:38:29  marco
-   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
-
-  Revision 1.10  2003/09/15 20:08:49  marco
-   * small fixes. FreeBSD now cycles
-
-  Revision 1.9  2003/09/15 07:09:58  marco
-   * small fixes, round 1
-
-  Revision 1.8  2003/09/14 20:15:01  marco
-   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
-
-  Revision 1.7  2003/01/05 19:02:29  marco
-   * Should now work with baseunx. (gmake all works)
-
-  Revision 1.6  2002/10/18 12:19:59  marco
-   * Fixes to get the generic *BSD RTL compiling again + fixes for thread
-     support. Still problems left in fexpand. (inoutres?) Therefore fixed
-     sysposix not yet commited
-
-  Revision 1.5  2002/09/07 16:01:18  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.4  2002/05/06 09:35:09  marco
-   * Some stuff from 1.0.x ported
-
-}

+ 155 - 0
rtl/freebsd/unxsysc.inc

@@ -0,0 +1,155 @@
+{
+   $Id$
+   This file is part of the Free Pascal run time library.
+   Copyright (c) 2003 Marco van de Voort
+   member of the Free Pascal development team.
+
+   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 clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
+{NOT IMPLEMENTED YET UNDER BSD}
+begin // perhaps it is better to implement the hack from solaris then this msg
+ HALT;
+END;
+
+  if (pointer(func)=nil) or (sp=nil) then
+   begin
+     Lfpseterrno(EsysEInval);
+     exit(-1);
+   end;
+  asm
+        { Insert the argument onto the new stack. }
+        movl    sp,%ecx
+        subl    $8,%ecx
+        movl    args,%eax
+        movl    %eax,4(%ecx)
+
+        { Save the function pointer as the zeroth argument.
+          It will be popped off in the child in the ebx frobbing below. }
+        movl    func,%eax
+        movl    %eax,0(%ecx)
+
+        { Do the system call }
+        pushl   %ebx
+        pushl   %ebx
+      //  movl    flags,%ebx
+        movl    $251,%eax
+        int     $0x80
+        popl    %ebx
+        popl    %ebx
+        test    %eax,%eax
+        jnz     .Lclone_end
+
+        { We're in the new thread }
+        subl    %ebp,%ebp       { terminate the stack frame }
+        call    *%ebx
+        { exit process }
+        movl    %eax,%ebx
+        movl    $1,%eax
+        int     $0x80
+
+.Lclone_end:
+        movl    %eax,__RESULT
+  end;
+end;
+*)
+
+Function  fsync (fd : cint) : cint;
+
+begin
+  fsync:=do_syscall(syscall_nr_fsync,fd);
+end;
+
+Function  fpFlock (fd,mode : longint) : cint;
+
+begin
+ fpFlock:=do_syscall(syscall_nr_flock,fd,mode);
+end;
+
+Function fStatFS(Fd:Longint;Var Info:tstatfs):cint;
+{
+  Get all information on a fileSystem, and return it in Info.
+  Fd is the file descriptor of a file/directory on the fileSystem
+  you wish to investigate.
+}
+
+begin
+ fStatFS:=do_syscall(syscall_nr_fstatfs,fd,longint(@info));
+end;
+
+Function StatFS(path:pchar;Var Info:tstatfs):cint;
+{
+  Get all information on a fileSystem, and return it in Info.
+  Fd is the file descriptor of a file/directory on the fileSystem
+  you wish to investigate.
+}
+
+begin
+ StatFS:=do_syscall(syscall_nr_statfs,longint(path),longint(@info));
+end;
+
+// needs oldfpccall;
+Function intAssignPipe(var pipe_in,pipe_out:longint;var errn:cint):cint; {$ifndef ver1_0} oldfpccall;{$endif} 
+{
+  Sets up a pair of file variables, which act as a pipe. The first one can
+  be read from, the second one can be written to.
+  If the operation was unsuccesful, linuxerror is set.
+}
+
+begin
+ asm
+   mov $42,%eax
+   int $0x80
+   jb .Lerror
+   mov pipe_in,%ebx
+   mov %eax,(%ebx)
+   mov pipe_out,%ebx
+   mov $0,%eax
+   mov %edx,(%ebx)
+   mov %eax,%ebx
+   jmp .Lexit
+.Lerror:
+   mov %eax,%ebx
+   mov $-1,%eax
+.Lexit:
+   mov Errn,%edx
+   mov %ebx,(%edx)
+ end;
+end;
+
+
+function MUnMap (P : Pointer; Size : size_t) : cint;
+begin
+  MUnMap:=do_syscall(syscall_nr_munmap,longint(P),Size);
+end;
+
+{
+   $Log$
+   Revision 1.1  2005-02-13 20:01:37  peter
+     * include file cleanup
+
+   Revision 1.8  2004/11/14 12:21:08  marco
+    * moved some calls from unix to baseunix. Darwin untested.
+
+   Revision 1.7  2004/11/03 15:00:43  marco
+    * Pathstr eliminated
+
+   Revision 1.6  2004/07/03 22:48:49  marco
+    * small fix for 1.0.x cycling
+
+   Revision 1.5  2004/04/22 16:22:10  marco
+    * fpnice fixes
+
+   Revision 1.4  2004/01/01 17:07:21  marco
+    * few small freebsd fixes backported from debugging linux
+
+
+}

+ 10 - 2
rtl/i386/setjump.inc

@@ -19,7 +19,12 @@ const
   JMPSIG_BLOCK   = 0;
   JMPSIG_SETMASK = 2;
 
-function JmpSigProcMask(how:longint;nset : pjmpsigset;oset : pjmpsigset):longint; external name 'FPC_SYSC_SIGPROCMASK';
+
+{$ifdef FPC_USE_LIBC}
+  function JmpSigProcMask(how:longint;nset : pjmpsigset;oset : pjmpsigset):longint; external name 'sigprocmask';
+{$else}
+  function JmpSigProcMask(how:longint;nset : pjmpsigset;oset : pjmpsigset):longint; external name 'FPC_SYSC_SIGPROCMASK';
+{$endif}
 
 procedure savesigmask(var s:jmp_buf);
 begin
@@ -87,7 +92,10 @@ end;
 
 {
   $Log$
-  Revision 1.6  2005-01-20 16:38:28  peter
+  Revision 1.7  2005-02-13 20:01:37  peter
+    * include file cleanup
+
+  Revision 1.6  2005/01/20 16:38:28  peter
     * restore sigprocmask for linux
 
   Revision 1.5  2003/12/04 21:42:07  peter

+ 23 - 23
rtl/linux/Makefile

@@ -1,10 +1,10 @@
 #
-# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/01/31]
+# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/02/09]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-sunos i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-sunos x86_64-linux x86_64-freebsd arm-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd arm-linux
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) sunos qnx
+UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
 FORCE:
 .PHONY: FORCE
@@ -286,7 +286,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer ggigraph sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconst dos objects
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer ggigraph sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconst dos objects
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -352,7 +352,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer ggigraph sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconst dos objects
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) unixtype ctypes baseunix strings objpas macpas syscall unixutil heaptrc lineinfo $(LINUXUNIT1) termio unix $(LINUXUNIT2) initc cmem $(CPU_UNITS) crt  printer ggigraph sysutils typinfo math matrix varutils charset ucomplex getopts errors sockets gpm ipc serial terminfo dl dynlibs video mouse keyboard variants types dateutils sysconst cthreads classes strutils rtlconst dos objects
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -385,7 +385,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -451,7 +451,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_LOADERS+=prt0 dllprt0 cprt0 gprt0 $(CRT21)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -484,7 +484,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_RSTS+=math varutils typinfo variants sysconst rtlconst
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_RSTS+=math varutils typinfo variants sysconst rtlconst
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -550,7 +550,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_RSTS+=math varutils typinfo variants sysconst rtlconst
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_RSTS+=math varutils typinfo variants sysconst rtlconst
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -583,7 +583,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override CLEAN_UNITS+=syslinux linux
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override CLEAN_UNITS+=syslinux linux
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -649,7 +649,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override CLEAN_UNITS+=syslinux linux
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override CLEAN_UNITS+=syslinux linux
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -683,7 +683,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -749,7 +749,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -782,7 +782,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -848,7 +848,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(CPU_TARGET)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -881,7 +881,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_TARGETDIR+=.
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -947,7 +947,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_TARGETDIR+=.
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -1243,7 +1243,7 @@ BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=sun
@@ -1369,7 +1369,7 @@ STATICLIBEXT=.a
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 PPUEXT=.ppu
 ASMEXT=.s
@@ -2191,12 +2191,12 @@ 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 \
-		 sysc11.inc sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
-		 unixsysc.inc
+		 sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
+		 unixfunc.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 bunxmain.inc ostypes.inc \
-  bunxfunc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \
+  signal.inc $(UNIXINC)/bunxh.inc ostypes.inc \
+  bunxsysc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \
   ostypes.inc ossysch.inc bunxmacr.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 ports$(PPUEXT) : ports.pp unix$(PPUEXT) objpas$(PPUEXT)

+ 4 - 4
rtl/linux/Makefile.fpc

@@ -158,14 +158,14 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 #
 
 unix$(PPUEXT) : unix.pp strings$(PPUEXT) baseunix$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-                 sysc11.inc sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
-                 unixsysc.inc
+                 sysconst.inc $(UNIXINC)/timezone.inc $(SYSTEMUNIT)$(PPUEXT) \
+                 unixfunc.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 bunxmain.inc ostypes.inc \
-  bunxfunc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \
+  signal.inc $(UNIXINC)/bunxh.inc ostypes.inc \
+  bunxsysc.inc $(CPU_TARGET)/syscallh.inc $(CPU_TARGET)/sysnr.inc \
   ostypes.inc ossysch.inc bunxmacr.inc $(UNIXINC)/gensigset.inc \
   $(UNIXINC)/genfuncs.inc $(SYSTEMUNIT)$(PPUEXT)
 

+ 0 - 132
rtl/linux/baseunix.pp

@@ -1,132 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Carl Eric Codere development team
-
-    Base Unix unit modelled after POSIX 2001.
-
-    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.
-
- **********************************************************************}
-Unit BaseUnix;
-
-Interface
-
-Uses UnixType;
-
-{$i aliasptp.inc}
-{$i ostypes.inc}
-
-{$define oldreaddir}		// Keep using readdir system call instead
-				// 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)
-
-{$ifndef FPC_USE_LIBC}   
-{$define FPC_USE_SYSCALL}
-{$endif}
-
-{$i errno.inc}		{ Error numbers }
-{$i bunxtype.inc}	{ Types }
-{$ifdef FPC_USE_LIBC}
-const clib = 'c';
-{$i oscdeclh.inc}
-{$ELSE}
-{$i bunxh.inc}          { Functions}
-{$ENDIF}
-
-{$i bunxovlh.inc}
-
-{$ifndef VER1_0}
-function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
-procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
-{$else}
-function fpgeterrno:longint;
-procedure fpseterrno(err:longint);
-{$endif}
-{$ifdef HASGLOBALPROPERTY}
-property errno : cint read fpgeterrno write fpseterrno;
-{$endif}
-
-{$ifdef FPC_USE_LIBC}
-function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
-{$else}
-function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
-{$endif}
-
-implementation
-
-{$i bunxmain.inc}	{ implementation}
-{$i bunxovl.inc}	{ redefs and overloads implementation}
-{$i settimeo.inc}
-
-{$ifdef ver1_0}
-// MvdV 1.0 is buggy in calling externals it seems. dunno what exactly
-function intfpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
-procedure intfpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
-
-function fpgeterrno:longint; 
-
-begin
-  fpgeterrno:=intfpgeterrno;
-end;
-
-procedure fpseterrno(err:longint); 
-begin
-   intfpseterrno(err);
-end;
-{$else}
-
-{$endif}
-end.
-
-{
-  $Log$
-  Revision 1.12  2004-12-02 18:24:35  marco
-   * fpsettimeofday.
-
-  Revision 1.11  2004/11/19 13:15:14  marco
-   * external rework. Mostly done.
-
-  Revision 1.10  2004/11/14 12:21:08  marco
-   * moved some calls from unix to baseunix. Darwin untested.
-
-  Revision 1.9  2004/03/04 22:15:16  marco
-   * UnixType changes. Please report problems to me.
-
-  Revision 1.8  2004/01/04 21:04:08  jonas
-    * declare C-library routines as external in libc for Darwin (so we
-      generate proper import entries)
-
-  Revision 1.7  2003/12/31 20:01:00  marco
-   * workaround for buggy 1.0 building
-
-  Revision 1.6  2003/12/30 12:36:56  marco
-   * FPC_USE_LIBC
-
-  Revision 1.5  2003/12/11 18:20:50  florian
-    * replaced VER1_0 by HASGLOBALPROPERTY
-
-  Revision 1.4  2003/12/10 17:14:06  marco
-   * property support under ifndef ver1_0
-
-  Revision 1.3  2003/12/10 17:08:28  marco
-   * property errno defined
-
-  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:44:09  marco
-   * more new RTL
-
-  Revision 1.2  2002/11/14 12:17:28  marco
-   * for now.
-
-}

+ 36 - 0
rtl/linux/bunxdefs.inc

@@ -0,0 +1,36 @@
+{
+    $Id$
+    Copyright (c) 2000-2002 by Marco van de Voort
+
+    Target dependent defines used when compileing the baseunix unit
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.
+
+ ****************************************************************************}
+
+{$define usestime} 		// Use stime() syscall instead of settimeofday
+{$define oldreaddir}		// Keep using readdir system call instead
+				// 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)
+
+{
+  $Log$
+  Revision 1.1  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+}

+ 8 - 5
rtl/linux/bunxmacr.inc

@@ -61,9 +61,9 @@ 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 $7f) =0);
+ wifexited:=(status AND $7f) =0;
 end;
 
 function wexitstatus(status : cint): cint;
@@ -78,9 +78,9 @@ end;
 
 const wstopped=127;
 
-function wifsignaled(status : cint): cint;
+function wifsignaled(status : cint): boolean;
 begin
- wifsignaled:=cint(((status and $FF)<>wstopped) and ((status and 127)<>0));
+ wifsignaled:=((status and $FF)<>wstopped) and ((status and 127)<>0);
 end;
 
 function wtermsig(status : cint):cint;
@@ -91,7 +91,10 @@ end;
 
 {
   $Log$
-  Revision 1.3  2003-09-27 12:51:33  peter
+  Revision 1.4  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.3  2003/09/27 12:51:33  peter
     * fpISxxx macros renamed to C compliant fpS_ISxxx
 
   Revision 1.2  2003/09/17 11:24:46  marco

+ 0 - 52
rtl/linux/bunxmain.inc

@@ -1,52 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2002 by Marco van de Voort.
-
-    Implementation of the baseunix unit for *BSD^H^H^Hlinux. In practice only
-    includes other files, or specifies libc bindings.
-
-    The conditional uselibc can be used to switch from libc to syscall
-    usage for basic primitives, but it is best to use unit POSIX if
-    possible. Note that the system unit must also be compiled using uselibc.
-
-    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.
-
- ****************************************************************************
-}
-
-{ $I ostypes.inc}
-
-{$ifdef FPC_USE_LIBC}
-// {$I oscdeclh.inc}
- {$linklib c}
-{$else}
- {$I sysdeclh.inc}
-{$endif}
-
-{$I bunxfunc.inc}
-{$I genfuncs.inc}
-
-{
- $Log$
- Revision 1.4  2003-12-30 15:43:20  marco
-  * linux now compiles with FPC_USE_LIBC
-
- Revision 1.3  2003/06/01 16:28:56  marco
-  * small rearrangements
-
- Revision 1.2  2003/01/02 22:39:19  marco
-  * posmacro.inc was still include while it was already moved to bunxmacr.inc
-    fixed, will remove posmacro.inc shortly
-
- 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
-
-}

+ 4 - 36
rtl/linux/bunxfunc.inc → rtl/linux/bunxsysc.inc

@@ -16,21 +16,6 @@
 
  **********************************************************************}
 
-{i ostypes.inc}
-
-{$ifndef FPC_USE_LIBC}
-{$i syscallh.inc}       // do_syscall declarations themselves
-{$i sysnr.inc}          // syscall numbers.
-{$i ossysch.inc}        // external interface to syscalls in system unit.
-{$endif}
-//{$i genfuncs.inc}
-
-{$i bunxmacr.inc}       // macros.
-
-{$I gensigset.inc}     // general sigset funcs implementation.
-{$I genfdset.inc}
-
-{$ifndef FPC_USE_LIBC}
 Function fpKill(Pid:pid_t;Sig:cint):cint;
 {
   Send signal 'sig' to a process, or a group of processes.
@@ -47,24 +32,6 @@ begin
 //  Kill:=0;
 end;
 
-{overload}
-//Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROGMASK';
-
-Function fpSigProcMask(how:cint;nset : pSigSet; oset : pSigSet):cint; [public, alias : 'FPC_SYSC_SIGPROGMASK'];
-{
-  Change the list of currently blocked signals.
-  How determines which signals will be blocked :
-   SigBlock   : Add SSet to the current list of blocked signals
-   SigUnBlock : Remove the signals in SSet from the list of blocked signals.
-   SigSetMask : Set the list of blocked signals to SSet
-  if OldSSet is non-null, the old set will be saved there.
-}
-
-begin
-  fpsigprocmask:=do_syscall(syscall_nr_rt_sigprocmask,TSysParam(how),TSysParam(nset),TSysParam(oset));
-end;
-
-
 Function fpSigPending(var nset: TSigSet):cint;
 {
   Allows examination of pending signals. The signal mask of pending
@@ -561,11 +528,12 @@ begin
 end;
 
 
-{$endif}
-
 {
  $Log$
- Revision 1.15  2005-01-30 18:01:15  peter
+ Revision 1.1  2005-02-13 20:01:38  peter
+   * include file cleanup
+
+ Revision 1.15  2005/01/30 18:01:15  peter
    * signal cleanup for linux
    * sigactionhandler instead of tsigaction for bsds
    * sigcontext moved to cpu dir

+ 9 - 11
rtl/linux/ossysc.inc

@@ -19,13 +19,13 @@
 {$I ostypes.inc}
 
 {$ifdef FPC_USE_LIBC}
+
   {$Linklib c}
-  // Out of date atm.
 
-{$ifdef FPC_IS_SYSTEM}
-{$i oscdeclh.inc}
-{$endif}
-{$I bunxmacr.inc}
+  {$ifdef FPC_IS_SYSTEM}
+    {$i oscdeclh.inc}
+  {$endif}
+  {$I bunxmacr.inc}
 
 {$else}
 
@@ -398,11 +398,6 @@ type
 {$define OLDMMAP}
 {$endif cpuarm}
 
-const
-  { Constansts for MMAP }
-  MAP_PRIVATE   =2;
-  MAP_ANONYMOUS =$20;
-
 
 Function Fpmmap(adr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;off:off_t):pointer;  [public, alias : 'FPC_SYSC_MMAP'];
 // OFF_T procedure, and returns a pointer, NOT cint.
@@ -525,7 +520,10 @@ end;
 
 {
  $Log$
- Revision 1.33  2005-02-06 12:16:52  peter
+ Revision 1.34  2005-02-13 20:01:38  peter
+   * include file cleanup
+
+ Revision 1.33  2005/02/06 12:16:52  peter
    * bsd thread updates
 
  Revision 1.32  2005/01/31 20:13:24  peter

+ 10 - 1
rtl/linux/ostypes.inc

@@ -45,9 +45,18 @@ Const   // generated by statmacr.c
   S_IFLNK = 40960; { symbolic link }
   S_IFSOCK= 49152; { socket }
 
+const
+  { Constansts for MMAP }
+  MAP_PRIVATE   =2;
+  MAP_ANONYMOUS =$20;
+
+
 {
  $Log$
- Revision 1.9  2004-12-02 11:23:06  marco
+ Revision 1.10  2005-02-13 20:01:38  peter
+   * include file cleanup
+
+ Revision 1.9  2004/12/02 11:23:06  marco
   * tz_ added to ttimezoen fields
 
  Revision 1.8  2004/02/06 23:06:16  florian

+ 0 - 100
rtl/linux/sysc11.inc

@@ -1,100 +0,0 @@
-{
-    $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.
-
-    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.
-
- **********************************************************************}
-
-{ Include syscall itself }
-{i syscallo.inc}
-Function Sys_mmap(adr:pointer;len:size_t;prot,flags,fdes:cint;off:off_t):cint; // moved from sysunix.inc, used in sbrk
-
-begin
-  fpmmap(adr,len,prot,flags,fdes,off);
-end;
-
-Function Sys_munmap(adr:pointer;len:cint):cint; // moved from sysunix.inc, used in sbrk
-begin
-  fpmunmap(adr,len);
-end;
-
-{
-  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.
-}
-Function Sys_IOCtl(Handle,Ndx: cint;Data: Pointer):cint;  // This was missing here, instead hardcode in Do_IsDevice
-begin
-  sys_ioctl:=fpioctl(handle,ndx,data);
-end;
-
-
-{
-  $Log$
-  Revision 1.4  2004-04-28 20:48:20  peter
-    * ordinal-pointer conversions fixed
-
-  Revision 1.3  2003/11/17 11:28:08  marco
-   * Clone moved to linux, + few small unit unix changes
-
-  Revision 1.2  2003/10/31 08:55:11  mazen
-  + assembler mode forced to ATT style for x86 cpu
-
-  Revision 1.1  2003/10/30 16:42:25  marco
-   * Killing off old syscall convention anywhere except for oldlinux
-
-  Revision 1.19  2003/10/17 20:56:24  olle
-    * Changed m68k to cpum68k, i386 to cpui386
-
-  Revision 1.18  2003/09/14 20:15:01  marco
-   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
-
-  Revision 1.17  2002/12/18 16:43:26  marco
-   * new unix rtl, linux part.....
-
-  Revision 1.16  2002/11/11 21:40:26  marco
-   * rename syscall.inc -> syscallo.inc
-
-  Revision 1.15  2002/10/14 19:39:17  peter
-    * threads unit added for thread support
-
-  Revision 1.14  2002/09/10 21:32:14  jonas
-    + added "nop" after sc instruction, since normally in case of success,
-      sc returns to the second instruction after itself
-
-  Revision 1.13  2002/09/07 16:01:19  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.12  2002/09/07 13:14:04  florian
-    * hopefully final fix for ppc syscall BTW: The regX numbering is somehow messy
-
-  Revision 1.11  2002/09/03 21:37:54  florian
-    * hopefully final fix for ppc syscall
-
-  Revision 1.10  2002/09/02 20:42:22  florian
-    * another ppc syscall fix
-
-  Revision 1.9  2002/09/02 20:03:20  florian
-    * ppc syscall code fixed
-
-  Revision 1.8  2002/08/19 18:24:05  jonas
-    + ppc support for do_syscall
-
-  Revision 1.7  2002/07/29 21:28:17  florian
-    * several fixes to get further with linux/ppc system unit compilation
-
-  Revision 1.6  2002/07/28 20:43:48  florian
-    * several fixes for linux/powerpc
-    * several fixes to MT
-
-}

+ 4 - 5
rtl/linux/sysconst.inc

@@ -88,10 +88,6 @@ Const
   fs_proc     = $9fa0;
   fs_xia      = $012FD16D;
 
-  { Constansts for MMAP }
-  MAP_PRIVATE   =2;
-  MAP_ANONYMOUS =$20;
-
   {Constansts Termios/Ioctl (used in Do_IsDevice) }
   {$ifdef PowerPC}
   IOCtl_TCGETS=$402c7413;
@@ -100,7 +96,10 @@ Const
   {$endif}
 {
   $Log$
-  Revision 1.11  2004-11-14 12:21:08  marco
+  Revision 1.12  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.11  2004/11/14 12:21:08  marco
    * moved some calls from unix to baseunix. Darwin untested.
 
   Revision 1.10  2004/02/21 16:27:29  marco

+ 5 - 14
rtl/linux/sysos.inc

@@ -61,26 +61,17 @@ end;
 { OS dependant parts  }
 
 {$I errno.inc}                          // error numbers
-{$I bunxtype.inc}                       // c-types, unix base types, unix
-                                        //    base structures
-
-{*****************************************************************************
-                 Extra cdecl declarations for FPC_USE_LIBC for this os
-*****************************************************************************}
-
-{$ifdef FPC_USE_LIBC}
-Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;  cdecl; external name 'readlink';
-function fpgetcwd(buf:pchar;_size:size_t):pchar; cdecl; external name 'getcwd';
-{$endif}
-
-
+{$I bunxtype.inc}                       // c-types, unix base types, unix base structures
 {$I ossysc.inc}                         // base syscalls
 {$I osmain.inc}                         // base wrappers *nix RTL (derivatives)
 
 
 {
    $Log$
-   Revision 1.3  2005-02-07 22:04:55  peter
+   Revision 1.4  2005-02-13 20:01:38  peter
+     * include file cleanup
+
+   Revision 1.3  2005/02/07 22:04:55  peter
      * moved to unix
 
    Revision 1.2  2005/02/06 13:06:20  peter

+ 4 - 59
rtl/linux/unixsysc.inc → rtl/linux/unixfunc.inc

@@ -13,64 +13,6 @@
 
 **********************************************************************}
 
-{$ifndef FPC_USE_LIBC}
-Function  fsync (fd : cint) : cint;
-begin
-  fsync := do_SysCall(syscall_nr_fsync, fd);
-end;
-
-Function  fpFlock (fd,mode : cint) : cint;
-begin
-  fpflock:=do_Syscall(Syscall_nr_flock,fd,mode);
-end;
-
-
-Function StatFS(Path:Pchar;Var Info:tstatfs):cint;
-{
-  Get all information on a fileSystem, and return it in Info.
-  Path is the name of a file/directory on the fileSystem you wish to
-  investigate.
-}
-begin
-  StatFS:=(do_SysCall(SysCall_nr_statfs,TSysParam(path),TSysParam(@Info)));
-end;
-
-Function fStatFS(Fd:cint;Var Info:tstatfs):cint;
-{
-  Get all information on a fileSystem, and return it in Info.
-  Fd is the file descriptor of a file/directory on the fileSystem
-  you wish to investigate.
-}
-begin
-  fStatFS:=(do_SysCall(SysCall_nr_fstatfs,fd,TSysParam(@info)));
-end;
-
-
-{--------------------------------
-      Port IO functions
---------------------------------}
-
-{$ifdef cpui386}
-
-Function IOperm (From,Num : cuint; Value : cint) : boolean;
-{
-  Set permissions on NUM ports starting with port FROM to VALUE
-  this works ONLY as root.
-}
-
-begin
-  IOPerm:=do_Syscall(Syscall_nr_ioperm,from,num,value)=0;
-end;
-
-Function IoPL(Level : cint) : Boolean;
-
-begin
-  IOPL:=do_Syscall(Syscall_nr_iopl,level)=0;
-end;
-
-{$endif cpui386}
-{$endif}
-
 Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
 
 {
@@ -117,7 +59,10 @@ end;
 
 {
   $Log$
-  Revision 1.27  2004-04-28 20:48:20  peter
+  Revision 1.1  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.27  2004/04/28 20:48:20  peter
     * ordinal-pointer conversions fixed
 
   Revision 1.26  2004/04/23 19:16:24  marco

+ 60 - 1
rtl/linux/unxsysc.inc

@@ -14,9 +14,68 @@
 
  ***********************************************************************}
 
+Function  fsync (fd : cint) : cint;
+begin
+  fsync := do_SysCall(syscall_nr_fsync, fd);
+end;
+
+Function  fpFlock (fd,mode : cint) : cint;
+begin
+  fpflock:=do_Syscall(Syscall_nr_flock,fd,mode);
+end;
+
+
+Function StatFS(Path:Pchar;Var Info:tstatfs):cint;
+{
+  Get all information on a fileSystem, and return it in Info.
+  Path is the name of a file/directory on the fileSystem you wish to
+  investigate.
+}
+begin
+  StatFS:=(do_SysCall(SysCall_nr_statfs,TSysParam(path),TSysParam(@Info)));
+end;
+
+Function fStatFS(Fd:cint;Var Info:tstatfs):cint;
+{
+  Get all information on a fileSystem, and return it in Info.
+  Fd is the file descriptor of a file/directory on the fileSystem
+  you wish to investigate.
+}
+begin
+  fStatFS:=(do_SysCall(SysCall_nr_fstatfs,fd,TSysParam(@info)));
+end;
+
+
+{--------------------------------
+      Port IO functions
+--------------------------------}
+
+{$ifdef cpui386}
+
+Function IOperm (From,Num : cuint; Value : cint) : boolean;
+{
+  Set permissions on NUM ports starting with port FROM to VALUE
+  this works ONLY as root.
+}
+
+begin
+  IOPerm:=do_Syscall(Syscall_nr_ioperm,from,num,value)=0;
+end;
+
+Function IoPL(Level : cint) : Boolean;
+
+begin
+  IOPL:=do_Syscall(Syscall_nr_iopl,level)=0;
+end;
+
+{$endif cpui386}
+
 {
  $Log$
- Revision 1.7  2004-11-14 12:21:08  marco
+ Revision 1.8  2005-02-13 20:01:38  peter
+   * include file cleanup
+
+ Revision 1.7  2004/11/14 12:21:08  marco
   * moved some calls from unix to baseunix. Darwin untested.
 
  Revision 1.6  2004/11/03 15:00:43  marco

+ 4 - 9
rtl/linux/unxsysch.inc

@@ -14,19 +14,14 @@
  ****************************************************************************
 }
 
-//Function Fpmmap(adr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;off:off_t):pointer; external name 'FPC_SYSC_MMAP';
-//Function Fpmunmap(adr:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
-
 function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
-//function fpNice(N:cint):cint;
-//Function fpGetPriority(Which,Who:cint):cint;
-//Function fpSetPriority(Which,Who,What:cint):cint;
-//Function fpSymlink(oldname,newname:pchar):cint;
-//Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;
 
 {
   $Log$
-  Revision 1.7  2004-11-14 12:21:08  marco
+  Revision 1.8  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.7  2004/11/14 12:21:08  marco
    * moved some calls from unix to baseunix. Darwin untested.
 
   Revision 1.6  2004/11/03 15:00:43  marco

+ 16 - 16
rtl/solaris/Makefile

@@ -1,10 +1,10 @@
 #
-# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/01/31]
+# Don't edit, this file is generated by FPCMake Version 1.9.8 [2005/02/09]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-sunos i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-sunos x86_64-linux x86_64-freebsd arm-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd arm-linux
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) sunos qnx
+UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
 FORCE:
 .PHONY: FORCE
@@ -92,7 +92,7 @@ endif
 endif
 export ECHO
 endif
-override OS_TARGET_DEFAULT=sunos
+override OS_TARGET_DEFAULT=solaris
 override DEFAULT_FPCDIR=../..
 ifndef FPC
 ifdef PP
@@ -236,7 +236,7 @@ PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuff
 RTL=..
 INC=$(RTL)/inc
 PROCINC=$(RTL)/$(CPU_TARGET)
-OSPROCINC=$(RTL)/sunos/$(CPU_TARGET)
+OSPROCINC=$(RTL)/solaris/$(CPU_TARGET)
 POSIXINC=$(RTL)/posix
 UNIXINC=$(RTL)/unix
 UNITPREFIX=rtl
@@ -271,7 +271,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) objpas
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) objpas
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -337,7 +337,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) objpas
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_UNITS+=$(SYSTEMUNIT) objpas
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -370,7 +370,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils systhrds sysconst rtlconst
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils systhrds sysconst rtlconst
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -436,7 +436,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils systhrds sysconst rtlconst
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_RSTS+=math varutils typinfo classes variants dateutils systhrds sysconst rtlconst
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -470,7 +470,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(OSPROCINC) $(POSIXINC)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(OSPROCINC) $(POSIXINC)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -536,7 +536,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(OSPROCINC) $(POSIXINC)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(OSPROCINC) $(POSIXINC)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -569,7 +569,7 @@ endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC)
 endif
-ifeq ($(FULL_TARGET),i386-sunos)
+ifeq ($(FULL_TARGET),i386-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC)
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
@@ -635,7 +635,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC)
 endif
-ifeq ($(FULL_TARGET),sparc-sunos)
+ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC)
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
@@ -931,7 +931,7 @@ BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 EXEEXT=
 SHORTSUFFIX=sun
@@ -1057,7 +1057,7 @@ STATICLIBEXT=.a
 EXEEXT=
 SHORTSUFFIX=be
 endif
-ifeq ($(OS_TARGET),sunos)
+ifeq ($(OS_TARGET),solaris)
 BATCHEXT=.sh
 PPUEXT=.ppu
 ASMEXT=.s
@@ -1830,7 +1830,7 @@ SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
 include $(PROCINC)/makefile.cpu
 SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
 SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
-$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
 	$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
 systhrds$(PPUEXT): systhrds.pp $(INC)/threadh.inc $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT)
 objpas$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)

+ 4 - 4
rtl/solaris/Makefile.fpc

@@ -1,5 +1,5 @@
 #
-#   Makefile.fpc for Free Pascal SunOS RTL
+#   Makefile.fpc for Free Pascal solaris RTL
 #
 
 [package]
@@ -29,7 +29,7 @@ fpcpackage=y
 
 [default]
 fpcdir=../..
-target=sunos
+target=solaris
 
 [compiler]
 includedir=$(INC) $(PROCINC) $(UNIXINC) $(OSPROCINC) $(POSIXINC)
@@ -50,7 +50,7 @@ libunits=$(SYSTEMUNIT) objpas strings \
 RTL=..
 INC=$(RTL)/inc
 PROCINC=$(RTL)/$(CPU_TARGET)
-OSPROCINC=$(RTL)/sunos/$(CPU_TARGET)
+OSPROCINC=$(RTL)/solaris/$(CPU_TARGET)
 POSIXINC=$(RTL)/posix
 UNIXINC=$(RTL)/unix
 UNITPREFIX=rtl
@@ -102,7 +102,7 @@ SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 # System Units (System, Objpas, Strings)
 #
 
-$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp sysconst.inc $(SYSDEPS)
+$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
         $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
 
 systhrds$(PPUEXT): systhrds.pp $(INC)/threadh.inc $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT)

+ 9 - 2
rtl/sparc/setjump.inc

@@ -24,7 +24,11 @@ const
   JMPSIG_BLOCK   = 1;
   JMPSIG_SETMASK = 4;
 
-function JmpSigProcMask(how:longint;nset : pjmpsigset;oset : pjmpsigset):longint; external name 'FPC_SYSC_SIGPROCMASK';
+{$ifdef FPC_USE_LIBC}
+  function JmpSigProcMask(how:longint;nset : pjmpsigset;oset : pjmpsigset):longint; external name 'sigprocmask';
+{$else}
+  function JmpSigProcMask(how:longint;nset : pjmpsigset;oset : pjmpsigset):longint; external name 'FPC_SYSC_SIGPROCMASK';
+{$endif}
 
 procedure savesigmask(var s:jmp_buf);
 begin
@@ -124,7 +128,10 @@ function setjmp(var S:jmp_buf):longint;assembler;nostackframe;[Public,alias:'FPC
 
 {
   $Log$
-  Revision 1.10  2005-01-20 16:38:28  peter
+  Revision 1.11  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.10  2005/01/20 16:38:28  peter
     * restore sigprocmask for linux
 
   Revision 1.9  2004/09/12 12:04:22  peter

+ 36 - 36
rtl/bsd/baseunix.pp → rtl/unix/baseunix.pp

@@ -19,83 +19,83 @@ Interface
 
 Uses UnixType;
 
+{$i bunxdefs.inc}       { Compile time defines }
+
 {$i aliasptp.inc}
 
 {$packrecords C}
-{$define oldreaddir}		// Keep using readdir system call instead
-				// 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)
 
 {$ifndef FPC_USE_LIBC}
-{$define FPC_USE_SYSCALL}
+  {$define FPC_USE_SYSCALL}
 {$endif}
 
-{$i errno.inc}		{ Error numbers }
-{$i bunxtype.inc}	{ Types }
+{$i errno.inc}          { Error numbers }
+{$i bunxtype.inc}       { Types }
 {$i ostypes.inc}
 {$ifdef FPC_USE_LIBC}
-const clib = 'c';
-{$i oscdeclh.inc}
+  const clib = 'c';
+  {$i oscdeclh.inc}
 {$ELSE}
-{$i bunxh.inc}		{ Functions}
+  {$i bunxh.inc}                { Functions}
 {$ENDIF}
 
 {$ifndef ver1_0}
-function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
-procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
+  function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
+  procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
+  property errno : cint read fpgeterrno write fpseterrno;
 {$else}
-function fpgeterrno:longint; 
-procedure fpseterrno(err:longint); 
-{$endif}
-
-{$ifndef ver1_0}
-property errno : cint read fpgeterrno write fpseterrno;
+  function fpgeterrno:longint;
+  procedure fpseterrno(err:longint);
 {$endif}
 
 {$i bunxovlh.inc}
 
-{$ifdef FPC_USE_LIBC}
-function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
-{$else}
-function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
-{$endif}
 
 implementation
 
+{$ifdef hassysctl}
 Uses Sysctl;
+{$endif}
 
-{$ifndef ver1_0}
-//function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
-//procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
-{$else}
+{$ifdef ver1_0}
 // workaround for 1.0.10 bugs.
 
 function intgeterrno:longint; external name 'FPC_SYS_GETERRNO';
 procedure intseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
 
-function fpgeterrno:longint; 
+function fpgeterrno:longint;
 begin
   fpgeterrno:=intgeterrno;
 end;
 
-procedure fpseterrno(err:longint); 
+procedure fpseterrno(err:longint);
 begin
   intseterrno(err);
 end;
 
 {$endif}
 
-{$i bunxmain.inc}	{ implementation}
-{$i bunxovl.inc}	{ redefs and overloads implementation}
-{$i settimeo.inc}
-end.
+{$i genfuncs.inc}       // generic calls. (like getenv)
+{$I gensigset.inc}     // general sigset funcs implementation.
+{$I genfdset.inc}      // general fdset funcs.
+
+{$ifndef FPC_USE_LIBC}
+  {$i syscallh.inc}       // do_syscall declarations themselves
+  {$i sysnr.inc}          // syscall numbers.
+  {$i bunxsysc.inc}       // syscalls in system unit.
+  {$i settimeo.inc}
+{$endif}
+
+{$i bunxmacr.inc}       { macro implenenations }
+{$i bunxovl.inc}        { redefs and overloads implementation }
 
+end.
 {
   $Log$
-  Revision 1.14  2004-12-02 18:24:35  marco
+  Revision 1.1  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.14  2004/12/02 18:24:35  marco
    * fpsettimeofday.
 
   Revision 1.13  2004/12/02 15:11:42  marco

+ 5 - 10
rtl/unix/bunxh.inc

@@ -21,15 +21,8 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
 
 // if you are looking for macro definitions or non C template overloaded versions, they are moved to bunxovlh.inc
 
-{$ifdef linux}
-    Function  FpSigProcMask(how : cInt; nset : pSigSet; oset : pSigSet): cInt;
-  {$ifndef VER1_0}
-    Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
-  {$endif}
-{$else}
     Function  FpSigProcMask(how : cInt; nset : pSigSet; oset : pSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
     Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
-{$endif}
     Function  FpSigPending (var nset : TSigSet): cInt;
     Function  FpSigSuspend (Const sigmask : TSigSet): cInt;
 
@@ -66,7 +59,6 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpGetcwd     (path:pChar; siz:TSize):pChar;  external name 'FPC_SYSC_GETCWD';
     Function  FpFork : TPid; external name 'FPC_SYSC_FORK';
     Function  FpExecve     (path : pChar; argv : ppChar; envp: ppChar): cInt;
-    // external name 'FPC_SYSC_EXECVE';
     Function  FpExecv      (path : pChar; argv : ppChar): cInt;
     Function  FpWaitpid    (pid : TPid; stat_loc : pcInt; options: cInt): TPid; external name 'FPC_SYSC_WAITPID';
     Function  FpWait       (var stat_loc : cInt): TPid;
@@ -107,12 +99,15 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     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  FpGetEnv     (name : pChar): pChar;
+    function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
 
 {
   $Log$
-  Revision 1.14  2004-11-21 11:28:21  peter
+  Revision 1.15  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.14  2004/11/21 11:28:21  peter
     * fixed bootstrap with 1.0.10 and 1.9.4
 
   Revision 1.13  2004/11/19 13:15:14  marco

+ 6 - 3
rtl/unix/bunxovlh.inc

@@ -84,16 +84,19 @@ Function  fpS_ISFIFO   (m : TMode): Boolean;
 Function  fpS_ISLNK       (m:TMode) : Boolean;
 Function  fpS_ISSOCK      (m:TMode) : Boolean;
 
-Function  wifexited    (Status : cInt): cInt;
+Function  wifexited    (Status : cInt): boolean;
 Function  wexitStatus  (Status : cInt): cInt;
 Function  wstopsig     (Status : cInt): cInt;
-Function  wifsignaled  (Status : cInt): cInt;
+Function  wifsignaled  (Status : cInt): boolean;
 Function  wtermsig     (Status : cInt): cInt;
 
 Function fpReadLink(Name:ansistring):ansistring;
 {
  $Log$
- Revision 1.6  2004-11-23 08:40:34  michael
+ Revision 1.7  2005-02-13 20:01:38  peter
+   * include file cleanup
+
+ Revision 1.6  2004/11/23 08:40:34  michael
  + Added overloaded functions
 
  Revision 1.5  2004/11/14 12:21:08  marco

+ 4 - 6
rtl/unix/dos.pp

@@ -65,11 +65,6 @@ Uses
 {$I dos.inc}
 
 
-{$ifndef FPC_USE_LIBC}
-{$i sysnr.inc}
-{$endif}
-{$i settimeo.inc}
-
 {******************************************************************************
                            --- Link C Lib if set ---
 ******************************************************************************}
@@ -892,7 +887,10 @@ End.
 
 {
   $Log$
-  Revision 1.43  2004-12-18 16:29:09  michael
+  Revision 1.44  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.43  2004/12/18 16:29:09  michael
   + Patch from Michalis Kamburelis so FSearch does not find a directory
 
   Revision 1.42  2004/12/05 21:04:56  hajny

+ 15 - 18
rtl/unix/oscdeclh.inc

@@ -49,17 +49,12 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FPSigaction (sig: cInt; act :pSigActionRec;oact:pSigActionRec):cint;cdecl; external clib name 'sigaction';
     Function  FpChmod      (path : pChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
     Function  FPUtime(path:pchar;times:putimbuf):cint; cdecl; external clib name 'utime';
-    Function FpGetcwd  (path:pChar; siz:TSize):pChar; cdecl;  external clib name 'getcwd';
-    {ifdef BSD}
-    function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external clib name 'sigprocmask';
-    function FPSigProcMask(how:cint;const nset : sigset;var oset : sigset):cint;cdecl; external clib name 'sigprocmask';
-    {endif}
+    Function  FpGetcwd  (path:pChar; siz:TSize):pChar; cdecl;  external clib name 'getcwd';
+    function  FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external clib name 'sigprocmask';
+    function  FPSigProcMask(how:cint;const nset : sigset;var oset : sigset):cint;cdecl; external clib name 'sigprocmask';
     function  FpStat	  (path: pchar; var buf : stat): cint; cdecl; external clib name 'stat';
-//    {$ifdef FPC_IS_SYSTEM}
     function  FpTime	   (tloc:ptime_t): time_t; cdecl; external clib name 'time';
-//    {$else}
     Function  FpTime       (var tloc : TTime): TTime; cdecl; external clib name 'time';
-//    {$endif}
     function  FpUname	(var name: utsname): cint; cdecl; external clib name 'uname';
     function  FpUnlink	(path: pchar): cint; cdecl; external clib name 'unlink';
     function  FpWaitpid	(pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external clib name 'waitpid';
@@ -87,19 +82,21 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg :cInt): cInt; cdecl; external clib name 'fcntl';
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt; cdecl external clib name 'fcntl';
     Function  FPnanosleep  (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
-
-    Function fpLstat       (path:pchar;Info:pstat):cint;     cdecl; external clib name 'lstat';
-//    function fpMUnMap 	   (P : Pointer; Size : size_t) : cint; cdecl; external clib name 'munmap';
-    function fpNice	   (N:cint):cint; cdecl; external clib name 'nice';
-    Function fpGetPriority (Which,Who:cint):cint;      cdecl; external clib name 'getpriority';
-    Function fpSetPriority (Which,Who,What:cint):cint; cdecl; external clib name 'setpriority';
-    Function fpSymlink	   (oldname,newname:pchar):cint;   cdecl; external clib name 'symlink';
-    Function fpReadLink	   (name,linkname:pchar;maxlen:size_t):cint;  cdecl; external clib name 'readlink';
-    Function FpUmask       (cmask : TMode): TMode; cdecl; external clib name 'umask';
+    Function  fpLstat       (path:pchar;Info:pstat):cint;     cdecl; external clib name 'lstat';
+    function  fpNice	   (N:cint):cint; cdecl; external clib name 'nice';
+    Function  fpGetPriority (Which,Who:cint):cint;      cdecl; external clib name 'getpriority';
+    Function  fpSetPriority (Which,Who,What:cint):cint; cdecl; external clib name 'setpriority';
+    Function  fpSymlink	   (oldname,newname:pchar):cint;   cdecl; external clib name 'symlink';
+    Function  fpReadLink	   (name,linkname:pchar;maxlen:size_t):cint;  cdecl; external clib name 'readlink';
+    Function  FpUmask       (cmask : TMode): TMode; cdecl; external clib name 'umask';
+    function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
 
 {
    $Log$
-   Revision 1.12  2004-12-31 14:27:49  marco
+   Revision 1.13  2005-02-13 20:01:38  peter
+     * include file cleanup
+
+   Revision 1.12  2004/12/31 14:27:49  marco
     * fpumask
 
    Revision 1.11  2004/12/22 13:53:51  marco

+ 5 - 17
rtl/unix/settimeo.inc

@@ -13,45 +13,33 @@
 
 **********************************************************************}
 
-{$ifdef linux}
-{$ifdef i386}
-  {$define usestime}
-{$endif}
-{$endif}
-
 {$ifdef usestime}
 
-{$ifdef FPC_USE_LIBC}
-function stime (t:ptime_t):cint; cdecl; external name 'stime';
-{$else}
 function stime (t:ptime_t):cint; 
 begin
  stime:=do_SysCall(Syscall_nr_stime,TSysParam(t));
 end;
-{$endif}
 
 function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
-
 begin
   fpsettimeofday:=stime(@tp^.tv_sec);
 end;
 
 {$else}
 
-{$ifdef FPC_USE_LIBC}
-//function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
-{$else}
 function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
-
 begin
   fpsettimeofday:=do_SysCall(Syscall_nr_settimeofday,TSysParam(@tp),TSysParam(tzp));
 end;
-{$endif}
+
 {$endif}
 
 {
   $Log$
-  Revision 1.6  2004-12-02 18:24:35  marco
+  Revision 1.7  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.6  2004/12/02 18:24:35  marco
    * fpsettimeofday.
 
   Revision 1.5  2004/10/31 18:49:02  marco

+ 0 - 64
rtl/unix/sysdeclh.inc

@@ -1,64 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Free Pascal development team
-
-    Headers of syscalls, for "invisible" imports. Default shared,
-    but can be overriden by not using a standard bunxmain.inc
-
-    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.
-
- ***********************************************************************}
-{
-{$ifdef BSD}
-function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint; external name 'FPC_SYSC_SIGPROCMASK';
-{$endif}
-function fptime		(var tloc:time_t): time_t; external name 'FPC_SYSC_TIME';
-function fpopen		(path: pchar; flags : cint; mode: TMode):cint;  external name 'FPC_SYSC_OPEN';
-function fpclose	(fd : cint): cint;  external name 'FPC_SYSC_CLOSE';
-function fplseek	(fd : cint; offset : TOff; whence : cint): TOff; external name 'FPC_SYSC_LSEEK';
-function fpread		(fd: cint; buf: pchar; nbytes : TSize): TSSize; external name 'FPC_SYSC_READ';
-function fpwrite	(fd: cint; buf:pchar; nbytes : TSize): TSSize;  external name 'FPC_SYSC_WRITE';
-function fpunlink	(path: pchar): cint;  external name 'FPC_SYSC_UNLINK';
-function fprename	(old : pchar; newpath: pchar): cint;  external name 'FPC_SYSC_RENAME';
-function fpstat		(path: pchar; var buf : stat):cint;  external name 'FPC_SYSC_STAT';
-function fpchdir	(path : pchar): cint; external name 'FPC_SYSC_CHDIR';
-function fpmkdir	(path : pchar; mode: TMode):cint; external name 'FPC_SYSC_MKDIR';
-function fprmdir	(path : pchar): cint; external name 'FPC_SYSC_RMDIR';
-function fpopendir	(dirname : pchar): pdir; external name 'FPC_SYSC_OPENDIR';
-function fpclosedir	(var dirp : dir): cint; external name 'FPC_SYSC_CLOSEDIR';
-function fpreaddir	(var dirp : dir) : pdirent; external name 'FPC_SYSC_READDIR';
-procedure fpexit	(status : cint); external name 'FPC_SYSC_EXIT';
-function fpsigaction	(sig: cint; act : psigactionrec; oact : psigactionrec): cint;  external name 'FPC_SYSC_SIGACTION';
-function fpftruncate	(fd : cint; flength : TOff): cint; external name 'FPC_SYSC_FTRUNCATE';
-function fpfstat	(fd : cint; var sb : stat): cint; external name 'FPC_SYSC_FSTAT';
-function fpfork       : pid_t; external name 'FPC_SYSC_FORK';
-// function fpexecve	(path : pchar; argv : ppchar;envp: ppchar): cint; external name 'FPC_SYSC_EXECVE';
-function fpwaitpid	(pid : pid_t;  stat_loc : pcint; options: cint): pid_t; external name 'FPC_SYSC_WAITPID';
-function fpaccess	(pathname : pchar; amode : cint): cint;external name 'FPC_SYSC_ACCESS';
-function fpDup		(fildes:cint):cint;  external name 'FPC_SYSC_DUP';
-function fpDup2		(fildes:cint;fildes2:cint):cint; external name 'FPC_SYSC_DUP2';
-function geterrno     : cint; external name  'FPC_SYS_GETERRNO';
-procedure seterrno 	(i:cint); external name  'FPC_SYS_SETERRNO';
-}
-{
-  $Log$
-  Revision 1.4  2004-11-19 13:15:14  marco
-   * external rework. Mostly done.
-
-  Revision 1.3  2003/10/26 17:01:35  marco
-   * moved sigprocmask to system for BSD. (needed for reenablesig)
-
-  Revision 1.2  2003/09/20 12:38:29  marco
-   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
-
-  Revision 1.1  2003/06/01 15:25:14  marco
-   * now generic
-
-
-}

+ 11 - 6
rtl/unix/sysdir.inc

@@ -78,7 +78,9 @@ End;
 
 procedure getdir(drivenr : byte;var dir : shortstring);
 var
-{$ifndef usegetcwd}
+{$ifdef usegetcwd}
+  buf          : array[0..254] of char;
+{$else}  
   cwdinfo      : stat;
   rootinfo     : stat;
   thedir,dummy : string[255];
@@ -86,15 +88,15 @@ var
   d            : pdirent;
   name         : string[255];
   thisdir      : stat;
-{$endif}
   tmp          : string[255];
+{$endif}
 
 begin
+  dir:='';
 {$ifdef usegetcwd}
- Fpgetcwd(@tmp[1],4096);
- dir:=tmp;
+ if Fpgetcwd(@buf,sizeof(buf))<>nil then
+   dir:=strpas(buf);
 {$else}
-  dir:='';
   thedir:='';
   dummy:='';
 
@@ -151,7 +153,10 @@ end;
 
 {
   $Log$
-  Revision 1.1  2005-02-07 22:04:55  peter
+  Revision 1.2  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.1  2005/02/07 22:04:55  peter
     * moved to unix
 
   Revision 1.1  2005/02/06 13:06:20  peter

+ 7 - 20
rtl/unix/unix.pp

@@ -228,18 +228,7 @@ Uses Strings{$ifndef FPC_USE_LIBC},Syscall{$endif};
 {$i textrec.inc}
 {$i filerec.inc}
 
-{$ifndef FPC_USE_LIBC}
-{ Raw System calls are in Syscalls.inc}
-{$ifdef Linux}                  // Linux has more "oldlinux" compability.
-{$i sysc11.inc}
-{$else}
-{$i syscalls.inc}
-{$endif}
-
-{$endif}
-
-{$i unixsysc.inc}   {Has platform specific libc part under ifdef, besides
-			syscalls}
+{$i unixfunc.inc}   { Platform specific implementations }
 
 Function getenv(name:string):Pchar; external name 'FPC_SYSC_FPGETENV';
 
@@ -262,13 +251,8 @@ begin
     WaitProcess:=-1 // return -1 to indicate an error.  fpwaitpid updated it.
   else
    begin
-{$ifndef Solaris}
-     { at least correct for Linux and Darwin (JM) }
-     if (s and $7F)=0 then // Only this is a valid returncode
-{$else}
-     if (s and $FF)=0 then // Only this is a valid returncode
-{$endif}
-      WaitProcess:=s shr 8
+     if wifexited(s) then
+      WaitProcess:=wexitstatus(s)
      else if (s>0) then  // Until now there is not use of the highest bit , but check this for the future
       WaitProcess:=-s // normal case
      else
@@ -1244,7 +1228,10 @@ End.
 
 {
   $Log$
-  Revision 1.81  2005-02-06 11:20:52  peter
+  Revision 1.82  2005-02-13 20:01:38  peter
+    * include file cleanup
+
+  Revision 1.81  2005/02/06 11:20:52  peter
     * threading in system unit
     * removed systhrds unit