baseunix.pp 3.6 KB

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