system.pp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time librar~y.
  4. Copyright (c) 2000 by Marco van de Voort
  5. member of the Free Pascal development team.
  6. System unit for the *BSD's.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. { These things are set in the makefile, }
  14. { But you can override them here.}
  15. { If you use an aout system, set the conditional AOUT}
  16. { $Define AOUT}
  17. {$ifdef BSD}
  18. Unit {$ifdef VER1_0}SysBSD{$else}System{$endif};
  19. {$else}
  20. Unit {$ifdef VER1_0}Syslinux{$else}System{$endif};
  21. {$endif}
  22. Interface
  23. {$I sysunixh.inc}
  24. {$define FPC_USE_SIGPROCMASK}
  25. {$define FPC_USE_SIGALTSTACK}
  26. CONST SIGSTKSZ = 40960;
  27. Implementation
  28. Var Errno : longint;
  29. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  30. begin
  31. GetErrno:=Errno;
  32. end;
  33. procedure seterrno(err:longint); [public, alias: 'FPC_SYS_SETERRNO'];
  34. begin
  35. Errno:=err;
  36. end;
  37. { OS independant parts}
  38. {$I system.inc}
  39. { OS dependant parts }
  40. {$I errno.inc}
  41. {$I bunxtype.inc}
  42. {$I ossysc.inc}
  43. {$I osmain.inc}
  44. {$I text.inc}
  45. {$I heap.inc}
  46. {*****************************************************************************
  47. UnTyped File Handling
  48. *****************************************************************************}
  49. {$i file.inc}
  50. {*****************************************************************************
  51. Typed File Handling
  52. *****************************************************************************}
  53. {$i typefile.inc}
  54. procedure SysInitStdIO;
  55. begin
  56. OpenStdIO(Input,fmInput,StdInputHandle);
  57. OpenStdIO(Output,fmOutput,StdOutputHandle);
  58. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  59. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  60. end;
  61. Begin
  62. IsConsole := TRUE;
  63. IsLibrary := FALSE;
  64. StackBottom := Sptr - StackLength;
  65. { Set up signals handlers }
  66. InstallSignals;
  67. { Setup heap }
  68. InitHeap;
  69. SysInitExceptions;
  70. { Arguments }
  71. SetupCmdLine;
  72. { Setup stdin, stdout and stderr }
  73. SysInitStdIO;
  74. { Reset IO Error }
  75. InOutRes:=0;
  76. {$ifdef HASVARIANT}
  77. initvariantmanager;
  78. {$endif HASVARIANT}
  79. End.
  80. {
  81. $Log$
  82. Revision 1.10 2003-10-26 17:01:04 marco
  83. * moved sigprocmask to system
  84. Revision 1.9 2003/10/26 16:42:22 marco
  85. * texception4 fix merge
  86. Revision 1.8 2003/01/05 19:01:28 marco
  87. * FreeBSD compiles now with baseunix mods.
  88. Revision 1.7 2002/11/12 14:57:48 marco
  89. * Ugly hack to temporarily be able to use system.pp for Linux too
  90. Revision 1.6 2002/10/27 11:58:30 marco
  91. * Modifications from Saturday.
  92. Revision 1.5 2002/10/26 18:27:51 marco
  93. * First series POSIX calls commits. Including getcwd.
  94. Revision 1.4 2002/10/18 12:19:58 marco
  95. * Fixes to get the generic *BSD RTL compiling again + fixes for thread
  96. support. Still problems left in fexpand. (inoutres?) Therefore fixed
  97. sysposix not yet commited
  98. Revision 1.3 2002/10/13 09:25:39 florian
  99. + call to initvariantmanager inserted
  100. Revision 1.2 2002/09/07 16:01:17 peter
  101. * old logs removed and tabs fixed
  102. Revision 1.1 2002/08/19 12:29:11 marco
  103. * First working POSIX *BSD system unit.
  104. }