sysos.inc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 implements all the base types and limits required
  6. for a minimal POSIX compliant subset required to port the compiler
  7. to a new OS.
  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. {$ifdef FPC_USE_LIBC}
  15. const clib = 'c';
  16. type libcint=longint;
  17. plibcint=^libcint;
  18. function geterrnolocation: Plibcint; cdecl;external clib name'__errno_location';
  19. function geterrno:libcint; [public, alias: 'FPC_SYS_GETERRNO'];
  20. begin
  21. geterrno:=geterrnolocation^;
  22. end;
  23. procedure seterrno(err:libcint); [public, alias: 'FPC_SYS_SETERRNO'];
  24. begin
  25. geterrnolocation^:=err;
  26. end;
  27. {$else}
  28. {$ifdef ver1_0}
  29. Var
  30. {$else}
  31. ThreadVar
  32. {$endif}
  33. Errno : longint;
  34. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  35. begin
  36. GetErrno:=Errno;
  37. end;
  38. procedure seterrno(err:longint); [public, alias: 'FPC_SYS_SETERRNO'];
  39. begin
  40. Errno:=err;
  41. end;
  42. {$endif}
  43. { OS dependant parts }
  44. {$I errno.inc} // error numbers
  45. {$I bunxtype.inc} // c-types, unix base types, unix
  46. // base structures
  47. {*****************************************************************************
  48. Extra cdecl declarations for FPC_USE_LIBC for this os
  49. *****************************************************************************}
  50. {$ifdef FPC_USE_LIBC}
  51. Function fpReadLink(name,linkname:pchar;maxlen:cint):cint; cdecl; external name 'readlink';
  52. function fpgetcwd(buf:pchar;_size:size_t):pchar; cdecl; external name 'getcwd';
  53. {$endif}
  54. {$I ossysc.inc} // base syscalls
  55. {$I osmain.inc} // base wrappers *nix RTL (derivatives)
  56. {
  57. $Log$
  58. Revision 1.3 2005-02-07 22:04:55 peter
  59. * moved to unix
  60. Revision 1.2 2005/02/06 13:06:20 peter
  61. * moved file and dir functions to sysfile/sysdir
  62. * win32 thread in systemunit
  63. Revision 1.1 2005/02/06 11:20:52 peter
  64. * threading in system unit
  65. * removed systhrds unit
  66. }