baseunix.pp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. {$i ostypes.inc}
  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. {$i bunxovlh.inc}
  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. {$ifdef HASGLOBALPROPERTY}
  43. property errno : cint read fpgeterrno write fpseterrno;
  44. {$endif}
  45. {$ifdef FPC_USE_LIBC}
  46. function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
  47. {$else}
  48. function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
  49. {$endif}
  50. implementation
  51. {$i bunxmain.inc} { implementation}
  52. {$i bunxovl.inc} { redefs and overloads implementation}
  53. {$i settimeo.inc}
  54. {$ifdef ver1_0}
  55. // MvdV 1.0 is buggy in calling externals it seems. dunno what exactly
  56. function intfpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
  57. procedure intfpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
  58. function fpgeterrno:longint;
  59. begin
  60. fpgeterrno:=intfpgeterrno;
  61. end;
  62. procedure fpseterrno(err:longint);
  63. begin
  64. intfpseterrno(err);
  65. end;
  66. {$else}
  67. {$endif}
  68. end.
  69. {
  70. $Log$
  71. Revision 1.12 2004-12-02 18:24:35 marco
  72. * fpsettimeofday.
  73. Revision 1.11 2004/11/19 13:15:14 marco
  74. * external rework. Mostly done.
  75. Revision 1.10 2004/11/14 12:21:08 marco
  76. * moved some calls from unix to baseunix. Darwin untested.
  77. Revision 1.9 2004/03/04 22:15:16 marco
  78. * UnixType changes. Please report problems to me.
  79. Revision 1.8 2004/01/04 21:04:08 jonas
  80. * declare C-library routines as external in libc for Darwin (so we
  81. generate proper import entries)
  82. Revision 1.7 2003/12/31 20:01:00 marco
  83. * workaround for buggy 1.0 building
  84. Revision 1.6 2003/12/30 12:36:56 marco
  85. * FPC_USE_LIBC
  86. Revision 1.5 2003/12/11 18:20:50 florian
  87. * replaced VER1_0 by HASGLOBALPROPERTY
  88. Revision 1.4 2003/12/10 17:14:06 marco
  89. * property support under ifndef ver1_0
  90. Revision 1.3 2003/12/10 17:08:28 marco
  91. * property errno defined
  92. Revision 1.2 2003/09/14 20:15:01 marco
  93. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  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. }