Selaa lähdekoodia

* external rework. Mostly done.

marco 21 vuotta sitten
vanhempi
commit
d3cb19214b

+ 11 - 3
rtl/bsd/baseunix.pp

@@ -43,8 +43,13 @@ const clib = 'c';
 {$i bunxh.inc}		{ Functions}
 {$i bunxh.inc}		{ Functions}
 {$ENDIF}
 {$ENDIF}
 
 
+{$ifndef ver1_0}
+function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
+procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
+{$else}
 function fpgeterrno:longint; 
 function fpgeterrno:longint; 
 procedure fpseterrno(err:longint); 
 procedure fpseterrno(err:longint); 
+{$endif}
 
 
 {$ifndef ver1_0}
 {$ifndef ver1_0}
 property errno : cint read fpgeterrno write fpseterrno;
 property errno : cint read fpgeterrno write fpseterrno;
@@ -57,8 +62,8 @@ implementation
 Uses Sysctl;
 Uses Sysctl;
 
 
 {$ifndef ver1_0}
 {$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';
 {$else}
 {$else}
 // workaround for 1.0.10 bugs.
 // workaround for 1.0.10 bugs.
 
 
@@ -84,7 +89,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2004-11-14 12:21:08  marco
+  Revision 1.12  2004-11-19 13:15:14  marco
+   * external rework. Mostly done.
+
+  Revision 1.11  2004/11/14 12:21:08  marco
    * moved some calls from unix to baseunix. Darwin untested.
    * moved some calls from unix to baseunix. Darwin untested.
 
 
   Revision 1.10  2004/05/31 18:03:51  jonas
   Revision 1.10  2004/05/31 18:03:51  jonas

+ 9 - 6
rtl/bsd/bunxfunc.inc

@@ -29,7 +29,7 @@
 
 
 {$ifndef FPC_USE_LIBC}
 {$ifndef FPC_USE_LIBC}
 {  $ ifndef ver1_0}
 {  $ ifndef ver1_0}
-Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
+// Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
 {   $ endif}
 {   $ endif}
 {$USER BLA!}
 {$USER BLA!}
 
 
@@ -155,7 +155,7 @@ begin
         time_to_sleep.tv_nsec := 0;
         time_to_sleep.tv_nsec := 0;
         if (FPnanosleep(@time_to_sleep, @time_remaining) <> -1) Then
         if (FPnanosleep(@time_to_sleep, @time_remaining) <> -1) Then
          Exit(0);
          Exit(0);
-        if (geterrno <> ESysEINTR) Then	// EAGAIN?
+        if (fpgeterrno <> ESysEINTR) Then	// EAGAIN?
          Exit (seconds);                     { best guess }
          Exit (seconds);                     { best guess }
         FPsleep:= time_remaining.tv_sec;
         FPsleep:= time_remaining.tv_sec;
         if   (time_remaining.tv_nsec <> 0) Then
         if   (time_remaining.tv_nsec <> 0) Then
@@ -177,12 +177,12 @@ Begin
         mib[0] := val1;
         mib[0] := val1;
         mib[1] := val2;
         mib[1] := val2;
         len    := pzsize;
         len    := pzsize;
-        oerrno := geterrno;
+        oerrno := fpgeterrno;
 
 
         if (FPsysctl(@mib, 2, pz, @len, NIL, 0) = -1) Then
         if (FPsysctl(@mib, 2, pz, @len, NIL, 0) = -1) Then
            Begin
            Begin
-                if (geterrno = ESysENOMEM) Then
-                        seterrno(oerrno)
+                if (fpgeterrno = ESysENOMEM) Then
+                        fpseterrno(oerrno)
                 else
                 else
                         rval := -1;
                         rval := -1;
            End;
            End;
@@ -558,7 +558,10 @@ end;
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.9  2004-11-14 12:21:08  marco
+ Revision 1.10  2004-11-19 13:15:14  marco
+  * external rework. Mostly done.
+
+ Revision 1.9  2004/11/14 12:21:08  marco
   * moved some calls from unix to baseunix. Darwin untested.
   * moved some calls from unix to baseunix. Darwin untested.
 
 
  Revision 1.8  2004/01/22 13:46:14  marco
  Revision 1.8  2004/01/22 13:46:14  marco

+ 11 - 8
rtl/bsd/ossysch.inc

@@ -20,25 +20,28 @@
 //Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
 //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 fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
 
 
-Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name 'FPC_SYSC_MMAP';
-Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
+// Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name 'FPC_SYSC_MMAP';
+// Function Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
 
 
 
 
 {$ifndef FPC_USE_LIBC}
 {$ifndef FPC_USE_LIBC}
-Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint;  external name  'FPC_SYSC_IOCTL';
-Function FpGetPid:LongInt;   external name  'FPC_SYSC_GETPID';
-Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint;  external name  'FPC_SYSC_READLINK';
+//Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint;  external name  'FPC_SYSC_IOCTL';
+//Function FpGetPid:LongInt;   external name  'FPC_SYSC_GETPID';
+//Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint;  external name  'FPC_SYSC_READLINK';
 
 
 { Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or  Unix/freebsd}
 { Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or  Unix/freebsd}
-Function FpNanoSleep (req : ptimespec;rem : ptimespec) : cint; external name 'FPC_SYSC_NANOSLEEP';
+//Function FpNanoSleep (req : ptimespec;rem : ptimespec) : cint; external name 'FPC_SYSC_NANOSLEEP';
 
 
 { can be used for getdir?}
 { can be used for getdir?}
-Function Fpgetcwd (path:pchar; siz:size_t):pchar; external name 'FPC_SYSC_GETCWD';
+//Function Fpgetcwd (path:pchar; siz:size_t):pchar; external name 'FPC_SYSC_GETCWD';
 {$endif}
 {$endif}
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2004-11-14 12:21:08  marco
+  Revision 1.9  2004-11-19 13:15:14  marco
+   * external rework. Mostly done.
+
+  Revision 1.8  2004/11/14 12:21:08  marco
    * moved some calls from unix to baseunix. Darwin untested.
    * moved some calls from unix to baseunix. Darwin untested.
 
 
   Revision 1.7  2003/12/30 12:26:21  marco
   Revision 1.7  2003/12/30 12:26:21  marco

+ 9 - 4
rtl/linux/baseunix.pp

@@ -44,9 +44,13 @@ const clib = 'c';
 
 
 {$i bunxovlh.inc}
 {$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;
 function fpgeterrno:longint;
 procedure fpseterrno(err:longint);
 procedure fpseterrno(err:longint);
-
+{$endif}
 {$ifdef HASGLOBALPROPERTY}
 {$ifdef HASGLOBALPROPERTY}
 property errno : cint read fpgeterrno write fpseterrno;
 property errno : cint read fpgeterrno write fpseterrno;
 {$endif}
 {$endif}
@@ -72,15 +76,16 @@ begin
    intfpseterrno(err);
    intfpseterrno(err);
 end;
 end;
 {$else}
 {$else}
-function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
-procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
 
 
 {$endif}
 {$endif}
 end.
 end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2004-11-14 12:21:08  marco
+  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.
    * moved some calls from unix to baseunix. Darwin untested.
 
 
   Revision 1.9  2004/03/04 22:15:16  marco
   Revision 1.9  2004/03/04 22:15:16  marco

+ 11 - 8
rtl/linux/bunxfunc.inc

@@ -48,7 +48,7 @@ begin
 end;
 end;
 
 
 {overload}
 {overload}
-Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROGMASK';
+//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'];
 Function fpSigProcMask(how:cint;nset : pSigSet; oset : pSigSet):cint; [public, alias : 'FPC_SYSC_SIGPROGMASK'];
 {
 {
@@ -182,17 +182,17 @@ begin
             fpsigaddset  (nset,SIGCHLD);
             fpsigaddset  (nset,SIGCHLD);
             if fpsigaction(SIGCHLD,NIL,@oact)<0 Then
             if fpsigaction(SIGCHLD,NIL,@oact)<0 Then
               begin
               begin
-                oerrno:=geterrno;
+                oerrno:=fpgeterrno;
                 fpsigprocmask(SIG_SETMASK,@oset,NIL);
                 fpsigprocmask(SIG_SETMASK,@oset,NIL);
-                seterrno(oerrno);
+                fpseterrno(oerrno);
                 exit(cuint(-1));
                 exit(cuint(-1));
               End;
               End;
             if oact.sa_handler=signalhandler(SIG_IGN) Then
             if oact.sa_handler=signalhandler(SIG_IGN) Then
              Begin
              Begin
                fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining);
                fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining);
-               oerrno:=geterrno;
+               oerrno:=fpgeterrno;
                fpsigprocmask(SIG_SETMASK,@oset,NIL);
                fpsigprocmask(SIG_SETMASK,@oset,NIL);
-               seterrno(oerrno);
+               fpseterrno(oerrno);
              End
              End
             Else
             Else
              Begin
              Begin
@@ -411,10 +411,10 @@ begin
   fptimes:=Do_syscall(syscall_nr_times,TSysParam(@buffer));
   fptimes:=Do_syscall(syscall_nr_times,TSysParam(@buffer));
 end;
 end;
 
 
-function fpgetcwd(path : pchar; siz:size_t):pchar;
+function pfpgetcwd(path : pchar; siz:tsize):pchar;  [public, alias : 'FPC_SYSC_GETCWD'];
 
 
 begin
 begin
-  fpgetcwd:=pchar(Do_Syscall(Syscall_nr_getcwd,TSysParam(Path),TSysParam(siz)));
+  pfpgetcwd:=pchar(Do_Syscall(Syscall_nr_getcwd,TSysParam(Path),TSysParam(siz)));
 end;
 end;
 
 
 Function fpSelect(N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint;
 Function fpSelect(N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint;
@@ -565,7 +565,10 @@ end;
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.13  2004-11-14 12:21:08  marco
+ Revision 1.14  2004-11-19 13:15:14  marco
+  * external rework. Mostly done.
+
+ Revision 1.13  2004/11/14 12:21:08  marco
   * moved some calls from unix to baseunix. Darwin untested.
   * moved some calls from unix to baseunix. Darwin untested.
 
 
  Revision 1.12  2004/10/24 13:55:52  peter
  Revision 1.12  2004/10/24 13:55:52  peter

+ 10 - 7
rtl/linux/ossysch.inc

@@ -15,17 +15,20 @@
  ****************************************************************************
  ****************************************************************************
 }
 }
 
 
-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 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 fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
-Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;   external name 'FPC_SYSC_READLINK';
-Function FpIOCtl(handle:cint;ndx:culong;Data: Pointer):cint;  external name 'FPC_SYSC_IOCTL';
-Function FpGetPid:pid_t;   external name 'FPC_SYSC_GETPID';
-Function FpNanoSleep(req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
+//Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;   external name 'FPC_SYSC_READLINK';
+//Function FpIOCtl(handle:cint;ndx:culong;Data: Pointer):cint;  external name 'FPC_SYSC_IOCTL';
+//Function FpGetPid:pid_t;   external name 'FPC_SYSC_GETPID';
+//Function FpNanoSleep(req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.7  2004-11-14 12:21:08  marco
+ Revision 1.8  2004-11-19 13:15:14  marco
+  * external rework. Mostly done.
+
+ Revision 1.7  2004/11/14 12:21:08  marco
   * moved some calls from unix to baseunix. Darwin untested.
   * moved some calls from unix to baseunix. Darwin untested.
 
 
  Revision 1.6  2003/11/19 11:46:55  marco
  Revision 1.6  2003/11/19 11:46:55  marco

+ 47 - 35
rtl/unix/bunxh.inc

@@ -21,8 +21,13 @@ 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
 // if you are looking for macro definitions or non C template overloaded versions, they are moved to bunxovlh.inc
 
 
-    Function  FpSigProcMask(how : cInt; nset : pSigSet; oset : pSigSet): cInt;
-    Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt;
+{$ifdef linux}
+    Function  FpSigProcMask(how : cInt; nset : pSigSet; oset : pSigSet): cInt; 
+    Function  FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK'; 
+{$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  FpSigPending (var nset : TSigSet): cInt;
     Function  FpSigSuspend (Const sigmask : TSigSet): cInt;
     Function  FpSigSuspend (Const sigmask : TSigSet): cInt;
 
 
@@ -33,15 +38,15 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpChown      (path : pChar; owner : TUid; group : TGid): cInt;
     Function  FpChown      (path : pChar; owner : TUid; group : TGid): cInt;
     Function  FpUtime      (path : pChar; times : putimbuf): cInt;
     Function  FpUtime      (path : pChar; times : putimbuf): cInt;
     Function  FpPipe       (var fildes : tfildes):cInt;
     Function  FpPipe       (var fildes : tfildes):cInt;
-    Function  FpDup        (fildes : cInt): cInt;
-    Function  FpDup2       (fildes, fildes2 : cInt): cInt;
+    Function  FpDup        (fildes : cInt): cInt;  external name 'FPC_SYSC_DUP';
+    Function  FpDup2       (fildes, fildes2 : cInt): cInt; external name 'FPC_SYSC_DUP2'; 
     Function  FpTimes      (var buffer : tms): TClock;
     Function  FpTimes      (var buffer : tms): TClock;
 
 
     Function  FpAlarm      (seconds : cuint): cuint;
     Function  FpAlarm      (seconds : cuint): cuint;
     Function  FpPause : cInt;
     Function  FpPause : cInt;
     Function  FpSleep      (seconds : cuint): cuint;
     Function  FpSleep      (seconds : cuint): cuint;
 
 
-    Function  FpGetpid  : TPid;
+    Function  FpGetpid  : TPid; external name  'FPC_SYSC_GETPID';
     Function  FpGetppid : TPid;
     Function  FpGetppid : TPid;
     Function  FpGetuid  : TUid;
     Function  FpGetuid  : TUid;
     Function  FpGeteuid : TUid;
     Function  FpGeteuid : TUid;
@@ -56,52 +61,59 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg : cInt): cInt;
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg : cInt): cInt;
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt;
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt;
 
 
-    Function  FpGetcwd     (path:pChar; siz:TSize):pChar;
-    Function  FpFork : TPid;
-    Function  FpExecve     (path : pChar; argv : ppChar; envp: ppChar): cInt;
+    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  FpExecv      (path : pChar; argv : ppChar): cInt;
-    Function  FpWaitpid    (pid : TPid; stat_loc : pcInt; options: cInt): TPid;
+    Function  FpWaitpid    (pid : TPid; stat_loc : pcInt; options: cInt): TPid; external name 'FPC_SYSC_WAITPID';
     Function  FpWait       (var stat_loc : cInt): TPid;
     Function  FpWait       (var stat_loc : cInt): TPid;
-    Procedure FpExit       (Status : cInt);
+    Procedure FpExit       (Status : cInt);  external name 'FPC_SYSC_EXIT';
     Function  FpKill       (pid : TPid; sig: cInt): cInt;
     Function  FpKill       (pid : TPid; sig: cInt): cInt;
     Function  FpUname      (var name: utsname): cInt;
     Function  FpUname      (var name: utsname): cInt;
-    Function  FpOpendir    (dirname : pChar): pDir;
-    Function  FpReaddir    (var dirp : Dir) : pDirent;
-    Function  FpClosedir   (var dirp : Dir): cInt;
-    Function  FpChdir      (path : pChar): cInt;
-    Function  FpOpen       (path : pChar; flags : cInt; Mode: TMode):cInt;
-    Function  FpMkdir      (path : pChar; Mode: TMode):cInt;
-    Function  FpUnlink     (path : pChar): cInt;
-    Function  FpRmdir      (path : pChar): cInt;
-    Function  FpRename     (old  : pChar; newpath: pChar): cInt;
-    Function  FpFStat      (fd : cInt; var sb : stat): cInt;
-    Function  FpStat       (path: pChar; var buf : stat): cInt;
-    Function  FpAccess     (pathname : pChar; aMode : cInt): cInt;
-    Function  FpClose      (fd : cInt): cInt;
-    Function  FpRead       (fd : cInt; buf: pChar; nbytes : TSize): TSsize;
-    Function  FpWrite      (fd : cInt; buf:pChar; nbytes : TSize): TSsize;
-    Function  FpLseek      (fd : cInt; offset : TOff; whence : cInt): TOff;
-    Function  FpTime       (var tloc : TTime): TTime;
-    Function  FpFtruncate  (fd : cInt; flength : TOff): cInt;
-    Function  FPSigaction  (sig: cInt; act : pSigActionRec; oact : pSigActionRec): cint;
+    Function  FpOpendir    (dirname : pChar): pDir;  external name 'FPC_SYSC_OPENDIR';
+    Function  FpReaddir    (var dirp : Dir) : pDirent; external name 'FPC_SYSC_READDIR';
+    Function  FpClosedir   (var dirp : Dir): cInt; external name 'FPC_SYSC_CLOSEDIR';
+    Function  FpChdir      (path : pChar): cInt;  external name 'FPC_SYSC_CHDIR';
+    Function  FpOpen       (path : pChar; flags : cInt; Mode: TMode):cInt; external name 'FPC_SYSC_OPEN';
+    Function  FpMkdir      (path : pChar; Mode: TMode):cInt;  external name 'FPC_SYSC_MKDIR';
+    Function  FpUnlink     (path : pChar): cInt;  external name 'FPC_SYSC_UNLINK';
+    Function  FpRmdir      (path : pChar): cInt; external name 'FPC_SYSC_RMDIR';
+    Function  FpRename     (old  : pChar; newpath: pChar): cInt;   external name 'FPC_SYSC_RENAME';
+    Function  FpFStat      (fd : cInt; var sb : stat): cInt; external name 'FPC_SYSC_FSTAT';
+    Function  FpStat       (path: pChar; var buf : stat): cInt;  external name 'FPC_SYSC_STAT';
+    Function  FpAccess     (pathname : pChar; aMode : cInt): cInt; external name 'FPC_SYSC_ACCESS';
+    Function  FpClose      (fd : cInt): cInt;  external name 'FPC_SYSC_CLOSE';
+
+    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  FpLseek      (fd : cInt; offset : TOff; whence : cInt): TOff; external name 'FPC_SYSC_LSEEK';
+    Function  FpTime       (var tloc : TTime): TTime; external name 'FPC_SYSC_TIME';
+    Function  FpFtruncate  (fd : cInt; flength : TOff): cInt;  external name 'FPC_SYSC_FTRUNCATE';
+    Function  FPSigaction  (sig: cInt; act : pSigActionRec; oact : pSigActionRec): cint;  external name 'FPC_SYSC_SIGACTION';
     Function  FPSelect     (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint;
     Function  FPSelect     (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint;
-    Function  FpIOCtl      (Handle:cint;Ndx: culong;Data: Pointer):cint;
-    Function  FpNanoSleep  (req : ptimespec;rem : ptimespec):cint;
+    Function  FpIOCtl      (Handle:cint;Ndx: culong;Data: Pointer):cint; external name  'FPC_SYSC_IOCTL';
+    Function  FpNanoSleep  (req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
     Function  fpLstat(path:pchar;Info:pstat):cint;
     Function  fpLstat(path:pchar;Info:pstat):cint;
     Function  fpLstat(Filename: ansistring;Info:pstat):cint;
     Function  fpLstat(Filename: ansistring;Info:pstat):cint;
     Function  fpSymlink(oldname,newname:pchar):cint;
     Function  fpSymlink(oldname,newname:pchar):cint;
-    Function  fpReadLink(name,linkname:pchar;maxlen:size_t):cint;
+    Function  fpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name  'FPC_SYSC_READLINK';
+
     function  fpNice(N:cint):cint;
     function  fpNice(N:cint):cint;
     Function  fpGetPriority(Which,Who:cint):cint;
     Function  fpGetPriority(Which,Who:cint):cint;
     Function  fpSetPriority(Which,Who,What:cint):cint;
     Function  fpSetPriority(Which,Who,What:cint):cint;
-    Function  Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; 
-    Function  Fpmunmap(start:pointer;len:size_t):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  FpGetEnv     (name : pChar): pChar;
     Function  FpGetEnv     (name : pChar): pChar;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2004-11-14 12:21:08  marco
+  Revision 1.13  2004-11-19 13:15:14  marco
+   * external rework. Mostly done.
+
+  Revision 1.12  2004/11/14 12:21:08  marco
    * moved some calls from unix to baseunix. Darwin untested.
    * moved some calls from unix to baseunix. Darwin untested.
 
 
   Revision 1.11  2003/12/30 12:24:01  marco
   Revision 1.11  2003/12/30 12:24:01  marco

+ 5 - 2
rtl/unix/bunxovl.inc

@@ -48,7 +48,7 @@ End;
 
 
 Function  FpGetcwd (path:AnsiString; siz:TSize):AnsiString;
 Function  FpGetcwd (path:AnsiString; siz:TSize):AnsiString;
 Begin
 Begin
-  FpGetcwd:=FpGetcwd(pchar(path),siz);
+  FpGetcwd:=ansistring(pchar(FpGetcwd(pchar(path),siz)));
 End;
 End;
 
 
 Function  FpExecve (path : AnsiString; argv : ppchar; envp: ppchar): cInt;
 Function  FpExecve (path : AnsiString; argv : ppchar; envp: ppchar): cInt;
@@ -361,7 +361,10 @@ end;
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.13  2004-11-14 12:21:08  marco
+ Revision 1.14  2004-11-19 13:15:14  marco
+  * external rework. Mostly done.
+
+ Revision 1.13  2004/11/14 12:21:08  marco
   * moved some calls from unix to baseunix. Darwin untested.
   * moved some calls from unix to baseunix. Darwin untested.
 
 
  Revision 1.12  2004/11/02 14:49:48  florian
  Revision 1.12  2004/11/02 14:49:48  florian

+ 6 - 3
rtl/unix/sysdeclh.inc

@@ -14,7 +14,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  ***********************************************************************}
  ***********************************************************************}
-
+{
 {$ifdef BSD}
 {$ifdef BSD}
 function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint; external name 'FPC_SYSC_SIGPROCMASK';
 function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint; external name 'FPC_SYSC_SIGPROCMASK';
 {$endif}
 {$endif}
@@ -45,10 +45,13 @@ 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';
 function geterrno     : cint; external name  'FPC_SYS_GETERRNO';
 function geterrno     : cint; external name  'FPC_SYS_GETERRNO';
 procedure seterrno 	(i:cint); external name  'FPC_SYS_SETERRNO';
 procedure seterrno 	(i:cint); external name  'FPC_SYS_SETERRNO';
-
+}
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-10-26 17:01:35  marco
+  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)
    * moved sigprocmask to system for BSD. (needed for reenablesig)
 
 
   Revision 1.2  2003/09/20 12:38:29  marco
   Revision 1.2  2003/09/20 12:38:29  marco

+ 9 - 8
rtl/unix/terminfo.pp

@@ -619,11 +619,11 @@ const
 { structure, not just to the common parts. However, since this structure }
 { structure, not just to the common parts. However, since this structure }
 { differs for different versions of ncurses,it's impossible to give a    }
 { differs for different versions of ncurses,it's impossible to give a    }
 { general declaration here which is correct (JM)                         }
 { general declaration here which is correct (JM)                         }
-function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1;cdecl;
+function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1;cdecl; external curseslib name 'set_curterm';
 function del_curterm(term: TerminalCommon_ptr1): Longint;
 function del_curterm(term: TerminalCommon_ptr1): Longint;
 
 
 { sets whether to use environment variables for LINES and COLUMNS }
 { sets whether to use environment variables for LINES and COLUMNS }
-procedure use_env(B: Longint);cdecl;
+procedure use_env(B: Longint); cdecl; external curseslib name 'use_env';
 
 
 function putp(Ndx: Longint): Longint;
 function putp(Ndx: Longint): Longint;
 
 
@@ -631,7 +631,7 @@ function putp(Ndx: Longint): Longint;
 function setupterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;
 function setupterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;
 
 
 { reinitialize lib }
 { reinitialize lib }
-function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;cdecl;
+function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external curseslib name 'restartterm';
 
 
 {function tgetent(P1, P2: PChar): Longint;
 {function tgetent(P1, P2: PChar): Longint;
 function tgetflag(P: PChar): Longint;
 function tgetflag(P: PChar): Longint;
@@ -671,11 +671,9 @@ begin
   tputs := F(P);
   tputs := F(P);
 end;
 end;
 
 
-function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1; cdecl; external curseslib;
+//function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1; cdecl; external curseslib;
 
 
-procedure use_env(B: Longint); cdecl; external curseslib;
-
-function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external curseslib;
+// function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external curseslib;
 
 
 function setuptermC(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external curseslib name 'setupterm';
 function setuptermC(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external curseslib name 'setupterm';
 
 
@@ -747,7 +745,10 @@ function tparam(const char *, char *, int, ...): PChar; cdecl; external;}
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2004-03-05 22:18:15  jonas
+  Revision 1.7  2004-11-19 13:15:15  marco
+   * external rework. Mostly done.
+
+  Revision 1.6  2004/03/05 22:18:15  jonas
     * fixed declaration for cur_term for darwin now that the importing of
     * fixed declaration for cur_term for darwin now that the importing of
       variables from shared libraries works
       variables from shared libraries works
 
 

+ 9 - 3
rtl/unix/unix.pp

@@ -1185,7 +1185,7 @@ stringhandling overhead at the same time.
 
 
 }
 }
 Var
 Var
-  NewDir : ansistring;
+  mydir,NewDir : ansistring;
   p1     : cint;
   p1     : cint;
   Info   : Stat;
   Info   : Stat;
   i,j      : cint; 
   i,j      : cint; 
@@ -1212,7 +1212,10 @@ Begin
      i:=length(dirlist);
      i:=length(dirlist);
      j:=1;
      j:=1;
      Repeat
      Repeat
-       NewDir:=ansistring(p)+'/'+Path;
+       mydir:=ansistring(p);
+       if (length(mydir)>0) and (mydir[length(mydir)]<>'/') then
+          mydir:=mydir+'/';
+       NewDir:=mydir+Path;
        if (FpStat(NewDir,Info)>=0) and
        if (FpStat(NewDir,Info)>=0) and
           (not fpS_ISDIR(Info.st_Mode)) then
           (not fpS_ISDIR(Info.st_Mode)) then
         Begin
         Begin
@@ -1251,7 +1254,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.76  2004-11-03 15:00:43  marco
+  Revision 1.77  2004-11-19 13:15:15  marco
+   * external rework. Mostly done.
+
+  Revision 1.76  2004/11/03 15:00:43  marco
    * Pathstr eliminated
    * Pathstr eliminated
 
 
   Revision 1.75  2004/10/30 20:55:54  marco
   Revision 1.75  2004/10/30 20:55:54  marco