Browse Source

* fpreadlink(pathstr) moved to unxovl (since not platform specific),
small fixes for "make all OPT='-dFPC_USE_LIBC'

marco 21 years ago
parent
commit
19c44b76f2
5 changed files with 52 additions and 50 deletions
  1. 5 28
      rtl/linux/unxsysc.inc
  2. 5 2
      rtl/linux/unxsysch.inc
  3. 12 14
      rtl/unix/oscdeclh.inc
  4. 24 5
      rtl/unix/unxovl.inc
  5. 6 1
      rtl/unix/unxovlh.inc

+ 5 - 28
rtl/linux/unxsysc.inc

@@ -103,36 +103,13 @@ begin
  fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
 end;
 
-{
-Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
-
-begin
-  fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
-end;
-}
-
-Function fpReadLink(Name:pathstr):pathstr;
-{
-  Read a link (where it points to)
-}
-var
-  LinkName : pathstr;
-  i : cint;
-begin
-  Name:=Name+#0;
-  i:=fpReadLink(@Name[1],@LinkName[1],high(linkname));
-  if i>0 then
-   begin
-     linkname[0]:=chr(i);
-     fpReadLink:=LinkName;
-   end
-  else
-   fpReadLink:='';
-end;
-
 {
  $Log$
- Revision 1.3  2003-11-13 13:11:55  marco
+ Revision 1.4  2004-01-01 16:10:23  marco
+  * fpreadlink(pathstr) moved to unxovl (since not platform specific),
+ 	small fixes for "make all OPT='-dFPC_USE_LIBC'
+
+ Revision 1.3  2003/11/13 13:11:55  marco
   * Linuxerror remove + hdr+log added
 
 

+ 5 - 2
rtl/linux/unxsysch.inc

@@ -25,11 +25,14 @@ Function fpLstat(path:pchar;Info:pstat):cint;
 Function fpLstat(Filename: PathStr;Info:pstat):cint;
 Function fpSymlink(oldname,newname:pchar):cint;
 Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;
-Function fpReadLink(name:PathStr):PathStr;
 
 {
   $Log$
-  Revision 1.4  2003-11-19 11:46:55  marco
+  Revision 1.5  2004-01-01 16:10:23  marco
+   * fpreadlink(pathstr) moved to unxovl (since not platform specific),
+  	small fixes for "make all OPT='-dFPC_USE_LIBC'
+
+  Revision 1.4  2003/11/19 11:46:55  marco
    * changes due to the previous *BSD changes. Mainly moving constants from
      unix to systypes.inc (which acts as unxtypes.inc)
 

+ 12 - 14
rtl/unix/oscdeclh.inc

@@ -28,11 +28,8 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     function  FpAccess  (pathname : pchar; amode : cint): cint; cdecl; external name 'access';
     function  FpChdir	(path : pchar): cint; cdecl; external name 'chdir';
     function  FpClose	(fd : cint): cint; cdecl; external name 'close';
-//{$ifndef FPC_IS_SYSTEM}
     Function  FpClosedir (var dirp : Dir): cInt; cdecl; external name 'closedir';
-//{$else}
     function  FpClosedir (dirp : pdir): cint; cdecl; external name 'closedir';
-//{$endif}
     function  FpDup	(oldd:cint):cint; cdecl; external name 'dup';
     function  FpDup2	(oldd:cint;newd:cint):cint; cdecl; external name 'dup2';
     function  FpExecve	(path : pchar; argv : ppchar; envp: ppchar): cint; cdecl; external name 'execve';
@@ -44,28 +41,22 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     function  FpOpen	(path: pchar; flags : cint; mode: TMode):cint; cdecl; external name 'open';
     function  FpOpendir	(dirname : pchar): pdir; cdecl; external name 'opendir';
     function  FpRead	(fd: cint; buf: pchar; nbytes : TSize): TSSize; cdecl; external name 'read';
-//{$ifdef FPC_IS_SYSTEM}
     function  FpReaddir	(dirp : pdir) : pdirent;cdecl; external name 'readdir';
-//{$ELSE}
     Function  FpReaddir    (var dirp : Dir) : pDirent;cdecl; external name 'readdir';
-//{$endif}
     function  FpRename	(old : pchar; newpath: pchar): cint; cdecl;external name 'rename';
     function  FpRmdir	(path : pchar): cint; cdecl; external name 'rmdir';
-//    {$ifdef FPC_IS_SYSTEM}
     function  FpSigaction (sig: cint;var act : sigactionrec; var oact : sigactionrec): cint; cdecl; external name 'sigaction';
-//    {$else}
     Function  FPSigaction (sig: cInt; act :pSigActionRec;oact:pSigActionRec):cint;cdecl; external name 'sigaction';
-//    {$endif}
 
     {$ifdef BSD}
     function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external name 'sigprocmask';
     {$endif}
     function  FpStat	  (path: pchar; var buf : stat): cint; cdecl; external name 'stat';
-    {$ifdef FPC_IS_SYSTEM}
+//    {$ifdef FPC_IS_SYSTEM}
     function  FpTime	   (tloc:ptime_t): time_t; cdecl; external name 'time';
-    {$else}
+//    {$else}
     Function  FpTime       (var tloc : TTime): TTime; cdecl; external name 'time';
-    {$endif}
+//    {$endif}
     function  FpUname	(var name: utsname): cint; cdecl; external name 'uname';
     function  FpUnlink	(path: pchar): cint; cdecl; external name 'unlink';
     function  FpWaitpid	(pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external name 'waitpid';
@@ -84,14 +75,21 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpGetegid : TGid;cdecl;external name 'getegid';
     Function  FpSetuid     (uid : TUid): cInt;cdecl;external name 'setuid';
     Function  FpSetgid     (gid : TGid): cInt;cdecl;external name 'setgid';
-    Function  FpGetgroups (gidsetsize : cInt; var grouplist : tgrparr):cint; cdecl;external name 'getgroups';
+    Function  FpGetgroups  (gidsetsize : cInt; var grouplist : tgrparr):cint; cdecl;external name 'getgroups';
     Function  FpGetpgrp : TPid;  cdecl;external name 'getpgrp';
     Function  FpSetsid  : TPid; cdecl;external name 'setsid';
     Function  FpPipe       (var fildes : tfildes):cInt; cdecl;external name 'pipe';
+    Function  FpFcntl      (fildes : cInt; cmd : cInt): cInt; cdecl external name 'fcntl';   
+    Function  FpFcntl      (fildes : cInt; cmd : cInt; arg :cInt): cInt; cdecl external name 'fcntl';
+    Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt; cdecl external name 'fcntl';
 
 {
    $Log$
-   Revision 1.4  2004-01-01 14:09:14  marco
+   Revision 1.5  2004-01-01 16:10:23  marco
+    * fpreadlink(pathstr) moved to unxovl (since not platform specific),
+   	small fixes for "make all OPT='-dFPC_USE_LIBC'
+
+   Revision 1.4  2004/01/01 14:09:14  marco
     * FPC_USE_LIBC fixes
 
    Revision 1.3  2003/12/30 15:43:20  marco

+ 24 - 5
rtl/unix/unxovl.inc

@@ -14,10 +14,6 @@
 
  **********************************************************************}
 
-{I textrec.inc}
-{I filerec.inc}
-
-
 Function StatFS(Path:Pathstr;Var Info:Tstatfs):cint;
 
 {
@@ -31,9 +27,32 @@ begin
   statfs:=statfs(pchar(@path[1]),info);
 end;
 
+Function fpReadLink(Name:pathstr):pathstr;
+{
+  Read a link (where it points to)
+}
+var
+  LinkName : pathstr;
+  i : cint;
+begin
+  Name:=Name+#0;
+  i:=fpReadLink(@Name[1],@LinkName[1],high(linkname));
+  if i>0 then
+   begin
+     linkname[0]:=chr(i);
+     fpReadLink:=LinkName;
+   end
+  else
+   fpReadLink:='';
+end;
+
 {
  $Log$
- Revision 1.1  2003-12-30 12:27:44  marco
+ Revision 1.2  2004-01-01 16:10:23  marco
+  * fpreadlink(pathstr) moved to unxovl (since not platform specific),
+ 	small fixes for "make all OPT='-dFPC_USE_LIBC'
+
+ Revision 1.1  2003/12/30 12:27:44  marco
   * FPC_USE_LIBC
 
 

+ 6 - 1
rtl/unix/unxovlh.inc

@@ -17,11 +17,16 @@
 Function PClose(Var F:file) : cint;
 Function PClose      (Var F:text) : cint;
 Function StatFS(Path:Pathstr;Var Info:Tstatfs):cint;
+Function fpReadLink(Name:pathstr):pathstr;
 
 
 {
    $Log$
-   Revision 1.1  2003-12-30 12:27:44  marco
+   Revision 1.2  2004-01-01 16:10:23  marco
+    * fpreadlink(pathstr) moved to unxovl (since not platform specific),
+   	small fixes for "make all OPT='-dFPC_USE_LIBC'
+
+   Revision 1.1  2003/12/30 12:27:44  marco
     * FPC_USE_LIBC
 
    Revision 1.1  2003/06/01 15:23:46  marco