summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-10-17 19:14:09 +0000
committermarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-10-17 19:14:09 +0000
commit145e81f2c3ead11c7cd5ae6977678b89b639201e (patch)
treeddddcdd75458b66c9c818bce20eb8e9803158e29
parent7b5fb0794fed88349243814534b598ed44997af6 (diff)
downloadfpc-145e81f2c3ead11c7cd5ae6977678b89b639201e.tar.gz
* 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: http://svn.freepascal.org/svn/fpc/trunk@13903 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/bsd/ossysc.inc2
-rw-r--r--rtl/linux/ossysc.inc14
-rw-r--r--rtl/unix/bunxh.inc3
3 files changed, 16 insertions, 3 deletions
diff --git a/rtl/bsd/ossysc.inc b/rtl/bsd/ossysc.inc
index 1ecd145327..d49733422e 100644
--- a/rtl/bsd/ossysc.inc
+++ b/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;
diff --git a/rtl/linux/ossysc.inc b/rtl/linux/ossysc.inc
index 09e324fc95..b632574291 100644
--- a/rtl/linux/ossysc.inc
+++ b/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;
+
diff --git a/rtl/unix/bunxh.inc b/rtl/unix/bunxh.inc
index 485fe54a3c..df2cc6dd72 100644
--- a/rtl/unix/bunxh.inc
+++ b/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';
+