unxsysc.inc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2003 Marco van de Voort
  4. member of the Free Pascal development team.
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY;without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. (*
  12. function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
  13. {NOT IMPLEMENTED YET UNDER BSD}
  14. begin // perhaps it is better to implement the hack from solaris then this msg
  15. HALT;
  16. END;
  17. if (pointer(func)=nil) or (sp=nil) then
  18. begin
  19. Lfpseterrno(EsysEInval);
  20. exit(-1);
  21. end;
  22. asm
  23. { Insert the argument onto the new stack. }
  24. movl sp,%ecx
  25. subl $8,%ecx
  26. movl args,%eax
  27. movl %eax,4(%ecx)
  28. { Save the function pointer as the zeroth argument.
  29. It will be popped off in the child in the ebx frobbing below. }
  30. movl func,%eax
  31. movl %eax,0(%ecx)
  32. { Do the system call }
  33. pushl %ebx
  34. pushl %ebx
  35. // movl flags,%ebx
  36. movl $251,%eax
  37. int $0x80
  38. popl %ebx
  39. popl %ebx
  40. test %eax,%eax
  41. jnz .Lclone_end
  42. { We're in the new thread }
  43. subl %ebp,%ebp { terminate the stack frame }
  44. call *%ebx
  45. { exit process }
  46. movl %eax,%ebx
  47. movl $1,%eax
  48. int $0x80
  49. .Lclone_end:
  50. movl %eax,__RESULT
  51. end;
  52. end;
  53. *)
  54. Function fpfStatFS (Fd: cint; Info:pstatfs):cint;
  55. begin
  56. fpfstatfs:=do_SysCall(SysCall_nr_fstatfs,fd,TSysParam(info))
  57. end;
  58. Function fpStatFS (Path:pchar; Info:pstatfs):cint;
  59. begin
  60. fpstatfs:=do_SysCall(SysCall_nr_statfs,TSysParam(path),TSysParam(Info))
  61. end;
  62. Function fpfsync (fd : cint) : cint;
  63. begin
  64. fpfsync:=do_SysCall(syscall_nr_fsync, fd);
  65. end;
  66. Function fpFlock (fd,mode : longint) : cint;
  67. begin
  68. fpFlock:=do_syscall(syscall_nr_flock,fd,mode);
  69. end;
  70. function MUnMap (P : Pointer; Size : size_t) : cint;
  71. begin
  72. MUnMap:=do_syscall(syscall_nr_munmap,TSysParam(P),Size);
  73. end;