Browse Source

--- Merging r13875 into '.':
U rtl/unix/oscdeclh.inc
U rtl/bsd/ossysc.inc
U rtl/freebsd/sysnr.inc
U rtl/linux/system.pp
--- Merging r13903 into '.':
U rtl/unix/bunxh.inc
G rtl/bsd/ossysc.inc
U rtl/linux/ossysc.inc

# revisions: 13875,13903
------------------------------------------------------------------------
r13875 | marco | 2009-10-16 20:47:43 +0200 (Fri, 16 Oct 2009) | 3 lines
Changed paths:
M /trunk/rtl/bsd/ossysc.inc
M /trunk/rtl/freebsd/sysnr.inc
M /trunk/rtl/linux/system.pp
M /trunk/rtl/unix/oscdeclh.inc

* moved ugetrlimit to the implementation (as linux specific call it shouldn't be exported)
* syscall implementation for FreeBSD of get/setrlimit

------------------------------------------------------------------------
------------------------------------------------------------------------
r13903 | marco | 2009-10-17 21:14:09 +0200 (Sat, 17 Oct 2009) | 5 lines
Changed paths:
M /trunk/rtl/bsd/ossysc.inc
M /trunk/rtl/linux/ossysc.inc
M /trunk/rtl/unix/bunxh.inc

* 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: branches/fixes_2_4@14657 -

marco 15 years ago
parent
commit
f0f035e630
6 changed files with 34 additions and 6 deletions
  1. 10 0
      rtl/bsd/ossysc.inc
  2. 2 0
      rtl/freebsd/sysnr.inc
  3. 12 2
      rtl/linux/ossysc.inc
  4. 7 0
      rtl/linux/system.pp
  5. 3 0
      rtl/unix/bunxh.inc
  6. 0 4
      rtl/unix/oscdeclh.inc

+ 10 - 0
rtl/bsd/ossysc.inc

@@ -545,3 +545,13 @@ begin
   fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
   fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
 end;
 end;
 
 
+function FpGetRLimit(resource:cint;rlim:PRLimit):cint; [public, alias : 'FPC_SYSC_GETRLIMIT'];
+begin
+  fpgetrlimit:=do_syscall(syscall_nr_getrlimit,TSysParam(Resource),TSysParam(rlim));
+end;
+
+function FpSetRLimit(Resource:cint;rlim:PRLimit):cint; [public, alias : 'FPC_SYSC_SETRLIMIT'];
+begin
+  fpsetrlimit:=do_syscall(syscall_nr_setrlimit,TSysParam(Resource),TSysParam(rlim));
+end;
+

+ 2 - 0
rtl/freebsd/sysnr.inc

@@ -337,5 +337,7 @@ syscall_nr_getdirentries                =196;
  syscall_nr_kse_thr_interrupt           = 382;
  syscall_nr_kse_thr_interrupt           = 382;
  syscall_nr_kse_release                 = 383;
  syscall_nr_kse_release                 = 383;
  syscall_nr_kse_switchin                = 440;
  syscall_nr_kse_switchin                = 440;
+ syscall_nr_getrlimit                   = 194;
+ syscall_nr_setrlimit                   = 195;
 
 
 
 

+ 12 - 2
rtl/linux/ossysc.inc

@@ -568,13 +568,18 @@ begin
  fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
  fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
 end;
 end;
 
 
-{$ifndef NO_SYSCALL_GETRLIMIT}
+
 function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt;
 function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt;
 begin
 begin
+{$ifndef NO_SYSCALL_GETRLIMIT}
   FpGetRLimit := do_syscall(syscall_nr_getrlimit,
   FpGetRLimit := do_syscall(syscall_nr_getrlimit,
     TSysParam(resource), TSysParam(rlim));
     TSysParam(resource), TSysParam(rlim));
-end;
+{$else}
+  FpGetRLimit := do_syscall(syscall_nr_ugetrlimit,
+    TSysParam(resource), TSysParam(rlim));
 {$endif}
 {$endif}
+end;
+
 
 
 {$ifdef HAS_UGETRLIMIT}
 {$ifdef HAS_UGETRLIMIT}
 function fpugetrlimit(resource : cInt; rlim : PRLimit) : cInt;
 function fpugetrlimit(resource : cInt; rlim : PRLimit) : cInt;
@@ -592,3 +597,8 @@ begin
 end;
 end;
 {$endif}
 {$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;
+

+ 7 - 0
rtl/linux/system.pp

@@ -302,6 +302,13 @@ begin
  GetProcessID := SizeUInt (fpGetPID);
  GetProcessID := SizeUInt (fpGetPID);
 end;
 end;
 
 
+{$ifdef FPC_USE_LIBC}
+{$ifdef HAS_UGETRLIMIT}
+    { there is no ugetrlimit libc call, just map it to the getrlimit call in these cases }
+function FpUGetRLimit(resource : cInt; rlim : PRLimit) : cInt; cdecl; external clib name 'getrlimit';
+{$endif}
+{$endif}
+
 function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
 function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
 var
 var
   limits : TRLimit;
   limits : TRLimit;

+ 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  FpGetEnv     (name : pChar): pChar;
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
     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';
+

+ 0 - 4
rtl/unix/oscdeclh.inc

@@ -134,10 +134,6 @@ const
 //    function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
 //    function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
 {$endif}
 {$endif}
     function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt; cdecl; external clib name 'getrlimit';
     function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt; cdecl; external clib name 'getrlimit';
-    {$ifdef HAS_UGETRLIMIT}
-    { there is no ugetrlimit libc call, just map it to the getrlimit call in these cases }
-    function FpUGetRLimit(resource : cInt; rlim : PRLimit) : cInt; cdecl; external clib name 'getrlimit';
-    {$endif}
 
 
 {$ifdef linux}
 {$ifdef linux}
 {$ifndef FPC_IS_SYSTEM}
 {$ifndef FPC_IS_SYSTEM}