baseunix.pp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. {$packrecords C}
  15. {$define oldreaddir} // Keep using readdir system call instead
  16. // of userland getdents stuff.
  17. {$define usedomain} // Allow uname with "domain" entry.
  18. // (which is a GNU extension)
  19. {$define posixworkaround} // Temporary ugly workaround for signal handler.
  20. // (mainly until baseunix migration is complete)
  21. {$ifndef FPC_USE_LIBC}
  22. {$define FPC_USE_SYSCALL}
  23. {$endif}
  24. {$i errno.inc} { Error numbers }
  25. {$i bunxtype.inc} { Types }
  26. {$ifdef FPC_USE_LIBC}
  27. const clib = 'c';
  28. {$i oscdeclh.inc}
  29. {$ELSE}
  30. {$i bunxh.inc} { Functions}
  31. {$ENDIF}
  32. function fpgeterrno:longint;
  33. procedure fpseterrno(err:longint);
  34. {$ifndef ver1_0}
  35. property errno : cint read fpgeterrno write fpseterrno;
  36. {$endif}
  37. {$i bunxovlh.inc}
  38. implementation
  39. {$i bunxmain.inc} { implementation}
  40. {$i bunxovl.inc} { redefs and overloads implementation}
  41. {$ifndef ver1_0}
  42. function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  43. procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  44. {$else}
  45. // workaround for 1.0.10 bugs.
  46. function intgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  47. procedure intseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  48. function fpgeterrno:longint;
  49. begin
  50. fpgeterrno:=intgeterrno;
  51. end;
  52. procedure fpseterrno(err:longint);
  53. begin
  54. intseterrno(err);
  55. end;
  56. {$endif}
  57. end.
  58. {
  59. $Log$
  60. Revision 1.8 2004-01-04 21:04:08 jonas
  61. * declare C-library routines as external in libc for Darwin (so we
  62. generate proper import entries)
  63. Revision 1.7 2004/01/03 23:56:11 marco
  64. * fix for 1.0 compability issue
  65. Revision 1.6 2003/12/30 12:26:21 marco
  66. * FPC_USE_LIBC
  67. Revision 1.5 2003/12/10 17:13:43 marco
  68. * property support under ifndef ver1_0
  69. Revision 1.4 2003/12/10 17:08:33 marco
  70. * property errno defined
  71. Revision 1.3 2003/09/14 20:15:01 marco
  72. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  73. Revision 1.2 2003/06/03 14:23:45 marco
  74. * Moved prototypes outside of baseunix. And shared with linux for now
  75. Revision 1.1 2003/01/05 19:01:28 marco
  76. * FreeBSD compiles now with baseunix mods.
  77. Revision 1.1 2002/12/18 16:44:09 marco
  78. * more new RTL
  79. Revision 1.2 2002/11/14 12:17:28 marco
  80. * for now.
  81. }