oscdeclh.inc 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2001 by Free Pascal development team
  5. This file should become an alternative to the syscalls in due time,
  6. to import the base calls from libc.
  7. Be very careful though. Kernel types and libc types are often not the
  8. same on Linux.
  9. See the file COPYING.FPC, included in this distribution,
  10. for details about the copyright.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. ***********************************************************************}
  15. { var
  16. Errno : cint; external clib name 'errno';}
  17. Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
  18. pGrpArr = ^TGrpArr;
  19. TFilDes = Array [0..1] of cInt;
  20. pFilDes = ^TFilDes;
  21. function FpAccess (pathname : pchar; amode : cint): cint; cdecl; external clib name 'access';
  22. function FpChdir (path : pchar): cint; cdecl; external clib name 'chdir';
  23. function FpClose (fd : cint): cint; cdecl; external clib name 'close';
  24. Function FpClosedir (var dirp : Dir): cInt; cdecl; external clib name 'closedir';
  25. function FpClosedir (dirp : pdir): cint; cdecl; external clib name 'closedir';
  26. function FpDup (oldd:cint):cint; cdecl; external clib name 'dup';
  27. function FpDup2 (oldd:cint;newd:cint):cint; cdecl; external clib name 'dup2';
  28. function FpExecve (path : pchar; argv : ppchar; envp: ppchar): cint; cdecl; external clib name 'execve';
  29. function FpFork : TPid; cdecl; external clib name 'fork';
  30. function FpFstat (fd : cint; var sb : stat): cint; cdecl; external clib name 'fstat';
  31. function FpFtruncate(fd : cint; flength : TOff): cint; cdecl; external clib name 'ftruncate';
  32. function FpLseek (fd : cint; offset : TOff; whence : cint): TOff; cdecl; external clib name 'lseek';
  33. function FpMkdir (path : pchar; mode: TMode):cint; cdecl; external clib name 'mkdir';
  34. function FpOpen (path: pchar; flags : cint; mode: TMode):cint; cdecl; external clib name 'open';
  35. function FpOpendir (dirname : pchar): pdir; cdecl; external clib name 'opendir';
  36. function FpRead (fd: cint; buf: pchar; nbytes : TSize): TSSize; cdecl; external clib name 'read';
  37. function FpReaddir (dirp : pdir) : pdirent;cdecl; external clib name 'readdir';
  38. Function FpReaddir (var dirp : Dir) : pDirent;cdecl; external clib name 'readdir';
  39. function FpRename (old : pchar; newpath: pchar): cint; cdecl;external clib name 'rename';
  40. function FpRmdir (path : pchar): cint; cdecl; external clib name 'rmdir';
  41. function FpSigaction (sig: cint;var act : sigactionrec; var oact : sigactionrec): cint; cdecl; external clib name 'sigaction';
  42. Function FPSigaction (sig: cInt; act :pSigActionRec;oact:pSigActionRec):cint;cdecl; external clib name 'sigaction';
  43. Function FpChmod (path : pChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
  44. Function FPUtime(path:pchar;times:putimbuf):cint; cdecl; external clib name 'utime';
  45. {ifdef BSD}
  46. function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external clib name 'sigprocmask';
  47. function FPSigProcMask(how:cint;const nset : sigset;var oset : sigset):cint;cdecl; external clib name 'sigprocmask';
  48. {endif}
  49. function FpStat (path: pchar; var buf : stat): cint; cdecl; external clib name 'stat';
  50. // {$ifdef FPC_IS_SYSTEM}
  51. function FpTime (tloc:ptime_t): time_t; cdecl; external clib name 'time';
  52. // {$else}
  53. Function FpTime (var tloc : TTime): TTime; cdecl; external clib name 'time';
  54. // {$endif}
  55. function FpUname (var name: utsname): cint; cdecl; external clib name 'uname';
  56. function FpUnlink (path: pchar): cint; cdecl; external clib name 'unlink';
  57. function FpWaitpid (pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external clib name 'waitpid';
  58. function FpWrite (fd: cint;buf:pchar; nbytes : TSize): TSSize; cdecl; external clib name 'write';
  59. procedure FpExit (status : cint); cdecl; external clib name '_exit';
  60. function fpmmap (addr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;ofs:off_t):pointer; cdecl; external clib name 'mmap';
  61. function fpmunmap (addr:pointer;len:size_t):cint; cdecl; external clib name 'munmap';
  62. function FpIOCtl (Handle:cint;Ndx: culong;Data: Pointer):cint; cdecl; external clib name 'ioctl';
  63. Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external clib name 'select';
  64. function fpgetenv (name : pchar):pchar; cdecl; external clib name 'getenv';
  65. Function FpKill (pid : TPid; sig: cInt): cInt; cdecl; external clib name 'kill';
  66. Function FpGetpid : TPid; cdecl;external clib name 'getpid';
  67. Function FpGetppid : TPid;cdecl;external clib name 'getppid';
  68. Function FpGetuid : TUid;cdecl;external clib name 'getuid';
  69. Function FpGeteuid : TUid;cdecl;external clib name 'geteuid';
  70. Function FpGetgid : TGid;cdecl;external clib name 'getgid';
  71. Function FpGetegid : TGid;cdecl;external clib name 'getegid';
  72. Function FpSetuid (uid : TUid): cInt;cdecl;external clib name 'setuid';
  73. Function FpSetgid (gid : TGid): cInt;cdecl;external clib name 'setgid';
  74. Function FpGetgroups (gidsetsize : cInt; var grouplist : tgrparr):cint; cdecl;external clib name 'getgroups';
  75. Function FpGetpgrp : TPid; cdecl;external clib name 'getpgrp';
  76. Function FpSetsid : TPid; cdecl;external clib name 'setsid';
  77. Function FpPipe (var fildes : tfildes):cInt; cdecl;external clib name 'pipe';
  78. Function FpFcntl (fildes : cInt; cmd : cInt): cInt; cdecl; external clib name 'fcntl';
  79. Function FpFcntl (fildes : cInt; cmd : cInt; arg :cInt): cInt; cdecl; external clib name 'fcntl';
  80. Function FpFcntl (fildes : cInt; cmd : cInt; var arg : flock): cInt; cdecl external clib name 'fcntl';
  81. Function FPnanosleep (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
  82. Function fpLstat (path:pchar;Info:pstat):cint; cdecl; external clib name 'lstat';
  83. // function fpMUnMap (P : Pointer; Size : size_t) : cint; cdecl; external clib name 'munmap';
  84. function fpNice (N:cint):cint; cdecl; external clib name 'nice';
  85. Function fpGetPriority (Which,Who:cint):cint; cdecl; external clib name 'getpriority';
  86. Function fpSetPriority (Which,Who,What:cint):cint; cdecl; external clib name 'setpriority';
  87. Function fpSymlink (oldname,newname:pchar):cint; cdecl; external clib name 'symlink';
  88. Function fpReadLink (name,linkname:pchar;maxlen:size_t):cint; cdecl; external clib name 'readlink';
  89. function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'gettimeofday';
  90. {
  91. $Log$
  92. Revision 1.9 2004-11-14 12:21:08 marco
  93. * moved some calls from unix to baseunix. Darwin untested.
  94. Revision 1.8 2004/02/06 20:47:00 jonas
  95. + fpnanosleep for oscdeclh.inc
  96. - removed obsolete darwin remarks from bsd/ossysc.inc
  97. Revision 1.7 2004/01/12 23:43:22 marco
  98. * some semi colons added
  99. Revision 1.6 2004/01/04 21:05:01 jonas
  100. * declare C-library routines as external in libc so we generate proper
  101. import entries for Darwin
  102. Revision 1.5 2004/01/01 16:10:23 marco
  103. * fpreadlink(pathstr) moved to unxovl (since not platform specific),
  104. small fixes for "make all OPT='-dFPC_USE_LIBC'
  105. Revision 1.4 2004/01/01 14:09:14 marco
  106. * FPC_USE_LIBC fixes
  107. Revision 1.3 2003/12/30 15:43:20 marco
  108. * linux now compiles with FPC_USE_LIBC
  109. Revision 1.2 2003/12/30 12:24:01 marco
  110. * FPC_USE_LIBC
  111. Revision 1.1 2003/06/01 15:23:46 marco
  112. * Shared for now
  113. Revision 1.1 2002/12/18 16:43:26 marco
  114. * new unix rtl, linux part.....
  115. }