ossysc.inc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. {
  2. Copyright (c) 2002 by Marco van de Voort
  3. The base Linux syscalls required to implement the system unit. These
  4. are aliased for use in other units (to avoid poluting the system units
  5. interface)
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. ****************************************************************************
  12. }
  13. {*****************************************************************************
  14. --- Main:The System Call Self ---
  15. *****************************************************************************}
  16. function Fptime(tloc:pTime): TTime; [public, alias : 'FPC_SYSC_TIME'];
  17. begin
  18. Fptime:=do_syscall(syscall_nr_time,TSysParam(tloc));
  19. End;
  20. {*****************************************************************************
  21. --- File:File handling related calls ---
  22. *****************************************************************************}
  23. function Fpopen(path: pchar; flags : cint; mode: mode_t):cint; [public, alias : 'FPC_SYSC_OPEN'];
  24. Begin
  25. Fpopen:=do_syscall(syscall_nr_open,TSysParam(path),TSysParam(flags or O_LARGEFILE),TSysParam(mode));
  26. End;
  27. function Fpclose(fd : cint): cint; [public, alias : 'FPC_SYSC_CLOSE'];
  28. begin
  29. Fpclose:=do_syscall(syscall_nr_close,fd);
  30. end;
  31. function Fplseek(fd : cint; offset : off_t; whence : cint): off_t; [public, alias : 'FPC_SYSC_LSEEK'];
  32. begin
  33. {$if defined(cpu64)}
  34. result:=do_syscall(syscall_nr_lseek,tsysparam(fd),tsysparam(offset),tsysparam(whence));
  35. {$else}
  36. if do_syscall(syscall_nr__llseek,tsysparam(fd),
  37. {$ifdef FPC_ABI_EABI} 0, { align parameters as required with dummy } {$endif FPC_ABI_EABI}
  38. {$ifdef FPC_BIG_ENDIAN} tsysparam(hi(offset)),tsysparam(lo(offset)),{$endif}
  39. {$ifdef FPC_LITTLE_ENDIAN} tsysparam(lo(offset)),tsysparam(hi(offset)),{$endif}
  40. tsysparam(@result), tsysparam(whence)) = -1 then
  41. result:=off_t(-1);
  42. {$endif}
  43. end;
  44. function Fpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; [public, alias : 'FPC_SYSC_READ'];
  45. begin
  46. Fpread:=do_syscall(syscall_nr_read,Fd,TSysParam(buf),nbytes);
  47. end;
  48. function Fpwrite(fd: cint;buf:pchar; nbytes : size_t): ssize_t; [public, alias : 'FPC_SYSC_WRITE'];
  49. begin
  50. Fpwrite:=do_syscall(syscall_nr_write,Fd,TSysParam(buf),nbytes);
  51. end;
  52. {
  53. function Fppread(fd: cint; buf: pchar; nbytes : size_t; offset:Toff): ssize_t; [public, alias : 'FPC_SYSC_PREAD'];
  54. !! check 64 bit off_t sycall
  55. begin
  56. Fpread:=do_syscall(syscall_nr_pread,Fd,TSysParam(buf),nbytes,offset);
  57. end;
  58. function Fppwrite(fd: cint;buf:pchar; nbytes : size_t; offset:Toff): ssize_t; [public, alias : 'FPC_SYSC_PWRITE'];
  59. !! check 64 bit off_t sycall
  60. begin
  61. Fpwrite:=do_syscall(syscall_nr_pwrite,Fd,TSysParam(buf),nbytes,offset);
  62. end;
  63. }
  64. function Fpunlink(path: pchar): cint; [public, alias : 'FPC_SYSC_UNLINK'];
  65. begin
  66. Fpunlink:=do_syscall(syscall_nr_unlink,TSysParam(path));
  67. end;
  68. function Fprename(old : pchar; newpath: pchar): cint; [public, alias : 'FPC_SYSC_RENAME'];
  69. begin
  70. Fprename:=do_syscall(syscall_nr_rename,TSysParam(old),TSysParam(newpath));
  71. end;
  72. function Fpstat(path: pchar; var buf: stat):cint; [public, alias : 'FPC_SYSC_STAT'];
  73. begin
  74. {$if defined(cpu64)}
  75. Fpstat:=do_syscall(syscall_nr_stat,TSysParam(path),TSysParam(@buf));
  76. {$else}
  77. Fpstat:=do_syscall(syscall_nr_stat64,TSysParam(path),TSysParam(@buf));
  78. {$endif}
  79. end;
  80. {*****************************************************************************
  81. --- Directory:Directory related calls ---
  82. *****************************************************************************}
  83. function Fpchdir(path : pchar): cint; [public, alias : 'FPC_SYSC_CHDIR'];
  84. begin
  85. Fpchdir:=do_syscall(syscall_nr_chdir,TSysParam(path));
  86. end;
  87. function Fpmkdir(path : pchar; mode: mode_t):cint; [public, alias : 'FPC_SYSC_MKDIR'];
  88. begin
  89. Fpmkdir:=do_syscall(syscall_nr_mkdir,TSysParam(path),TSysParam(mode));
  90. end;
  91. function Fprmdir(path : pchar): cint; [public, alias : 'FPC_SYSC_RMDIR'];
  92. begin
  93. Fprmdir:=do_syscall(syscall_nr_rmdir,TSysParam(path));
  94. end;
  95. function Fpopendir(dirname : pchar): pdir; [public, alias : 'FPC_SYSC_OPENDIR'];
  96. var
  97. fd:integer;
  98. st:stat;
  99. ptr:pdir;
  100. begin
  101. Fpopendir:=nil;
  102. if Fpstat(dirname,st)<0 then
  103. exit;
  104. { Is it a dir ? }
  105. if not((st.st_mode and $f000)=$4000)then
  106. begin
  107. errno:=ESysENOTDIR;
  108. exit
  109. end;
  110. { Open it}
  111. fd:=Fpopen(dirname,O_RDONLY,438);
  112. if fd<0 then
  113. exit;
  114. new(ptr);
  115. if ptr=nil then
  116. exit;
  117. new(ptr^.dd_buf);
  118. if ptr^.dd_buf=nil then
  119. exit;
  120. ptr^.dd_fd:=fd;
  121. ptr^.dd_loc:=0;
  122. ptr^.dd_size:=0;
  123. ptr^.dd_nextoff:=0;
  124. ptr^.dd_max:=sizeof(ptr^.dd_buf^);
  125. Fpopendir:=ptr;
  126. end;
  127. function Fpclosedir(dirp : pdir): cint; [public, alias : 'FPC_SYSC_CLOSEDIR'];
  128. begin
  129. Fpclosedir:=Fpclose(dirp^.dd_fd);
  130. dispose(dirp^.dd_buf);
  131. dispose(dirp);
  132. end;
  133. Function Fpreaddir(dirp : pdir) : pdirent; [public, alias: 'FPC_SYSC_READDIR'];
  134. var bytes : longint;
  135. dp : pdirent;
  136. begin
  137. repeat
  138. if dirp^.dd_nextoff >= dirp^.dd_size then
  139. begin
  140. bytes := do_SysCall(SysCall_nr_getdents64,TSysParam(dirp^.dd_fd),TSysParam(dirp^.dd_buf),TSysParam(dirp^.dd_max));
  141. if bytes <= 0 then
  142. begin
  143. fpreaddir := nil;
  144. exit;
  145. end;
  146. dirp^.dd_size := bytes;
  147. dirp^.dd_nextoff := 0;
  148. end;
  149. dp := Pdirent(ptruint(dirp^.dd_buf)+dirp^.dd_nextoff);
  150. inc(dirp^.dd_nextoff,dp^.d_reclen);
  151. inc(dirp^.dd_loc,dp^.d_reclen);
  152. until dp^.d_fileno <> 0; // Don't show deleted files
  153. Fpreaddir := dp;
  154. end;
  155. {*****************************************************************************
  156. --- Process:Process & program handling - related calls ---
  157. *****************************************************************************}
  158. procedure Fpexit(status : cint); [public, alias : 'FPC_SYSC_EXIT'];
  159. begin
  160. do_syscall(syscall_nr_exit_group,status);
  161. end;
  162. {
  163. Change action of process upon receipt of a signal.
  164. Signum specifies the signal (all except SigKill and SigStop).
  165. If Act is non-nil, it is used to specify the new action.
  166. If OldAct is non-nil the previous action is saved there.
  167. }
  168. {$ifdef cpusparc}
  169. procedure Fprt_sigreturn_stub;assembler;nostackframe;
  170. asm
  171. mov syscall_nr_rt_sigreturn,%g1
  172. ta 0x10
  173. end;
  174. {$endif cpusparc}
  175. {$if defined(cpui386) or defined(cpuarm) or defined(cpux86_64)}
  176. {$define NEED_USER_TRAMPOLINE}
  177. {$endif}
  178. {$if defined(cpui386) or defined(cpuarm)}
  179. {$define NEED_USER_TRAMPOLINE_RT_DIFFERENT}
  180. {$endif}
  181. {$ifdef NEED_USER_TRAMPOLINE}
  182. procedure linux_restore; cdecl; nostackframe; assembler;
  183. {$ifdef cpuarm}
  184. asm
  185. swi syscall_nr_sigreturn
  186. end;
  187. {$endif}
  188. {$ifdef cpui386}
  189. asm
  190. popl %eax
  191. movl $syscall_nr_sigreturn, %eax
  192. int $0x80
  193. end;
  194. {$endif}
  195. {$ifdef cpux86_64}
  196. asm
  197. movq $syscall_nr_rt_sigreturn, %rax
  198. syscall
  199. end;
  200. {$endif}
  201. {$endif}
  202. {$ifdef NEED_USER_TRAMPOLINE_RT_DIFFERENT}
  203. procedure linux_restore_rt; cdecl; nostackframe; assembler;
  204. {$ifdef cpuarm}
  205. asm
  206. swi syscall_nr_rt_sigreturn
  207. end;
  208. {$endif}
  209. {$ifdef cpui386}
  210. asm
  211. movl $syscall_nr_rt_sigreturn, %eax
  212. int $0x80
  213. end;
  214. {$endif}
  215. {$endif}
  216. function Fpsigaction(sig: cint; new_action, old_action: psigactionrec): cint; [public, alias : 'FPC_SYSC_SIGACTION'];
  217. {
  218. Change action of process upon receipt of a signal.
  219. Signum specifies the signal (all except SigKill and SigStop).
  220. If Act is non-nil, it is used to specify the new action.
  221. If OldAct is non-nil the previous action is saved there.
  222. }
  223. begin
  224. {$ifdef cpusparc}
  225. { Sparc has an extra stub parameter }
  226. Fpsigaction:=do_syscall(syscall_nr_rt_sigaction,TSysParam(sig),TSysParam(new_action),TSysParam(old_action),TSysParam(ptruint(@Fprt_sigreturn_stub)-8),TSysParam(8));
  227. {$else cpusparc}
  228. {$ifdef NEED_USER_TRAMPOLINE}
  229. if new_action <> nil then
  230. begin
  231. // a different stack (SA_ONSTACK) requires sa_restorer field
  232. if (new_action^.sa_flags and (SA_RESTORER or SA_ONSTACK)) = 0 then
  233. begin
  234. new_action^.sa_flags := new_action^.sa_flags or SA_RESTORER;
  235. {$ifdef NEED_USER_TRAMPOLINE_RT_DIFFERENT}
  236. if (new_action^.sa_flags and SA_SIGINFO) <> 0 then
  237. new_action^.sa_restorer := @linux_restore_rt
  238. else
  239. {$endif}
  240. new_action^.sa_restorer := @linux_restore;
  241. end;
  242. end;
  243. {$endif}
  244. Fpsigaction:=do_syscall(syscall_nr_rt_sigaction,TSysParam(sig),TSysParam(new_action),TSysParam(old_action),TSysParam(8));
  245. {$endif cpusparc}
  246. end;
  247. function Fpftruncate(fd : cint; flength : off_t): cint; [public, alias : 'FPC_SYSC_FTRUNCATE'];
  248. { See notes lseek. This one is completely similar for the parameter (but
  249. doesn't have the returnvalue 64-bit problem)}
  250. begin
  251. {$if defined(cpu64)}
  252. Fpftruncate:=Do_syscall(syscall_nr_ftruncate,TSysParam(fd),TSysParam(flength));
  253. {$else}
  254. Fpftruncate:=Do_syscall(syscall_nr_ftruncate64,TSysParam(fd),
  255. {$ifdef FPC_ABI_EABI} 0, { align parameters as required with dummy } {$endif FPC_ABI_EABI}
  256. {$ifdef FPC_BIG_ENDIAN} tsysparam(hi(flength)),tsysparam(lo(flength)),{$endif}
  257. {$ifdef FPC_LITTLE_ENDIAN} tsysparam(lo(flength)),tsysparam(hi(flength)){$endif}
  258. );
  259. {$endif}
  260. end;
  261. function Fpfstat(fd : cint; var sb : stat): cint; [public, alias : 'FPC_SYSC_FSTAT'];
  262. begin
  263. {$if defined(cpu64)}
  264. FpFStat:=do_SysCall(syscall_nr_fstat,TSysParam(fd),TSysParam(@sb));
  265. {$else}
  266. FpFStat:=do_SysCall(syscall_nr_fstat64,TSysParam(fd),TSysParam(@sb));
  267. {$endif}
  268. end;
  269. {$ifndef FPC_SYSTEM_HAS_FPFORK}
  270. function Fpfork : pid_t; [public, alias : 'FPC_SYSC_FORK'];
  271. {
  272. This function issues the 'fork' System call. the program is duplicated in memory
  273. and Execution continues in parent and child process.
  274. In the parent process, fork returns the PID of the child. In the child process,
  275. zero is returned.
  276. A negative value indicates that an error has occurred, the error is returned in
  277. LinuxError.
  278. }
  279. Begin
  280. Fpfork:=Do_syscall(SysCall_nr_fork);
  281. End;
  282. {$endif FPC_SYSTEM_HAS_FPFORK}
  283. // Look at execve variants later, when overloaded is determined.
  284. {
  285. function Fpexecve(path : pathstr; argv : ppchar; envp: ppchar): cint;
  286. }
  287. {
  288. Replaces the current program by the program specified in path,
  289. arguments in args are passed to Execve.
  290. environment specified in ep is passed on.
  291. }
  292. {
  293. Begin
  294. path:=path+#0;
  295. do_syscall(syscall_nr_Execve,TSysParam(@path[1]),TSysParam(Argv),TSysParam(envp));
  296. End;
  297. }
  298. {
  299. function Fpexecve(path : pchar; argv : ppchar; envp: ppchar): cint; [public, alias : 'FPC_SYSC_EXECVE'];
  300. }
  301. {
  302. Replaces the current program by the program specified in path,
  303. arguments in args are passed to Execve.
  304. environment specified in ep is passed on.
  305. }
  306. {
  307. Begin
  308. do_syscall(syscall_nr_Execve,TSysParam(path),TSysParam(Argv),TSysParam(envp));
  309. End;
  310. }
  311. {$ifdef CPUARM}
  312. {$define WAIT4}
  313. {$endif CPUARM}
  314. {$ifdef CPUx86_64}
  315. {$define WAIT4}
  316. {$endif CPUx86_64}
  317. {$ifdef CPUSPARC}
  318. {$define WAIT4}
  319. {$endif CPUSPARC}
  320. function Fpwaitpid(pid : pid_t; stat_loc : pcint; options: cint): pid_t; [public, alias : 'FPC_SYSC_WAITPID'];
  321. {
  322. Waits until a child with PID Pid exits, or returns if it is exited already.
  323. Any resources used by the child are freed.
  324. The exit status is reported in the adress referred to by Status. It should
  325. be a longint.
  326. }
  327. begin
  328. {$ifdef WAIT4}
  329. FpWaitPID:=do_syscall(syscall_nr_Wait4,PID,TSysParam(Stat_loc),options,0);
  330. {$else WAIT4}
  331. FpWaitPID:=do_syscall(syscall_nr_WaitPID,PID,TSysParam(Stat_loc),options);
  332. {$endif WAIT4}
  333. end;
  334. function Fpaccess(pathname : pchar; amode : cint): cint; [public, alias : 'FPC_SYSC_ACCESS'];
  335. {
  336. Test users access rights on the specified file.
  337. Mode is a mask xosisting of one or more of R_OK, W_OK, X_OK, F_OK.
  338. R,W,X stand for read,write and Execute access, simultaneously.
  339. F_OK checks whether the test would be allowed on the file.
  340. i.e. It checks the search permissions in all directory components
  341. of the path.
  342. The test is done with the real user-ID, instead of the effective.
  343. If access is denied, or an error occurred, false is returned.
  344. If access is granted, true is returned.
  345. Errors other than no access,are reported in unixerror.
  346. }
  347. begin
  348. FpAccess:=do_syscall(syscall_nr_access,TSysParam(pathname),amode);
  349. end;
  350. (* overloaded
  351. function Fpaccess(pathname : pathstr; amode : cint): cint;
  352. {
  353. Test users access rights on the specified file.
  354. Mode is a mask xosisting of one or more of R_OK, W_OK, X_OK, F_OK.
  355. R,W,X stand for read,write and Execute access, simultaneously.
  356. F_OK checks whether the test would be allowed on the file.
  357. i.e. It checks the search permissions in all directory components
  358. of the path.
  359. The test is done with the real user-ID, instead of the effective.
  360. If access is denied, or an error occurred, false is returned.
  361. If access is granted, true is returned.
  362. Errors other than no access,are reported in unixerror.
  363. }
  364. begin
  365. pathname:=pathname+#0;
  366. Access:=do_syscall(syscall_nr_access, TSysParam(@pathname[1]),mode)=0;
  367. end;
  368. *)
  369. Function FpDup(fildes:cint):cint; [public, alias : 'FPC_SYSC_DUP'];
  370. begin
  371. Fpdup:=Do_syscall(syscall_nr_dup,TSysParam(fildes));
  372. end;
  373. Function FpDup2(fildes,fildes2:cint):cint; [public, alias : 'FPC_SYSC_DUP2'];
  374. begin
  375. Fpdup2:=do_syscall(syscall_nr_dup2,TSysParam(fildes),TSysParam(fildes2));
  376. end;
  377. type
  378. tmmapargs = packed record
  379. address : TSysParam;
  380. size : TSysParam;
  381. prot : TSysParam;
  382. flags : TSysParam;
  383. fd : TSysParam;
  384. offset : TSysParam;
  385. end;
  386. {$ifdef cpui386}
  387. {$define OLDMMAP}
  388. {$endif cpui386}
  389. {$ifdef cpum68k}
  390. {$define OLDMMAP}
  391. {$endif cpum68k}
  392. {$ifdef cpuarm}
  393. {$define OLDMMAP}
  394. {$endif cpuarm}
  395. Function Fpmmap(adr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;off:off_t):pointer; [public, alias : 'FPC_SYSC_MMAP'];
  396. // OFF_T procedure, and returns a pointer, NOT cint.
  397. {$ifdef OLDMMAP}
  398. var
  399. mmapargs : tmmapargs;
  400. begin
  401. mmapargs.address:=TSysParam(adr);
  402. mmapargs.size:=TSysParam(len);
  403. mmapargs.prot:=TSysParam(prot);
  404. mmapargs.flags:=TSysParam(flags);
  405. mmapargs.fd:=TSysParam(fd);
  406. mmapargs.offset:=TSysParam(off);
  407. Fpmmap:=pointer(do_syscall(syscall_nr_mmap,TSysParam(@MMapArgs)));
  408. end;
  409. {$else OLDMMAP}
  410. begin
  411. {$message warning need mmap64 syscall, hi(off) not used}
  412. Fpmmap:= pointer(do_syscall(syscall_nr_mmap,TSysParam(adr),TSysParam(len),
  413. TSysParam(prot),TSysParam(flags),TSysParam(fd),TSysParam(lo(off))));
  414. end;
  415. {$endif OLDMMAP}
  416. Function Fpmunmap(adr:pointer;len:size_t):cint; [public, alias :'FPC_SYSC_MUNMAP'];
  417. begin
  418. Fpmunmap:=do_syscall(syscall_nr_munmap,TSysParam(Adr),TSysParam(Len));
  419. end;
  420. {
  421. Interface to Unix ioctl call.
  422. Performs various operations on the filedescriptor Handle.
  423. Ndx describes the operation to perform.
  424. Data points to data needed for the Ndx function. The structure of this
  425. data is function-dependent.
  426. }
  427. // prototype is cint __P(cint,culong,....)
  428. // actual meaning of return value depends on request.
  429. Function FpIOCtl(fd:cint;request:TIOCtlRequest;Data: Pointer):cint; [public, alias : 'FPC_SYSC_IOCTL'];
  430. // This was missing here, instead hardcoded in Do_IsDevice
  431. begin
  432. FpIOCtl:=do_SysCall(syscall_nr_ioctl,tsysparam(fd),tsysparam(Request),TSysParam(data));
  433. end;
  434. Function FpGetPid:pid_t; [public, alias : 'FPC_SYSC_GETPID'];
  435. {
  436. Get Process ID.
  437. }
  438. begin
  439. FpGetPID:=do_syscall(syscall_nr_getpid);
  440. end;
  441. Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint; [public, alias : 'FPC_SYSC_READLINK'];
  442. begin
  443. Fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
  444. end;
  445. function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint; [public, alias : 'FPC_SYSC_SIGPROCMASK'];
  446. {
  447. Change the list of currently blocked signals.
  448. How determines which signals will be blocked :
  449. SigBlock : Add SSet to the current list of blocked signals
  450. SigUnBlock : Remove the signals in SSet from the list of blocked signals.
  451. SigSetMask : Set the list of blocked signals to SSet
  452. if OldSSet is non-null, the old set will be saved there.
  453. }
  454. begin
  455. FPsigprocmask:=do_syscall(syscall_nr_rt_sigprocmask,TSysParam(how),TSysParam(nset),TSysParam(oset),TSysParam(8));
  456. end;
  457. Function FpNanoSleep(req : ptimespec;rem : ptimespec):cint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
  458. begin
  459. FpNanoSleep:=Do_SysCall(syscall_nr_nanosleep,TSysParam(req),TSysParam(rem));
  460. end;
  461. function fpgetcwd(path : pchar; siz:tsize):pchar; [public, alias : 'FPC_SYSC_GETCWD'];
  462. begin
  463. fpgetcwd:=pchar(Do_Syscall(Syscall_nr_getcwd,TSysParam(Path),TSysParam(siz)));
  464. end;
  465. function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; [public, alias: 'FPC_SYSC_GETTIMEOFDAY'];
  466. begin
  467. fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
  468. end;
  469. function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt;
  470. begin
  471. FpGetRLimit := do_syscall(syscall_nr_getrlimit,
  472. TSysParam(resource), TSysParam(rlim));
  473. end;
  474. {$ifdef HAS_UGETRLIMIT}
  475. function fpugetrlimit(resource : cInt; rlim : PRLimit) : cInt;
  476. begin
  477. FpUGetRLimit := do_syscall(syscall_nr_ugetrlimit,
  478. TSysParam(resource), TSysParam(rlim));
  479. end;
  480. {$endif}
  481. {$if defined(cpupowerpc)}
  482. { fpprctl() call }
  483. function fpprctl(option : cint; const arg : ptruint) : cint;
  484. begin
  485. fpprctl := do_syscall(syscall_nr_prctl, option, arg);
  486. end;
  487. {$endif}