baseunix.pp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. {$i ostypes.inc}
  29. {$ifdef FPC_USE_LIBC}
  30. const clib = 'c';
  31. {$i oscdeclh.inc}
  32. {$ELSE}
  33. {$i bunxh.inc} { Functions}
  34. {$ENDIF}
  35. {$ifndef ver1_0}
  36. function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  37. procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  38. {$else}
  39. function fpgeterrno:longint;
  40. procedure fpseterrno(err:longint);
  41. {$endif}
  42. {$ifndef ver1_0}
  43. property errno : cint read fpgeterrno write fpseterrno;
  44. {$endif}
  45. {$i bunxovlh.inc}
  46. implementation
  47. Uses Sysctl;
  48. {$ifndef ver1_0}
  49. //function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  50. //procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  51. {$else}
  52. // workaround for 1.0.10 bugs.
  53. function intgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  54. procedure intseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  55. function fpgeterrno:longint;
  56. begin
  57. fpgeterrno:=intgeterrno;
  58. end;
  59. procedure fpseterrno(err:longint);
  60. begin
  61. intseterrno(err);
  62. end;
  63. {$endif}
  64. {$i bunxmain.inc} { implementation}
  65. {$i bunxovl.inc} { redefs and overloads implementation}
  66. end.
  67. {
  68. $Log$
  69. Revision 1.12 2004-11-19 13:15:14 marco
  70. * external rework. Mostly done.
  71. Revision 1.11 2004/11/14 12:21:08 marco
  72. * moved some calls from unix to baseunix. Darwin untested.
  73. Revision 1.10 2004/05/31 18:03:51 jonas
  74. * moved fpgeterrno/fpseterrno declarations to before their actual usage
  75. Revision 1.9 2004/03/04 22:15:16 marco
  76. * UnixType changes. Please report problems to me.
  77. Revision 1.8 2004/01/04 21:04:08 jonas
  78. * declare C-library routines as external in libc for Darwin (so we
  79. generate proper import entries)
  80. Revision 1.7 2004/01/03 23:56:11 marco
  81. * fix for 1.0 compability issue
  82. Revision 1.6 2003/12/30 12:26:21 marco
  83. * FPC_USE_LIBC
  84. Revision 1.5 2003/12/10 17:13:43 marco
  85. * property support under ifndef ver1_0
  86. Revision 1.4 2003/12/10 17:08:33 marco
  87. * property errno defined
  88. Revision 1.3 2003/09/14 20:15:01 marco
  89. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  90. Revision 1.2 2003/06/03 14:23:45 marco
  91. * Moved prototypes outside of baseunix. And shared with linux for now
  92. Revision 1.1 2003/01/05 19:01:28 marco
  93. * FreeBSD compiles now with baseunix mods.
  94. Revision 1.1 2002/12/18 16:44:09 marco
  95. * more new RTL
  96. Revision 1.2 2002/11/14 12:17:28 marco
  97. * for now.
  98. }