baseunix.pp 3.0 KB

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