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'; +