oscdecl.inc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2007 by the Free Pascal development team
  4. This file should become an alternative to the syscalls in due time,
  5. to import the base calls from libc.
  6. Be very careful though. Kernel types and libc types are often not the
  7. same on Linux.
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. ***********************************************************************}
  14. { ********************************************************************* }
  15. { fpioctl }
  16. { ********************************************************************* }
  17. function real_FpIOCtl (Handle:cint;Ndx: TIOCtlRequest):cint; cdecl; varargs; external clib name 'ioctl';
  18. function FpIOCtl (Handle:cint;Ndx: TIOCtlRequest;Data: Pointer):cint;
  19. begin
  20. FpIOCtl:=real_FpIOCtl(Handle, Ndx, Data);
  21. end;
  22. { ********************************************************************* }
  23. { fpfcntl }
  24. { ********************************************************************* }
  25. function real_FpFcntl (fildes : cInt; cmd : cInt): cInt; cdecl; varargs; external clib name 'fcntl';
  26. Function FpFcntl (fildes : cInt; cmd : cInt): cInt;
  27. begin
  28. FpFcntl:=real_FpFcntl(fildes, cmd);
  29. end;
  30. Function FpFcntl (fildes : cInt; cmd : cInt; arg :cInt): cInt;
  31. begin
  32. FpFcntl:=real_FpFcntl(fildes, cmd, arg);
  33. end;
  34. Function FpFcntl (fildes : cInt; cmd : cInt; var arg : flock): cInt;
  35. begin
  36. FpFcntl:=real_FpFcntl(fildes, cmd, @arg);
  37. end;
  38. { ********************************************************************* }
  39. { fpopen }
  40. { ********************************************************************* }
  41. function real_FpOpen(path: pchar; flags : cint):cint; varargs; cdecl; external clib name 'open'{$ifdef aix}+suffix64bit{$endif};
  42. function FpOpen (path: pchar; flags : cint; mode: TMode):cint;
  43. begin
  44. {$if defined(linux) and defined(fs32bit)}
  45. flags:=flags or O_LARGEFILE;
  46. {$endif}
  47. { emulate what the bunxovl(h).inc version of fpopen does. Required because
  48. existing code depends on this (it doesn't always pass a valid mode when
  49. using fmCreate) }
  50. FpOpen:=real_FpOpen(path,flags,mode);
  51. end;