Ver Fonte

* set/getrlimit now also visible in baseunix when syscalls are used.
on systems that force ugetrlimit, use that transparently. (since
ugetrlimit is not posix in theory or practice, we can't export it),
resolves 13916

git-svn-id: trunk@13903 -

marco há 16 anos atrás
pai
commit
778505701c
3 ficheiros alterados com 16 adições e 3 exclusões
  1. 1 1
      rtl/bsd/ossysc.inc
  2. 12 2
      rtl/linux/ossysc.inc
  3. 3 0
      rtl/unix/bunxh.inc

+ 1 - 1
rtl/bsd/ossysc.inc

@@ -552,6 +552,6 @@ end;
 
 function FpSetRLimit(Resource:cint;rlim:PRLimit):cint; [public, alias : 'FPC_SYSC_SETRLIMIT'];
 begin
-  fpsetrlimit:=do_syscall(syscall_nr_getrlimit,TSysParam(Resource),TSysParam(rlim));
+  fpsetrlimit:=do_syscall(syscall_nr_setrlimit,TSysParam(Resource),TSysParam(rlim));
 end;
 

+ 12 - 2
rtl/linux/ossysc.inc

@@ -568,13 +568,18 @@ begin
  fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
 end;
 
-{$ifndef NO_SYSCALL_GETRLIMIT}
+
 function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt;
 begin
+{$ifndef NO_SYSCALL_GETRLIMIT}
   FpGetRLimit := do_syscall(syscall_nr_getrlimit,
     TSysParam(resource), TSysParam(rlim));
-end;
+{$else}
+  FpGetRLimit := do_syscall(syscall_nr_ugetrlimit,
+    TSysParam(resource), TSysParam(rlim));
 {$endif}
+end;
+
 
 {$ifdef HAS_UGETRLIMIT}
 function fpugetrlimit(resource : cInt; rlim : PRLimit) : cInt;
@@ -592,3 +597,8 @@ begin
 end;
 {$endif}
 
+function FpSetRLimit(Resource:cint;rlim:PRLimit):cint; [public, alias : 'FPC_SYSC_SETRLIMIT'];
+begin
+  fpsetrlimit:=do_syscall(syscall_nr_setrlimit,TSysParam(Resource),TSysParam(rlim));
+end;
+

+ 3 - 0
rtl/unix/bunxh.inc

@@ -106,3 +106,6 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpGetEnv     (name : pChar): pChar;
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
 
+    function FpGetRLimit(resource:cint;rlim:PRLimit):cint; external name 'FPC_SYSC_GETRLIMIT';
+    function FpSetRLimit(Resource:cint;rlim:PRLimit):cint; external name 'FPC_SYSC_SETRLIMIT';
+