baseunix.pp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2001 by Carl Eric Codere development team
  5. Base Unix unit modelled after POSIX 2001.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. Unit BaseUnix;
  13. Interface
  14. Uses UnixType;
  15. {$i aliasptp.inc}
  16. {$define oldreaddir} // Keep using readdir system call instead
  17. // of userland getdents stuff.
  18. {$define usedomain} // Allow uname with "domain" entry.
  19. // (which is a GNU extension)
  20. {$define posixworkaround} // Temporary ugly workaround for signal handler.
  21. // (mainly until baseunix migration is complete)
  22. {$ifndef FPC_USE_LIBC}
  23. {$define FPC_USE_SYSCALL}
  24. {$endif}
  25. {$i errno.inc} { Error numbers }
  26. {$i bunxtype.inc} { Types }
  27. {$ifdef FPC_USE_LIBC}
  28. const clib = 'c';
  29. {$i oscdeclh.inc}
  30. {$ELSE}
  31. {$i bunxh.inc} { Functions}
  32. {$ENDIF}
  33. {$i bunxovlh.inc}
  34. function fpgeterrno:longint;
  35. procedure fpseterrno(err:longint);
  36. {$ifdef HASGLOBALPROPERTY}
  37. property errno : cint read fpgeterrno write fpseterrno;
  38. {$endif}
  39. implementation
  40. {$i bunxmain.inc} { implementation}
  41. {$i bunxovl.inc} { redefs and overloads implementation}
  42. {$ifdef ver1_0}
  43. // MvdV 1.0 is buggy in calling externals it seems. dunno what exactly
  44. function intfpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  45. procedure intfpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  46. function fpgeterrno:longint;
  47. begin
  48. fpgeterrno:=intfpgeterrno;
  49. end;
  50. procedure fpseterrno(err:longint);
  51. begin
  52. intfpseterrno(err);
  53. end;
  54. {$else}
  55. function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  56. procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  57. {$endif}
  58. end.
  59. {
  60. $Log$
  61. Revision 1.9 2004-03-04 22:15:16 marco
  62. * UnixType changes. Please report problems to me.
  63. Revision 1.8 2004/01/04 21:04:08 jonas
  64. * declare C-library routines as external in libc for Darwin (so we
  65. generate proper import entries)
  66. Revision 1.7 2003/12/31 20:01:00 marco
  67. * workaround for buggy 1.0 building
  68. Revision 1.6 2003/12/30 12:36:56 marco
  69. * FPC_USE_LIBC
  70. Revision 1.5 2003/12/11 18:20:50 florian
  71. * replaced VER1_0 by HASGLOBALPROPERTY
  72. Revision 1.4 2003/12/10 17:14:06 marco
  73. * property support under ifndef ver1_0
  74. Revision 1.3 2003/12/10 17:08:28 marco
  75. * property errno defined
  76. Revision 1.2 2003/09/14 20:15:01 marco
  77. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  78. Revision 1.1 2002/12/18 16:44:09 marco
  79. * more new RTL
  80. Revision 1.2 2002/11/14 12:17:28 marco
  81. * for now.
  82. }