Browse Source

* FCL now compiles for FreeBSD with new 1.1. Now Linux.

marco 22 years ago
parent
commit
688866ff4f

+ 5 - 2
fcl/freebsd/classes.pp

@@ -35,7 +35,7 @@ uses
 {$ifdef ver1_0}
 {$ifdef ver1_0}
   linux
   linux
 {$else}
 {$else}
-  unix
+  baseunix,unix
 {$endif}
 {$endif}
   ;
   ;
 
 
@@ -55,7 +55,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2002-09-07 15:15:24  peter
+  Revision 1.6  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.5  2002/09/07 15:15:24  peter
     * old logs removed and tabs fixed
     * old logs removed and tabs fixed
 
 
 }
 }

+ 35 - 8
fcl/freebsd/thread.inc

@@ -53,7 +53,11 @@ end;
 //function SIGCHLDHandler(Sig: longint): longint; cdecl;//this is std linux C declaration as function
 //function SIGCHLDHandler(Sig: longint): longint; cdecl;//this is std linux C declaration as function
 procedure SIGCHLDHandler(Sig: longint); cdecl;
 procedure SIGCHLDHandler(Sig: longint); cdecl;
 begin
 begin
+ {$ifdef ver1_0}
   waitpid(-1, nil, WNOHANG);
   waitpid(-1, nil, WNOHANG);
+ {$else}
+  fpwaitpid(-1, nil, WNOHANG);
+ {$endif}
 end;
 end;
 
 
 const zeroset :sigset = (0,0,0,0);
 const zeroset :sigset = (0,0,0,0);
@@ -66,6 +70,7 @@ begin
   ThreadsInited:=true;
   ThreadsInited:=true;
 
 
 
 
+
 // This will install SIGCHLD signal handler
 // This will install SIGCHLD signal handler
 // signal() installs "one-shot" handler,
 // signal() installs "one-shot" handler,
 // so it is better to install and set up handler with sigaction()
 // so it is better to install and set up handler with sigaction()
@@ -83,7 +88,11 @@ begin
   Act^.sa_flags := SA_NOCLDSTOP {or SA_NOMASK or SA_RESTART};
   Act^.sa_flags := SA_NOCLDSTOP {or SA_NOMASK or SA_RESTART};
 			//Do not block all signals ??. Don't need if SA_NOMASK in flags
 			//Do not block all signals ??. Don't need if SA_NOMASK in flags
 
 
-  SigAction(SIGCHLD, Act, OldAct);
+  {$ifdef ver1_0}
+   SigAction(SIGCHLD, @Act, @OldAct);
+  {$else}
+   fpsigaction(SIGCHLD, @Act, @OldAct);
+  {$endif}
 
 
   FreeMem(Act, SizeOf(SigActionRec));
   FreeMem(Act, SizeOf(SigActionRec));
   FreeMem(OldAct, SizeOf(SigActionRec));
   FreeMem(OldAct, SizeOf(SigActionRec));
@@ -162,7 +171,7 @@ begin
   Thread.DoTerminate;
   Thread.DoTerminate;
   if FreeThread then
   if FreeThread then
     Thread.Free;
     Thread.Free;
-  ExitProcess(Result);
+  fpExit(Result);
 end;
 end;
 
 
 
 
@@ -195,7 +204,7 @@ begin
      WaitFor;
      WaitFor;
    end;
    end;
   if FHandle <> -1 then
   if FHandle <> -1 then
-    Kill(FHandle, SIGKILL);
+    {$ifdef ver1_0}kill({$else}fpkill({$endif}FHandle, SIGKILL);
   dec(FStackPointer,FStackSize);
   dec(FStackPointer,FStackSize);
   Freemem(pointer(FStackPointer),FStackSize);
   Freemem(pointer(FStackPointer),FStackSize);
   inherited Destroy;
   inherited Destroy;
@@ -226,7 +235,11 @@ var
   P: Integer;
   P: Integer;
   I: TThreadPriority;
   I: TThreadPriority;
 begin
 begin
-  P := {$ifdef ver1_0}Linux{$else}Unix{$endif}.GetPriority(Prio_Process,FHandle);
+  P := {$ifdef ver1_0}
+         Linux.getpriority
+       {$else}
+         Unix.fpGetPriority
+       {$endif}  	(Prio_Process,FHandle);
   Result := tpNormal;
   Result := tpNormal;
   for I := Low(TThreadPriority) to High(TThreadPriority) do
   for I := Low(TThreadPriority) to High(TThreadPriority) do
     if Priorities[I] = P then
     if Priorities[I] = P then
@@ -236,7 +249,11 @@ end;
 
 
 procedure TThread.SetPriority(Value: TThreadPriority);
 procedure TThread.SetPriority(Value: TThreadPriority);
 begin
 begin
-  {$ifdef ver1_0}Linux{$else}Unix{$endif}.SetPriority(Prio_Process,FHandle, Priorities[Value]);
+       {$ifdef ver1_0}
+         Linux.Setpriority
+       {$else}
+        Unix.fpSetPriority
+       {$endif}  	(Prio_Process,FHandle, Priorities[Value]);
 end;
 end;
 
 
 
 
@@ -262,14 +279,14 @@ end;
 
 
 procedure TThread.Suspend;
 procedure TThread.Suspend;
 begin
 begin
-  Kill(FHandle, SIGSTOP);
+  {$ifdef ver1_0}kill({$else}fpkill({$endif}FHandle, SIGSTOP);
   FSuspended := true;
   FSuspended := true;
 end;
 end;
 
 
 
 
 procedure TThread.Resume;
 procedure TThread.Resume;
 begin
 begin
-  Kill(FHandle, SIGCONT);
+  {$ifdef ver1_0}kill({$else}fpkill({$endif}FHandle, SIGCONT);
   FSuspended := False;
   FSuspended := False;
 end;
 end;
 
 
@@ -283,16 +300,26 @@ function TThread.WaitFor: Integer;
 var
 var
   status : longint;
   status : longint;
 begin
 begin
+{$ifdef ver1_0}
   if FThreadID = MainThreadID then
   if FThreadID = MainThreadID then
    WaitPid(0,@status,0)
    WaitPid(0,@status,0)
   else
   else
    WaitPid(FHandle,@status,0);
    WaitPid(FHandle,@status,0);
+{$else}
+  if FThreadID = MainThreadID then
+   fpWaitPid(0,@status,0)
+  else
+   fpWaitPid(FHandle,@status,0);
+{$endif}
   Result:=status;
   Result:=status;
 end;
 end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2003-01-17 19:01:07  marco
+  Revision 1.10  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.9  2003/01/17 19:01:07  marco
    * small fix
    * small fix
 
 
   Revision 1.8  2002/11/17 21:09:44  marco
   Revision 1.8  2002/11/17 21:09:44  marco

+ 21 - 18
fcl/inc/process.pp

@@ -24,7 +24,7 @@ Uses Classes,
 {$ifdef ver1_0}
 {$ifdef ver1_0}
      Linux,
      Linux,
 {$else}
 {$else}
-     unix,
+     Baseunix,unix,
 {$endif}
 {$endif}
 {$else}
 {$else}
      Windows,
      Windows,
@@ -324,7 +324,7 @@ end;
 Function TProcess.PeekLinuxExitStatus : Boolean;
 Function TProcess.PeekLinuxExitStatus : Boolean;
 
 
 begin
 begin
-  Result:=WaitPID(Handle,@FExitCode,WNOHANG)=Handle;
+  Result:={$ifdef VER1_0}WaitPID{$else}fpWaitPid{$endif}(Handle,@FExitCode,WNOHANG)=Handle;
   If Result then
   If Result then
     FExitCode:=wexitstatus(FExitCode)
     FExitCode:=wexitstatus(FExitCode)
   else
   else
@@ -616,8 +616,8 @@ begin
   Result:=True;
   Result:=True;
   Argv:=MakeCommand(Pname,PCommandLine,StartupOptions,ProcessOptions,FStartupInfo);
   Argv:=MakeCommand(Pname,PCommandLine,StartupOptions,ProcessOptions,FStartupInfo);
   if (pos('/',PName)<>1) then
   if (pos('/',PName)<>1) then
-    PName:=FileSearch(Pname,GetEnv('PATH'));
-  Pid:=fork;
+    PName:=FileSearch(Pname,{$ifdef ver1_0}GetEnv{$else}fpgetenv{$endif}('PATH'));
+  Pid:={$ifdef ver1_0}fork;{$else}fpfork;{$endif}
   if Pid=0 then
   if Pid=0 then
    begin
    begin
    { We're in the child }
    { We're in the child }
@@ -625,23 +625,23 @@ begin
      ChDir(PDir);
      ChDir(PDir);
    if PoUsePipes in ProcessOptions then
    if PoUsePipes in ProcessOptions then
      begin
      begin
-     dup2(FStartupInfo.hStdInput,0);
-     dup2(FStartupInfo.hStdOutput,1);
-     dup2(FStartupInfo.hStdError,2);
+     {$ifdef ver1_0}dup2{$else}fpdup2{$endif}(FStartupInfo.hStdInput,0);
+     {$ifdef ver1_0}dup2{$else}fpdup2{$endif}(FStartupInfo.hStdOutput,1);
+     {$ifdef ver1_0}dup2{$else}fpdup2{$endif}(FStartupInfo.hStdError,2);
      end
      end
    else if poNoConsole in ProcessOptions then
    else if poNoConsole in ProcessOptions then
      begin
      begin
      fd:=FileOpen('/dev/null',fmOpenReadWrite);
      fd:=FileOpen('/dev/null',fmOpenReadWrite);
-     dup2(fd,0);
-     dup2(fd,1);
-     dup2(fd,2);
+     {$ifdef ver1_0}dup2{$else}fpdup2{$endif}(fd,0);
+     {$ifdef ver1_0}dup2{$else}fpdup2{$endif}(fd,1);
+     {$ifdef ver1_0}dup2{$else}fpdup2{$endif}(fd,2);
      end;
      end;
    if (poRunSuspended in ProcessOptions) then
    if (poRunSuspended in ProcessOptions) then
      sigraise(SIGSTOP);
      sigraise(SIGSTOP);
    if FEnv<>Nil then
    if FEnv<>Nil then
-     Execve(PChar(PName),Argv,Fenv)
+     {$ifdef ver1_0}execve{$else}fpexecve{$endif}(PChar(PName),Argv,Fenv)
    else
    else
-     Execv(Pchar(PName),argv);
+     {$ifdef ver1_0}execv{$else}fpexecv{$endif}(Pchar(PName),argv);
    Halt(127);
    Halt(127);
    end
    end
  else
  else
@@ -728,7 +728,7 @@ Function TProcess.WaitOnExit : Dword;
 
 
 begin
 begin
 {$ifdef unix}
 {$ifdef unix}
-  Result:=Dword(WaitPid(Handle,@FExitCode,0));
+  Result:=Dword({$ifdef ver1_0}WaitPid{$else}fpWaitPid{$endif}(Handle,@FExitCode,0));
   If Result=Handle then
   If Result=Handle then
     FExitCode:=WexitStatus(FExitCode);
     FExitCode:=WexitStatus(FExitCode);
 {$else}
 {$else}
@@ -743,7 +743,7 @@ Function TProcess.Suspend : Longint;
 
 
 begin
 begin
 {$ifdef unix}
 {$ifdef unix}
-  If kill(Handle,SIGSTOP)<>0 then
+  If {$ifdef ver1_0}kill{$else}fpkill{$endif}(Handle,SIGSTOP)<>0 then
     Result:=-1
     Result:=-1
   else
   else
     Result:=1;
     Result:=1;
@@ -756,7 +756,7 @@ Function TProcess.Resume : LongInt;
 
 
 begin
 begin
 {$ifdef unix}
 {$ifdef unix}
-  If kill(Handle,SIGCONT)<>0 then
+  If {$ifdef ver1_0}kill{$else}fpkill{$endif}(Handle,SIGCONT)<>0 then
     Result:=-1
     Result:=-1
   else
   else
     Result:=0;
     Result:=0;
@@ -770,11 +770,11 @@ Function TProcess.Terminate(AExitCode : Integer) : Boolean;
 begin
 begin
   Result:=False;
   Result:=False;
 {$ifdef unix}
 {$ifdef unix}
-  Result:=kill(Handle,SIGTERM)=0;
+  Result:={$ifdef ver1_0}kill{$else}fpkill{$endif}(Handle,SIGTERM)=0;
   If Result then
   If Result then
     begin
     begin
     If Running then
     If Running then
-      Result:=Kill(Handle,SIGKILL)=0;
+      Result:={$ifdef ver1_0}kill{$else}fpkill{$endif}(Handle,SIGKILL)=0;
     end;
     end;
   GetExitStatus;
   GetExitStatus;
 {$else}
 {$else}
@@ -919,7 +919,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2003-08-12 13:49:42  michael
+  Revision 1.17  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.16  2003/08/12 13:49:42  michael
   + Freed streams were not closed correctly
   + Freed streams were not closed correctly
 
 
   Revision 1.15  2003/05/08 20:04:16  armin
   Revision 1.15  2003/05/08 20:04:16  armin

+ 6 - 3
fcl/inc/ssockets.pp

@@ -167,7 +167,7 @@ uses
   {$ifdef ver1_0}
   {$ifdef ver1_0}
     Linux,
     Linux,
   {$else}
   {$else}
-    Unix,
+    BaseUnix, Unix,
   {$endif}
   {$endif}
  {$endif}
  {$endif}
   resolve
   resolve
@@ -370,7 +370,7 @@ Procedure TSocketServer.SetNonBlocking;
 
 
 begin
 begin
 {$ifndef notUnix}
 {$ifndef notUnix}
-  fcntl(FSocket,F_SETFL,OPEN_NONBLOCK);
+  {$ifdef ver1_0}fcntl{$else}fpfcntl{$endif}(FSocket,F_SETFL,{$ifdef ver1_0}OPEN_NONBLOCK{$else}O_NONBLOCK{$endif});
 {$endif}
 {$endif}
   FNonBlocking:=True;
   FNonBlocking:=True;
 end;
 end;
@@ -568,7 +568,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2003-03-25 17:47:06  armin
+  Revision 1.20  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.19  2003/03/25 17:47:06  armin
   * use closesocket and not fdClose for netware
   * use closesocket and not fdClose for netware
 
 
   Revision 1.18  2003/03/21 23:10:24  armin
   Revision 1.18  2003/03/21 23:10:24  armin

+ 6 - 3
fcl/unix/ezcgi.inc

@@ -17,7 +17,7 @@ Uses
 {$ifdef ver1_0}
 {$ifdef ver1_0}
   Linux
   Linux
 {$else}
 {$else}
-  Unix
+  baseUnix
 {$endif}
 {$endif}
   ;
   ;
 
 
@@ -29,7 +29,7 @@ Var P : Pchar;
 
 
 begin
 begin
    // Linux version returns pchar.
    // Linux version returns pchar.
-   p:={$ifdef ver1_0}Linux{$else}Unix{$endif}.getenv(EnvVar);
+   p:={$ifdef ver1_0}Linux{$else}BaseUnix{$endif}.fpgetenv(EnvVar);
    if P<>nil then
    if P<>nil then
      getenv:=strpas(p)
      getenv:=strpas(p)
    else
    else
@@ -38,7 +38,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2002-09-07 15:15:29  peter
+  Revision 1.6  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.5  2002/09/07 15:15:29  peter
     * old logs removed and tabs fixed
     * old logs removed and tabs fixed
 
 
 }
 }

+ 7 - 4
rtl/bsd/ossysc.inc

@@ -47,7 +47,7 @@
     function Fpfstat(fd : cint; var sb : stat): cint; cdecl; external name 'fstat';
     function Fpfstat(fd : cint; var sb : stat): cint; cdecl; external name 'fstat';
     function Fpfork : pid_t; cdecl; external name 'fork';
     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 Fpexecve(const path : pchar; const argv : ppchar; const envp: ppchar): cint; cdecl; external name 'execve';
-    function Fpwaitpid(pid : pid_t; var stat_loc : cint; options: cint): pid_t; cdecl; external name 'waitpid';
+    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 Fpaccess(const pathname : pchar; amode : cint): cint; cdecl; external name 'access';
 
 
     function Fpuname(var name: utsname): cint; cdecl; external name 'uname';
     function Fpuname(var name: utsname): cint; cdecl; external name 'uname';
@@ -403,7 +403,7 @@ Begin
   do_syscall(syscall_nr_Execve,TSysParam(path),TSysParam(Argv),TSysParam(envp));
   do_syscall(syscall_nr_Execve,TSysParam(path),TSysParam(Argv),TSysParam(envp));
 End;
 End;
 }
 }
-function Fpwaitpid(pid : pid_t; var stat_loc : cint; options: cint): pid_t; [public, alias : 'FPC_SYSC_WAITPID'];
+function Fpwaitpid(pid : pid_t; stat_loc : pcint; options: cint): pid_t; [public, alias : 'FPC_SYSC_WAITPID'];
 {
 {
   Waits until a child with PID Pid exits, or returns if it is exited already.
   Waits until a child with PID Pid exits, or returns if it is exited already.
   Any resources used by the child are freed.
   Any resources used by the child are freed.
@@ -412,7 +412,7 @@ function Fpwaitpid(pid : pid_t; var stat_loc : cint; options: cint): pid_t; [pub
 }
 }
 
 
 begin // actually a wait4() call with 4th arg 0.
 begin // actually a wait4() call with 4th arg 0.
- FpWaitPID:=do_syscall(syscall_nr_WaitPID,PID,TSysParam(@Stat_loc),options,0);
+ FpWaitPID:=do_syscall(syscall_nr_WaitPID,PID,TSysParam(Stat_loc),options,0);
 end;
 end;
 
 
 function Fpaccess(const pathname : pchar; amode : cint): cint; [public, alias : 'FPC_SYSC_ACCESS'];
 function Fpaccess(const pathname : pchar; amode : cint): cint; [public, alias : 'FPC_SYSC_ACCESS'];
@@ -598,7 +598,10 @@ end;
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.9  2003-09-17 16:02:31  marco
+ Revision 1.10  2003-09-20 12:38:29  marco
+  * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+ Revision 1.9  2003/09/17 16:02:31  marco
   * ostype include moved to top
   * ostype include moved to top
 
 
  Revision 1.8  2003/09/16 12:45:49  marco
  Revision 1.8  2003/09/16 12:45:49  marco

+ 8 - 5
rtl/bsd/ossysch.inc

@@ -15,14 +15,14 @@
  ****************************************************************************
  ****************************************************************************
 }
 }
 
 
-Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name  'FPC_SYSC_MMAP';
 //Function Fpmmap(adr,len,prot,flags,fdes,off:longint):longint;  external name  'FPC_SYSC_MMAP';
 //Function Fpmmap(adr,len,prot,flags,fdes,off:longint):longint;  external name  'FPC_SYSC_MMAP';
-Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
+//Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name  'FPC_SYSC_MMAP';
+//Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
+//function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
+
 Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint;  external name  'FPC_SYSC_IOCTL';
 Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint;  external name  'FPC_SYSC_IOCTL';
 Function FpGetPid:LongInt;   external name  'FPC_SYSC_GETPID';
 Function FpGetPid:LongInt;   external name  'FPC_SYSC_GETPID';
 //Function FpReadLink(name,linkname:pchar;maxlen:longint):longint;  external name  'FPC_SYSC_READLINK';
 //Function FpReadLink(name,linkname:pchar;maxlen:longint):longint;  external name  'FPC_SYSC_READLINK';
-
-function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
 { Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or  Unix/freebsd}
 { Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or  Unix/freebsd}
 Function FpNanoSleep (const req : timespec;var rem : timespec) : longint; external name 'FPC_SYSC_NANOSLEEP';
 Function FpNanoSleep (const req : timespec;var rem : timespec) : longint; external name 'FPC_SYSC_NANOSLEEP';
 
 
@@ -31,7 +31,10 @@ Function Fpgetcwd (path:pchar; siz:size_t):pchar; external name 'FPC_SYSC_GETCWD
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2003-09-16 12:45:49  marco
+  Revision 1.5  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.4  2003/09/16 12:45:49  marco
    * mmap typing fixes
    * mmap typing fixes
 
 
   Revision 1.3  2003/09/15 20:08:49  marco
   Revision 1.3  2003/09/15 20:08:49  marco

+ 3 - 0
rtl/bsd/unxsysch.inc

@@ -6,4 +6,7 @@ Function fpLstat(path:pchar;Info:pstat):cint;
 Function fpLstat(Filename: PathStr;Info:pstat):cint;
 Function fpLstat(Filename: PathStr;Info:pstat):cint;
 Function fpSymlink(oldname,newname:pchar):cint;
 Function fpSymlink(oldname,newname:pchar):cint;
 Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
 Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
+Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name  'FPC_SYSC_MMAP';
+Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
+function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
 
 

+ 6 - 3
rtl/freebsd/unixsysc.inc

@@ -144,7 +144,7 @@ begin
   do_syscall(syscall_nr_close,Textrec(F).Handle);
   do_syscall(syscall_nr_close,Textrec(F).Handle);
 { closed our side, Now wait for the other - this appears to be needed ?? }
 { closed our side, Now wait for the other - this appears to be needed ?? }
   pl:=@(textrec(f).userdata[2]);
   pl:=@(textrec(f).userdata[2]);
-  fpwaitpid(pl^,res,0);
+  fpwaitpid(pl^,@res,0);
   pclose:=res shr 8;
   pclose:=res shr 8;
 end;
 end;
 
 
@@ -157,7 +157,7 @@ begin
   do_syscall(syscall_nr_close,filerec(F).Handle);
   do_syscall(syscall_nr_close,filerec(F).Handle);
 { closed our side, Now wait for the other - this appears to be needed ?? }
 { closed our side, Now wait for the other - this appears to be needed ?? }
   pl:=@(filerec(f).userdata[2]);
   pl:=@(filerec(f).userdata[2]);
-  fpwaitpid(pl^,res,0);
+  fpwaitpid(pl^,@res,0);
   pclose:=res shr 8;
   pclose:=res shr 8;
 end;
 end;
 
 
@@ -214,7 +214,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2003-09-15 20:08:49  marco
+  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
    * small fixes. FreeBSD now cycles
 
 
   Revision 1.9  2003/09/15 07:09:58  marco
   Revision 1.9  2003/09/15 07:09:58  marco

+ 5 - 2
rtl/unix/bunxh.inc

@@ -71,7 +71,7 @@ Type TGrpArr = Array [0..0] of TGid;		{ C style array workarounds}
     Function  FpFork : TPid;
     Function  FpFork : TPid;
     Function  FpExecve	   (path : pChar; argv : ppChar; envp: ppChar): cInt;
     Function  FpExecve	   (path : pChar; argv : ppChar; envp: ppChar): cInt;
     Function  FpExecv	   (path : pChar; argv : ppChar): cInt;
     Function  FpExecv	   (path : pChar; argv : ppChar): cInt;
-    Function  FpWaitpid	   (pid : TPid; var stat_loc : cInt; options: cInt): TPid;
+    Function  FpWaitpid	   (pid : TPid; stat_loc : pcInt; options: cInt): TPid;
     Function  FpWait	   (var stat_loc : cInt): TPid;
     Function  FpWait	   (var stat_loc : cInt): TPid;
     Procedure FpExit	   (Status : cInt);
     Procedure FpExit	   (Status : cInt);
     Function  FpKill	   (pid : TPid; sig: cInt): cInt;
     Function  FpKill	   (pid : TPid; sig: cInt): cInt;
@@ -122,7 +122,10 @@ Type TGrpArr = Array [0..0] of TGid;		{ C style array workarounds}
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2003-09-17 11:24:46  marco
+  Revision 1.8  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.7  2003/09/17 11:24:46  marco
    * fixes for new macro's
    * fixes for new macro's
 
 
   Revision 1.6  2003/09/17 11:14:25  marco
   Revision 1.6  2003/09/17 11:14:25  marco

+ 5 - 2
rtl/unix/printer.pp

@@ -109,7 +109,7 @@ begin
   else
   else
    begin
    begin
    { We're in the parent. }
    { We're in the parent. }
-     fpwaitpid (i,j,0);
+     fpwaitpid (i,@j,0);
      if j<>0 then
      if j<>0 then
       exit;
       exit;
    { Erase the file }
    { Erase the file }
@@ -254,7 +254,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2003-09-14 20:15:01  marco
+  Revision 1.6  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.5  2003/09/14 20:15:01  marco
    * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
    * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
 
 
   Revision 1.4  2002/09/07 16:01:27  peter
   Revision 1.4  2002/09/07 16:01:27  peter

+ 5 - 2
rtl/unix/sysdeclh.inc

@@ -36,7 +36,7 @@ function fpftruncate	(fd : cint; flength : TOff): cint; external name 'FPC_SYSC_
 function fpfstat	(fd : cint; var sb : stat): cint; external name 'FPC_SYSC_FSTAT';
 function fpfstat	(fd : cint; var sb : stat): cint; external name 'FPC_SYSC_FSTAT';
 function fpfork       : pid_t; external name 'FPC_SYSC_FORK';
 function fpfork       : pid_t; external name 'FPC_SYSC_FORK';
 // function fpexecve	(path : pchar; argv : ppchar;envp: ppchar): cint; external name 'FPC_SYSC_EXECVE';
 // function fpexecve	(path : pchar; argv : ppchar;envp: ppchar): cint; external name 'FPC_SYSC_EXECVE';
-function fpwaitpid	(pid : pid_t; var stat_loc : cint; options: cint): pid_t; external name 'FPC_SYSC_WAITPID';
+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 fpaccess	(pathname : pchar; amode : cint): cint;external name 'FPC_SYSC_ACCESS';
 function fpDup		(fildes:cint):cint;  external name 'FPC_SYSC_DUP';
 function fpDup		(fildes:cint):cint;  external name 'FPC_SYSC_DUP';
 function fpDup2		(fildes:cint;fildes2:cint):cint; external name 'FPC_SYSC_DUP2';
 function fpDup2		(fildes:cint;fildes2:cint):cint; external name 'FPC_SYSC_DUP2';
@@ -45,7 +45,10 @@ procedure seterrno 	(i:cint); external name  'FPC_SYS_SETERRNO';
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2003-06-01 15:25:14  marco
+  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
    * now generic
 
 
 
 

+ 5 - 3
rtl/unix/systhrds.pp

@@ -45,14 +45,13 @@ interface
 
 
 implementation
 implementation
 
 
-Uses BaseUnix;
+Uses BaseUnix,unix;
 
 
 {*****************************************************************************
 {*****************************************************************************
                              Generic overloaded
                              Generic overloaded
 *****************************************************************************}
 *****************************************************************************}
 {$i ostypes.inc}
 {$i ostypes.inc}
 {$i ossysch.inc}
 {$i ossysch.inc}
-
 { Include generic overloaded routines }
 { Include generic overloaded routines }
 {$i thread.inc}
 {$i thread.inc}
 
 
@@ -385,7 +384,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2003-09-16 13:17:03  marco
+  Revision 1.13  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.12  2003/09/16 13:17:03  marco
    * Wat cleanup, ouwe syscalls nu via baseunix e.d.
    * Wat cleanup, ouwe syscalls nu via baseunix e.d.
 
 
   Revision 1.11  2003/09/16 13:00:02  marco
   Revision 1.11  2003/09/16 13:00:02  marco

+ 8 - 4
rtl/unix/unix.pp

@@ -259,7 +259,7 @@ Function  Glob(Const path:pathstr):pglob;
 Procedure Globfree(var p:pglob);
 Procedure Globfree(var p:pglob);
 {Filedescriptorsets}
 {Filedescriptorsets}
 {Stat.Mode Types}
 {Stat.Mode Types}
-
+procedure SigRaise(sig:integer);
 {******************************************************************************
 {******************************************************************************
                             Implementation
                             Implementation
 ******************************************************************************}
 ******************************************************************************}
@@ -271,9 +271,10 @@ Implementation
 Uses Strings;
 Uses Strings;
 
 
 {$i syscallh.inc}
 {$i syscallh.inc}
-{$i unxsysc.inc}
 {$i ossysch.inc}
 {$i ossysch.inc}
 
 
+{$i unxsysc.inc}
+
 { Get the definitions of textrec and filerec }
 { Get the definitions of textrec and filerec }
 {$i textrec.inc}
 {$i textrec.inc}
 {$i filerec.inc}
 {$i filerec.inc}
@@ -296,7 +297,7 @@ var     r,s     : LongInt;
 begin
 begin
   repeat
   repeat
     s:=$7F00;
     s:=$7F00;
-    r:=fpWaitPid(Pid,s,0);
+    r:=fpWaitPid(Pid,@s,0);
   until (r<>-1) or (LinuxError<>ESysEINTR);
   until (r<>-1) or (LinuxError<>ESysEINTR);
   if (r=-1) or (r=0) then // 0 is not a valid return and should never occur (it means status invalid when using WNOHANG)
   if (r=-1) or (r=0) then // 0 is not a valid return and should never occur (it means status invalid when using WNOHANG)
     WaitProcess:=-1 // return -1 to indicate an error
     WaitProcess:=-1 // return -1 to indicate an error
@@ -1713,7 +1714,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.37  2003-09-17 19:07:44  marco
+  Revision 1.38  2003-09-20 12:38:29  marco
+   * FCL now compiles for FreeBSD with new 1.1. Now Linux.
+
+  Revision 1.37  2003/09/17 19:07:44  marco
    * more fixes for Unix<->unixutil
    * more fixes for Unix<->unixutil
 
 
   Revision 1.36  2003/09/17 17:30:46  marco
   Revision 1.36  2003/09/17 17:30:46  marco