sysos.inc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. {$ifdef FPC_USE_LIBC}
  15. const clib = 'c';
  16. type libcint=longint;
  17. plibcint=^libcint;
  18. function geterrnolocation: Plibcint; cdecl;external clib name'__errno_location';
  19. function geterrno:libcint; [public, alias: 'FPC_SYS_GETERRNO'];
  20. begin
  21. geterrno:=geterrnolocation^;
  22. end;
  23. procedure seterrno(err:libcint); [public, alias: 'FPC_SYS_SETERRNO'];
  24. begin
  25. geterrnolocation^:=err;
  26. end;
  27. {$else}
  28. {$ifdef ver1_0}
  29. Var
  30. {$else}
  31. ThreadVar
  32. {$endif}
  33. Errno : longint;
  34. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  35. begin
  36. GetErrno:=Errno;
  37. end;
  38. procedure seterrno(err:longint); [public, alias: 'FPC_SYS_SETERRNO'];
  39. begin
  40. Errno:=err;
  41. end;
  42. {$endif}
  43. { OS dependant parts }
  44. {$I errno.inc} // error numbers
  45. {$I bunxtype.inc} // c-types, unix base types, unix
  46. // base structures
  47. {*****************************************************************************
  48. Extra cdecl declarations for FPC_USE_LIBC for this os
  49. *****************************************************************************}
  50. {$ifdef FPC_USE_LIBC}
  51. Function fpReadLink(name,linkname:pchar;maxlen:cint):cint; cdecl; external name 'readlink';
  52. function fpgetcwd(buf:pchar;_size:size_t):pchar; cdecl; external name 'getcwd';
  53. {$endif}
  54. {$I ossysc.inc} // base syscalls
  55. {$I osmain.inc} // base wrappers *nix RTL (derivatives)
  56. const
  57. { read/write permission for everyone }
  58. MODE_OPEN = S_IWUSR OR S_IRUSR OR
  59. S_IWGRP OR S_IRGRP OR
  60. S_IWOTH OR S_IROTH;
  61. { read/write search permission for everyone }
  62. MODE_MKDIR = MODE_OPEN OR
  63. S_IXUSR OR S_IXGRP OR S_IXOTH;
  64. {
  65. $Log$
  66. Revision 1.2 2005-02-06 13:06:20 peter
  67. * moved file and dir functions to sysfile/sysdir
  68. * win32 thread in systemunit
  69. Revision 1.1 2005/02/06 11:20:52 peter
  70. * threading in system unit
  71. * removed systhrds unit
  72. }