unixsysc.inc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2000 by Marco van de Voort
  5. member of the Free Pascal development team.
  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. Function Fork:longint;
  13. {
  14. This function issues the 'fork' System call. the program is duplicated in memory
  15. and Execution continues in parent and child process.
  16. In the parent process, fork returns the PID of the child. In the child process,
  17. zero is returned.
  18. A negative value indicates that an error has occurred, the error is returned in
  19. LinuxError.
  20. }
  21. Begin
  22. fork:=Do_syscall(SysCall_nr_fork);
  23. LinuxError:=ErrNo;
  24. End;
  25. (*
  26. function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
  27. {NOT IMPLEMENTED YET UNDER BSD}
  28. begin // perhaps it is better to implement the hack from solaris then this msg
  29. HALT;
  30. END;
  31. if (pointer(func)=nil) or (sp=nil) then
  32. begin
  33. LinuxError:=ESysEInval;
  34. exit(-1);
  35. end;
  36. asm
  37. { Insert the argument onto the new stack. }
  38. movl sp,%ecx
  39. subl $8,%ecx
  40. movl args,%eax
  41. movl %eax,4(%ecx)
  42. { Save the function pointer as the zeroth argument.
  43. It will be popped off in the child in the ebx frobbing below. }
  44. movl func,%eax
  45. movl %eax,0(%ecx)
  46. { Do the system call }
  47. pushl %ebx
  48. pushl %ebx
  49. // movl flags,%ebx
  50. movl $251,%eax
  51. int $0x80
  52. popl %ebx
  53. popl %ebx
  54. test %eax,%eax
  55. jnz .Lclone_end
  56. { We're in the new thread }
  57. subl %ebp,%ebp { terminate the stack frame }
  58. call *%ebx
  59. { exit process }
  60. movl %eax,%ebx
  61. movl $1,%eax
  62. int $0x80
  63. .Lclone_end:
  64. movl %eax,__RESULT
  65. end;
  66. end;
  67. *)
  68. Procedure Execve(path:pathstr;args:ppchar;ep:ppchar);
  69. {
  70. Replaces the current program by the program specified in path,
  71. arguments in args are passed to Execve.
  72. environment specified in ep is passed on.
  73. }
  74. Begin
  75. path:=path+#0;
  76. do_syscall(syscall_nr_Execve,longint(@path[1]),longint(Args),longint(ep));
  77. LinuxError:=ErrNo;
  78. End;
  79. Function Umask(Mask:Integer):integer;
  80. {
  81. Sets file creation mask to (Mask and 0777 (octal) ), and returns the
  82. previous value.
  83. }
  84. begin
  85. UMask:=Do_syscall(syscall_nr_umask,mask);
  86. LinuxError:=0;
  87. end;
  88. Procedure Nice(N:integer);
  89. {
  90. Set process priority. A positive N means a lower priority.
  91. A negative N decreases priority.
  92. Doesn't exist in BSD. Linux emu uses setpriority in a construct as below:
  93. }
  94. begin
  95. SetPriority(Prio_Process,0,N);
  96. end;
  97. Procedure Execve(path:pchar;args:ppchar;ep:ppchar);
  98. {
  99. Replaces the current program by the program specified in path,
  100. arguments in args are passed to Execve.
  101. environment specified in ep is passed on.
  102. }
  103. {
  104. Replaces the current program by the program specified in path,
  105. arguments in args are passed to Execve.
  106. environment specified in ep is passed on.
  107. }
  108. Begin
  109. do_syscall(syscall_nr_Execve,longint(path),longint(Args),longint(ep));
  110. LinuxError:=ErrNo;
  111. End;
  112. Procedure ExitProcess(val:longint);
  113. begin
  114. do_syscall(Syscall_nr_exit,val);
  115. LinuxError:=ErrNo;
  116. end;
  117. Function WaitPid(Pid:longint;Status:pointer;Options:longint):Longint;
  118. {
  119. Waits until a child with PID Pid exits, or returns if it is exited already.
  120. Any resources used by the child are freed.
  121. The exit status is reported in the adress referred to by Status. It should
  122. be a longint.
  123. }
  124. begin
  125. WaitPID:=do_syscall(syscall_nr_WaitPID,PID,longint(Status),options,0);
  126. LinuxError:=ErrNo;
  127. end;
  128. Function GetPriority(Which,Who:longint):longint;
  129. {
  130. Get Priority of process, process group, or user.
  131. Which : selects what kind of priority is used.
  132. can be one of the following predefined Constants :
  133. Prio_User.
  134. Prio_PGrp.
  135. Prio_Process.
  136. Who : depending on which, this is , respectively :
  137. Uid
  138. Pid
  139. Process Group id
  140. Errors are reported in linuxerror _only_. (priority can be negative)
  141. }
  142. begin
  143. errno:=0;
  144. if (which<prio_process) or (which>prio_user) then
  145. begin
  146. { We can save an interrupt here }
  147. getpriority:=0;
  148. linuxerror:=ESyseinval;
  149. end
  150. else
  151. begin
  152. GetPriority:=do_syscall(syscall_nr_GetPriority,which,who);
  153. LinuxError:=ErrNo;
  154. end;
  155. end;
  156. Procedure SetPriority(Which,Who,What:longint);
  157. {
  158. Set Priority of process, process group, or user.
  159. Which : selects what kind of priority is used.
  160. can be one of the following predefined Constants :
  161. Prio_User.
  162. Prio_PGrp.
  163. Prio_Process.
  164. Who : depending on value of which, this is, respectively :
  165. Uid
  166. Pid
  167. Process Group id
  168. what : A number between -20 and 20. -20 is most favorable, 20 least.
  169. 0 is the default.
  170. }
  171. begin
  172. errno:=0;
  173. if ((which<prio_process) or (which>prio_user)) or ((what<-20) or (what>20)) then
  174. linuxerror:=ESyseinval { We can save an interrupt here }
  175. else
  176. begin
  177. do_syscall(Syscall_nr_Setpriority,which,who,what);
  178. LinuxError:=ErrNo;
  179. end;
  180. end;
  181. Function GetPid:LongInt;
  182. {
  183. Get Process ID.
  184. }
  185. begin
  186. GetPID:=do_syscall(Syscall_nr_GetPID);
  187. LinuxError:=errno;
  188. end;
  189. Function GetPPid:LongInt;
  190. {
  191. Get Process ID of parent process.
  192. }
  193. begin
  194. GetPPid:=do_syscall(Syscall_nr_GetPPid);
  195. LinuxError:=errno;
  196. end;
  197. Function GetUid:Longint;
  198. {
  199. Get User ID.
  200. }
  201. begin
  202. GetUID:=do_syscall(Syscall_nr_GetUID);
  203. LinuxError:=ErrNo;
  204. end;
  205. Function GetEUid:Longint;
  206. {
  207. Get _effective_ User ID.
  208. }
  209. begin
  210. GetEUID:=do_syscall(Syscall_nr_GetEUID);
  211. LinuxError:=ErrNo;
  212. end;
  213. Function GetGid:Longint;
  214. {
  215. Get Group ID.
  216. }
  217. begin
  218. GetGID:=do_syscall(Syscall_nr_getgid);
  219. LinuxError:=ErrNo;
  220. end;
  221. Function GetEGid:Longint;
  222. {
  223. Get _effective_ Group ID.
  224. }
  225. begin
  226. GetEGID:=do_syscall(syscall_nr_getegid);
  227. LinuxError:=ErrNo;
  228. end;
  229. Procedure GetTimeOfDay(var tv:timeval);
  230. {
  231. Get the number of seconds since 00:00, January 1 1970, GMT
  232. the time NOT corrected any way
  233. }
  234. var tz : timezone;
  235. begin
  236. do_syscall(syscall_nr_gettimeofday,longint(@tv),longint(@tz));
  237. LinuxError:=Errno;
  238. end;
  239. Function GetTimeOfDay: longint;
  240. {
  241. Get the number of seconds since 00:00, January 1 1970, GMT
  242. the time NOT corrected any way
  243. }
  244. begin
  245. GetTimeOfDay:=Sys_time;
  246. LinuxError:=Errno;
  247. end;
  248. Function fdTruncate(fd,size:longint):boolean;
  249. begin
  250. fdtruncate:=do_syscall(syscall_nr_ftruncate,fd,size,0)=0;
  251. LinuxError:=Errno;
  252. end;
  253. Function fdFlush (fd : Longint) : Boolean;
  254. begin
  255. fdflush:=do_syscall(syscall_nr_fsync,fd)=0;
  256. LinuxError:=Errno;
  257. end;
  258. {$ifndef newreaddir}
  259. function sys_fcntl(Fd:longint;Cmd:longint;Arg:Longint):longint;
  260. begin
  261. sys_fcntl:=do_syscall(syscall_nr_fcntl,fd,cmd,arg);
  262. LinuxError:=Errno;
  263. end;
  264. {$endif}
  265. Function Chmod(path:pathstr;Newmode:longint):Boolean;
  266. {
  267. Changes the permissions of a file.
  268. }
  269. begin
  270. path:=path+#0;
  271. chmod:=do_syscall(syscall_nr_chmod,longint(@path[1]),newmode)=0;
  272. LinuxError:=Errno;
  273. end;
  274. Function Chown(path:pathstr;NewUid,NewGid:longint):boolean;
  275. {
  276. Change the owner and group of a file.
  277. A user can only change the group to a group of which he is a member.
  278. The super-user can change uid and gid of any file.
  279. }
  280. begin
  281. path:=path+#0;
  282. ChOwn:=do_syscall(syscall_nr_chown,longint(@path[1]),newuid,newgid)=0;
  283. LinuxError:=Errno;
  284. end;
  285. Function Utime(path:pathstr;utim:utimebuf):boolean;
  286. begin
  287. UTime:=do_syscall(syscall_nr_utimes,longint(@path[1]),longint(@utim))=0;
  288. LinuxError:=Errno;
  289. end;
  290. Function Flock (fd,mode : longint) : boolean;
  291. begin
  292. Flock:=do_syscall(syscall_nr_flock,fd,mode)=0;
  293. LinuxError:=Errno;
  294. end;
  295. Function Lstat(Filename: PathStr;var Info:stat):Boolean;
  296. {
  297. Get all information on a link (the link itself), and return it in info.
  298. }
  299. begin
  300. FileName:=FileName+#0;
  301. LStat:=do_syscall(syscall_nr_lstat,longint(@filename[1]),longint(@info))=0;
  302. LinuxError:=Errno;
  303. end;
  304. Function Fstat(Fd:Longint;var Info:stat):Boolean;
  305. {
  306. Get all information on a file descriptor, and return it in info.
  307. }
  308. begin
  309. FStat:=do_syscall(syscall_nr_fstat,fd,longint(@info))=0;
  310. LinuxError:=Errno;
  311. end;
  312. Function StatFs(Path:Pathstr;Var Info:tstatfs):Boolean;
  313. {
  314. Get all information on a fileSystem, and return it in Info.
  315. Path is the name of a file/directory on the fileSystem you wish to
  316. investigate.
  317. }
  318. begin
  319. path:=path+#0;
  320. StatFS:=Do_Syscall(syscall_nr_statfs,longint(@path[1]),longint(@info))=0;
  321. LinuxError:=Errno;
  322. end;
  323. Function StatFS(Fd:Longint;Var Info:tstatfs):Boolean;
  324. {
  325. Get all information on a fileSystem, and return it in Info.
  326. Fd is the file descriptor of a file/directory on the fileSystem
  327. you wish to investigate.
  328. }
  329. begin
  330. StatFS:=do_syscall(syscall_nr_fstatfs,fd,longint(@info))=0;
  331. LinuxError:=Errno;
  332. end;
  333. Function Link(OldPath,NewPath:pathstr):boolean;
  334. {
  335. Proceduces a hard link from new to old.
  336. In effect, new will be the same file as old.
  337. }
  338. begin
  339. oldpath:=oldpath+#0;
  340. newpath:=newpath+#0;
  341. Link:=Do_Syscall(syscall_nr_link,longint(@oldpath[1]),longint(@newpath[1]))=0;
  342. LinuxError:=Errno;
  343. end;
  344. (*
  345. Function SymLink(OldPath,newPath:pathstr):boolean;
  346. {
  347. Proceduces a soft link from new to old.
  348. }
  349. begin
  350. oldpath:=oldpath+#0;
  351. newpath:=newpath+#0;
  352. SymLink:=Do_Syscall(syscall_nr_symlink,longint(@oldpath[1]),longint(@newpath[1]))=0;
  353. LinuxError:=Errno;
  354. end;
  355. *)
  356. Function Access(Path:Pathstr ;mode:longint):boolean;
  357. {
  358. Test users access rights on the specified file.
  359. Mode is a mask xosisting of one or more of R_OK, W_OK, X_OK, F_OK.
  360. R,W,X stand for read,write and Execute access, simultaneously.
  361. F_OK checks whether the test would be allowed on the file.
  362. i.e. It checks the search permissions in all directory components
  363. of the path.
  364. The test is done with the real user-ID, instead of the effective.
  365. If access is denied, or an error occurred, false is returned.
  366. If access is granted, true is returned.
  367. Errors other than no access,are reported in linuxerror.
  368. }
  369. begin
  370. path:=path+#0;
  371. Access:=do_syscall(syscall_nr_access,longint(@path[1]),mode)=0;
  372. LinuxError:=Errno;
  373. end;
  374. Function Dup(oldfile:longint;var newfile:longint):Boolean;
  375. {
  376. Copies the filedescriptor oldfile to newfile
  377. }
  378. begin
  379. newfile:=Do_syscall(syscall_nr_dup,oldfile);
  380. LinuxError:=Errno;
  381. Dup:=(LinuxError=0);
  382. end;
  383. Function Dup2(oldfile,newfile:longint):Boolean;
  384. {
  385. Copies the filedescriptor oldfile to newfile
  386. }
  387. begin
  388. do_syscall(syscall_nr_dup2,oldfile,newfile);
  389. LinuxError:=Errno;
  390. Dup2:=(LinuxError=0);
  391. end;
  392. Function Select(N:longint;readfds,writefds,exceptfds:PFDSet;TimeOut:PTimeVal):longint;
  393. {
  394. Select checks whether the file descriptor sets in readfs/writefs/exceptfs
  395. have changed.
  396. }
  397. begin
  398. Select:=do_syscall(syscall_nr_select,n,longint(readfds),longint(writefds),longint(exceptfds),longint(timeout));
  399. LinuxError:=Errno;
  400. end;
  401. Function AssignPipe(var pipe_in,pipe_out:longint):boolean;
  402. {
  403. Sets up a pair of file variables, which act as a pipe. The first one can
  404. be read from, the second one can be written to.
  405. If the operation was unsuccesful, linuxerror is set.
  406. }
  407. var
  408. pip : tpipe;
  409. begin
  410. do_syscall(syscall_nr_pipe,longint(@pip));
  411. LinuxError:=Errno;
  412. pipe_in:=pip[1];
  413. pipe_out:=pip[2];
  414. AssignPipe:=(LinuxError=0);
  415. end;
  416. Function PClose(Var F:text) :longint;
  417. var
  418. pl : ^longint;
  419. res : longint;
  420. begin
  421. do_syscall(syscall_nr_close,Textrec(F).Handle);
  422. { closed our side, Now wait for the other - this appears to be needed ?? }
  423. pl:=@(textrec(f).userdata[2]);
  424. waitpid(pl^,@res,0);
  425. pclose:=res shr 8;
  426. end;
  427. Function PClose(Var F:file) : longint;
  428. var
  429. pl : ^longint;
  430. res : longint;
  431. begin
  432. do_syscall(syscall_nr_close,filerec(F).Handle);
  433. { closed our side, Now wait for the other - this appears to be needed ?? }
  434. pl:=@(filerec(f).userdata[2]);
  435. waitpid(pl^,@res,0);
  436. pclose:=res shr 8;
  437. end;
  438. Function mkFifo(pathname:string;mode:longint):boolean;
  439. begin
  440. pathname:=pathname+#0;
  441. mkfifo:=do_syscall(syscall_nr_mknod,longint(@pathname[1]),mode or STAT_IFIFO,0)=0;
  442. LinuxError:=Errno;
  443. end;
  444. Function Kill(Pid:longint;Sig:longint):integer;
  445. {
  446. Send signal 'sig' to a process, or a group of processes.
  447. If Pid > 0 then the signal is sent to pid
  448. pid=-1 to all processes except process 1
  449. pid < -1 to process group -pid
  450. Return value is zero, except for case three, where the return value
  451. is the number of processes to which the signal was sent.
  452. }
  453. begin
  454. kill:=do_syscall(syscall_nr_kill,pid,sig);
  455. if kill<0 THEN
  456. Kill:=0;
  457. LinuxError:=Errno;
  458. end;
  459. Procedure SigProcMask(How:longint;SSet,OldSSet:PSigSet);
  460. {
  461. Change the list of currently blocked signals.
  462. How determines which signals will be blocked :
  463. SigBlock : Add SSet to the current list of blocked signals
  464. SigUnBlock : Remove the signals in SSet from the list of blocked signals.
  465. SigSetMask : Set the list of blocked signals to SSet
  466. if OldSSet is non-null, the old set will be saved there.
  467. }
  468. begin
  469. do_syscall(syscall_nr_sigprocmask,longint(how),longint(sset),longint(oldsset));
  470. LinuxError:=Errno;
  471. end;
  472. Function SigPending:SigSet;
  473. {
  474. Allows examination of pending signals. The signal mask of pending
  475. signals is set in SSet
  476. }
  477. Var
  478. dummy : Sigset;
  479. begin
  480. do_syscall(syscall_nr_sigpending,longint(@dummy));
  481. LinuxError:=Errno;
  482. sigpending:=dummy;
  483. end;
  484. Procedure SigSuspend(Mask:Sigset);
  485. {
  486. Set the signal mask with Mask, and suspend the program until a signal
  487. is received.
  488. }
  489. begin
  490. do_syscall(syscall_nr_sigsuspend,longint(@mask));
  491. LinuxError:=Errno;
  492. end;
  493. Function NanoSleep(const req : timespec;var rem : timespec) : longint;
  494. begin
  495. NanoSleep:=Do_SysCall(syscall_nr_nanosleep,longint(@req),longint(@rem));
  496. LinuxError:=Errno;
  497. end;
  498. Function IOCtl(Handle,Ndx: Longint;Data: Pointer):boolean;
  499. {
  500. Interface to Unix ioctl call.
  501. Performs various operations on the filedescriptor Handle.
  502. Ndx describes the operation to perform.
  503. Data points to data needed for the Ndx function. The structure of this
  504. data is function-dependent.
  505. }
  506. begin
  507. IOCtl:=Do_Syscall(syscall_nr_ioctl,handle,ndx,longint(data))=0;
  508. LinuxError:=Errno;
  509. end;
  510. function MMap(const m:tmmapargs):longint;
  511. begin
  512. {Last argument (offset) is actually 64-bit under BSD. Therefore extra 0}
  513. MMap:=fpmmap(m.address,m.size,m.prot,m.flags,m.fd,m.offset);
  514. LinuxError:=Errno;
  515. end;
  516. function MUnMap (P : Pointer; Size : Longint) : Boolean;
  517. begin
  518. MUnMap:=do_syscall(syscall_nr_munmap,longint(P),Size)=0;
  519. LinuxError:=Errno;
  520. end;
  521. function signal(signum:longint;Handler:signalhandler):signalhandler;
  522. var sa,osa : sigactionrec;
  523. begin
  524. sa.sa_handler:=handler;
  525. FillChar(sa.sa_mask,sizeof(sigset),#0);
  526. sa.sa_flags := 0;
  527. (*
  528. if (sigintr and signum) =0 then
  529. {restart behaviour needs libc}
  530. sa.sa_flags :=sa.sa_flags or SA_RESTART;
  531. *)
  532. sigaction(signum,@sa,@osa);
  533. if ErrNo<>0 then
  534. signal:=NIL
  535. else
  536. signal:=osa.sa_handler;
  537. LinuxError:=Errno;
  538. end;
  539. function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
  540. {$ifndef FPC_HAS_NO_SYSCALL_NR_RFORK}
  541. assembler;
  542. asm
  543. pushl %esi
  544. movl 12(%ebp), %esi // get stack addr
  545. subl $4, %esi
  546. movl 20(%ebp), %eax // get __arg
  547. movl %eax, (%esi)
  548. subl $4, %esi
  549. movl 8(%ebp), %eax // get __fn
  550. movl %eax, (%esi)
  551. pushl 16(%ebp)
  552. pushl %esi
  553. mov syscall_nr_rfork, %eax
  554. int $0x80 // call actualsyscall
  555. jb .L2
  556. test %edx, %edx
  557. jz .L1
  558. movl %esi,%esp
  559. popl %eax
  560. call %eax
  561. addl $8, %esp
  562. call halt // Does not return
  563. .L2:
  564. mov %eax,ErrNo
  565. mov $-1,%eax
  566. jmp .L1
  567. // jmp PIC_PLT(HIDENAME(cerror))
  568. .L1:
  569. addl $8, %esp
  570. popl %esi
  571. end;
  572. {$else FPC_HAS_NO_SYSCALL_NR_RFORK}
  573. begin
  574. RunError(218);
  575. Clone:=-1;
  576. end;
  577. {$endif FPC_HAS_NO_SYSCALL_NR_RFORK}
  578. {$packrecords C}
  579. TYPE uint=CARDINAL;
  580. CONST
  581. I386_GET_LDT =0;
  582. I386_SET_LDT =1;
  583. { I386_IOPL }
  584. I386_GET_IOPERM =3;
  585. I386_SET_IOPERM =4;
  586. { xxxxx }
  587. I386_VM86 =6;
  588. {
  589. type i386_ldt_args = record
  590. int start : longint;
  591. union descriptor *descs;
  592. int num;
  593. end;
  594. }
  595. type
  596. i386_ioperm_args = record
  597. start : uint;
  598. length : uint;
  599. enable : longint;
  600. end;
  601. i386_vm86_args = record
  602. sub_op : longint; { sub-operation to perform }
  603. sub_args : pchar; { args }
  604. end;
  605. sysarch_args = record
  606. op : longint;
  607. parms : pchar;
  608. end;
  609. {
  610. int i386_get_ldt __P((int, union descriptor *, int));
  611. int i386_set_ldt __P((int, union descriptor *, int));
  612. int i386_get_ioperm __P((unsigned int, unsigned int *, int *));
  613. int i386_set_ioperm __P((unsigned int, unsigned int, int));
  614. int i386_vm86 __P((int, void *));
  615. int i386_set_watch __P((int watchnum, unsigned int watchaddr, int size,
  616. int access, struct dbreg * d));
  617. int i386_clr_watch __P((int watchnum, struct dbreg * d));
  618. }
  619. Function IOPerm(From,Num:CARDINAL;Value:Longint):boolean;
  620. var sg : i386_ioperm_args;
  621. sa : sysarch_args;
  622. begin
  623. sg.start:=From;
  624. sg.length:=Num;
  625. sg.enable:=value;
  626. sa.op:=i386_SET_IOPERM;
  627. sa.parms:=@sg;
  628. IOPerm:=do_syscall(syscall_nr_sysarch,longint(@sa))=0;
  629. LinuxError:=ErrNo;
  630. end;
  631. {
  632. $Log$
  633. Revision 1.3 2003-05-31 16:57:22 marco
  634. * works via system unit call now, because of powerpc
  635. Revision 1.2 2003/01/21 15:39:45 marco
  636. * NetBSD first rtl. Still not 100%, but close
  637. Revision 1.1.2.3 2002/09/26 08:13:08 marco
  638. * Fix from Lazarus
  639. Revision 1.1.2.2 2002/09/20 07:04:15 pierre
  640. * avoid compiler warning and comment level 2 warning
  641. Revision 1.1.2.1 2001/08/10 11:07:17 pierre
  642. New NetBSD files taken and adapted from FreeBSD
  643. Revision 1.1.2.3 2001/06/02 00:25:30 peter
  644. * moved some unix files to target dependent dirs
  645. }