sysos.inc 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2001 by Free Pascal development team
  5. This file implements all the base types and limits required
  6. for a minimal POSIX compliant subset required to port the compiler
  7. to a new OS.
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. const clib = 'c';
  15. type libcint=longint;
  16. plibcint=^libcint;
  17. function geterrnolocation: Plibcint; cdecl;external clib name'__errno_location';
  18. function geterrno:libcint; [public, alias: 'FPC_SYS_GETERRNO'];
  19. begin
  20. geterrno:=geterrnolocation^;
  21. end;
  22. procedure seterrno(err:libcint); [public, alias: 'FPC_SYS_SETERRNO'];
  23. begin
  24. geterrnolocation^:=err;
  25. end;
  26. { OS dependant parts }
  27. {$I errno.inc} // error numbers
  28. {$I bunxtype.inc} // c-types, unix base types, unix
  29. // base structures
  30. {*****************************************************************************
  31. Extra cdecl declarations for FPC_USE_LIBC for this os
  32. *****************************************************************************}
  33. Function fpReadLink(name,linkname:pchar;maxlen:cint):cint; cdecl; external name 'readlink';
  34. function fpgetcwd(buf:pchar;_size:size_t):pchar; cdecl; external name 'getcwd';
  35. {$I ossysc.inc} // base syscalls
  36. {$I osmain.inc} // base wrappers *nix RTL (derivatives)
  37. function do_isdevice(handle:longint):boolean;
  38. begin
  39. do_isdevice:= (handle=StdInputHandle) or
  40. (handle=StdOutputHandle) or
  41. (handle=StdErrorHandle);
  42. end;
  43. {
  44. $Log$
  45. Revision 1.1 2005-02-07 22:17:26 peter
  46. * updated for 1.9.x unix rtl
  47. Revision 1.2 2005/02/06 13:06:20 peter
  48. * moved file and dir functions to sysfile/sysdir
  49. * win32 thread in systemunit
  50. Revision 1.1 2005/02/06 11:20:52 peter
  51. * threading in system unit
  52. * removed systhrds unit
  53. }