2
0

baseunix.pp 3.6 KB

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