sysos.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. {$ifdef FreeBSD} // tested on x86
  19. function geterrnolocation: Plibcint; cdecl;external clib name '__error';
  20. {$else}
  21. {$ifdef NetBSD} // from a sparc dump.
  22. function geterrnolocation: Plibcint; cdecl;external clib name '__errno';
  23. {$else}
  24. {$ifdef Darwin}
  25. function geterrnolocation: Plibcint; cdecl;external clib name '__error';
  26. {$else}
  27. {$ifdef OpenBSD}
  28. var libcerrno : libcint; cvar;
  29. function geterrnolocation: Plibcint; cdecl;
  30. begin
  31. geterrnolocation:=@libcerrno;
  32. end;
  33. {$else}
  34. {$endif}
  35. {$endif}
  36. {$endif}
  37. {$endif}
  38. function geterrno:libcint; [public, alias: 'FPC_SYS_GETERRNO'];
  39. begin
  40. geterrno:=geterrnolocation^;
  41. end;
  42. procedure seterrno(err:libcint); [public, alias: 'FPC_SYS_SETERRNO'];
  43. begin
  44. geterrnolocation^:=err;
  45. end;
  46. {$else}
  47. {$ifdef ver1_0}
  48. Var
  49. {$else}
  50. threadvar
  51. {$endif}
  52. Errno : longint;
  53. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  54. begin
  55. GetErrno:=Errno;
  56. end;
  57. procedure seterrno(err:longint); [public, alias: 'FPC_SYS_SETERRNO'];
  58. begin
  59. Errno:=err;
  60. end;
  61. {$endif}
  62. { OS dependant parts }
  63. {$I errno.inc}
  64. {$I bunxtype.inc}
  65. {$I ossysc.inc}
  66. {$I osmain.inc}
  67. {
  68. $Log$
  69. Revision 1.3 2005-02-07 22:04:55 peter
  70. * moved to unix
  71. Revision 1.2 2005/02/06 13:06:20 peter
  72. * moved file and dir functions to sysfile/sysdir
  73. * win32 thread in systemunit
  74. Revision 1.1 2005/02/06 12:16:52 peter
  75. * bsd thread updates
  76. }