sysos.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 base structures
  46. {$I ossysc.inc} // base syscalls
  47. {$I osmain.inc} // base wrappers *nix RTL (derivatives)
  48. {
  49. $Log$
  50. Revision 1.4 2005-02-13 20:01:38 peter
  51. * include file cleanup
  52. Revision 1.3 2005/02/07 22:04:55 peter
  53. * moved to unix
  54. Revision 1.2 2005/02/06 13:06:20 peter
  55. * moved file and dir functions to sysfile/sysdir
  56. * win32 thread in systemunit
  57. Revision 1.1 2005/02/06 11:20:52 peter
  58. * threading in system unit
  59. * removed systhrds unit
  60. }