ossysc.inc 17 KB

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