oscdeclh.inc 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 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 name 'access';
  22. function FpChdir (path : pchar): cint; cdecl; external name 'chdir';
  23. function FpClose (fd : cint): cint; cdecl; external name 'close';
  24. Function FpClosedir (var dirp : Dir): cInt; cdecl; external name 'closedir';
  25. function FpClosedir (dirp : pdir): cint; cdecl; external name 'closedir';
  26. function FpDup (oldd:cint):cint; cdecl; external name 'dup';
  27. function FpDup2 (oldd:cint;newd:cint):cint; cdecl; external name 'dup2';
  28. function FpExecve (path : pchar; argv : ppchar; envp: ppchar): cint; cdecl; external name 'execve';
  29. function FpFork : TPid; cdecl; external name 'fork';
  30. function FpFstat (fd : cint; var sb : stat): cint; cdecl; external name 'fstat';
  31. function FpFtruncate(fd : cint; flength : TOff): cint; cdecl; external name 'ftruncate';
  32. function FpLseek (fd : cint; offset : TOff; whence : cint): TOff; cdecl; external name 'lseek';
  33. function FpMkdir (path : pchar; mode: TMode):cint; cdecl; external name 'mkdir';
  34. function FpOpen (path: pchar; flags : cint; mode: TMode):cint; cdecl; external name 'open';
  35. function FpOpendir (dirname : pchar): pdir; cdecl; external name 'opendir';
  36. function FpRead (fd: cint; buf: pchar; nbytes : TSize): TSSize; cdecl; external name 'read';
  37. function FpReaddir (dirp : pdir) : pdirent;cdecl; external name 'readdir';
  38. Function FpReaddir (var dirp : Dir) : pDirent;cdecl; external name 'readdir';
  39. function FpRename (old : pchar; newpath: pchar): cint; cdecl;external name 'rename';
  40. function FpRmdir (path : pchar): cint; cdecl; external name 'rmdir';
  41. function FpSigaction (sig: cint;var act : sigactionrec; var oact : sigactionrec): cint; cdecl; external name 'sigaction';
  42. Function FPSigaction (sig: cInt; act :pSigActionRec;oact:pSigActionRec):cint;cdecl; external name 'sigaction';
  43. {$ifdef BSD}
  44. function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external name 'sigprocmask';
  45. {$endif}
  46. function FpStat (path: pchar; var buf : stat): cint; cdecl; external name 'stat';
  47. // {$ifdef FPC_IS_SYSTEM}
  48. function FpTime (tloc:ptime_t): time_t; cdecl; external name 'time';
  49. // {$else}
  50. Function FpTime (var tloc : TTime): TTime; cdecl; external name 'time';
  51. // {$endif}
  52. function FpUname (var name: utsname): cint; cdecl; external name 'uname';
  53. function FpUnlink (path: pchar): cint; cdecl; external name 'unlink';
  54. function FpWaitpid (pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external name 'waitpid';
  55. function FpWrite (fd: cint;buf:pchar; nbytes : TSize): TSSize; cdecl; external name 'write';
  56. procedure FpExit (status : cint); cdecl; external name '_exit';
  57. function fpmmap (addr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;ofs:off_t):pointer; cdecl; external name 'mmap';
  58. function FpIOCtl (Handle:cint;Ndx: culong;Data: Pointer):cint; cdecl; external name 'ioctl';
  59. Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external name 'select';
  60. function fpgetenv (name : pchar):pchar; cdecl; external name 'getenv';
  61. Function FpKill (pid : TPid; sig: cInt): cInt; cdecl; external name 'kill';
  62. Function FpGetpid : TPid; cdecl;external name 'getpid';
  63. Function FpGetppid : TPid;cdecl;external name 'getppid';
  64. Function FpGetuid : TUid;cdecl;external name 'getuid';
  65. Function FpGeteuid : TUid;cdecl;external name 'geteuid';
  66. Function FpGetgid : TGid;cdecl;external name 'getgid';
  67. Function FpGetegid : TGid;cdecl;external name 'getegid';
  68. Function FpSetuid (uid : TUid): cInt;cdecl;external name 'setuid';
  69. Function FpSetgid (gid : TGid): cInt;cdecl;external name 'setgid';
  70. Function FpGetgroups (gidsetsize : cInt; var grouplist : tgrparr):cint; cdecl;external name 'getgroups';
  71. Function FpGetpgrp : TPid; cdecl;external name 'getpgrp';
  72. Function FpSetsid : TPid; cdecl;external name 'setsid';
  73. Function FpPipe (var fildes : tfildes):cInt; cdecl;external name 'pipe';
  74. Function FpFcntl (fildes : cInt; cmd : cInt): cInt; cdecl external name 'fcntl';
  75. Function FpFcntl (fildes : cInt; cmd : cInt; arg :cInt): cInt; cdecl external name 'fcntl';
  76. Function FpFcntl (fildes : cInt; cmd : cInt; var arg : flock): cInt; cdecl external name 'fcntl';
  77. {
  78. $Log$
  79. Revision 1.5 2004-01-01 16:10:23 marco
  80. * fpreadlink(pathstr) moved to unxovl (since not platform specific),
  81. small fixes for "make all OPT='-dFPC_USE_LIBC'
  82. Revision 1.4 2004/01/01 14:09:14 marco
  83. * FPC_USE_LIBC fixes
  84. Revision 1.3 2003/12/30 15:43:20 marco
  85. * linux now compiles with FPC_USE_LIBC
  86. Revision 1.2 2003/12/30 12:24:01 marco
  87. * FPC_USE_LIBC
  88. Revision 1.1 2003/06/01 15:23:46 marco
  89. * Shared for now
  90. Revision 1.1 2002/12/18 16:43:26 marco
  91. * new unix rtl, linux part.....
  92. }