system.pp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. 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. { These things are set in the makefile, }
  13. { But you can override them here.}
  14. { If you use an aout system, set the conditional AOUT}
  15. { $Define AOUT}
  16. Unit {$ifdef VER1_0}SysBSD{$else}System{$endif};
  17. Interface
  18. {$I sysunixh.inc}
  19. Implementation
  20. Var Errno : longint;
  21. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  22. begin
  23. GetErrno:=Errno;
  24. end;
  25. { OS independant parts}
  26. {$I system.inc}
  27. { OS dependant parts }
  28. {$I errno.inc}
  29. {$I osposixh.inc}
  30. {$I bsdsysc.inc}
  31. {$I sysposix.inc}
  32. {$I text.inc}
  33. {$I heap.inc}
  34. {*****************************************************************************
  35. UnTyped File Handling
  36. *****************************************************************************}
  37. {$i file.inc}
  38. {*****************************************************************************
  39. Typed File Handling
  40. *****************************************************************************}
  41. {$i typefile.inc}
  42. Begin
  43. IsConsole := TRUE;
  44. IsLibrary := FALSE;
  45. StackBottom := Sptr - StackLength;
  46. { Set up signals handlers }
  47. InstallSignals;
  48. { Setup heap }
  49. InitHeap;
  50. InitExceptions;
  51. { Arguments }
  52. SetupCmdLine;
  53. { Setup stdin, stdout and stderr }
  54. OpenStdIO(Input,fmInput,StdInputHandle);
  55. OpenStdIO(Output,fmOutput,StdOutputHandle);
  56. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  57. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  58. { Reset IO Error }
  59. InOutRes:=0;
  60. End.
  61. {
  62. $Log$
  63. Revision 1.1 2002-08-19 12:29:11 marco
  64. * First working POSIX *BSD system unit.
  65. Revision 1.1 2000/10/15 08:19:48 peter
  66. * system unit rename for 1.1 branch
  67. Revision 1.2 2000/09/18 13:42:35 marco
  68. * FreeBSD support into 1.1
  69. Revision 1.1.2.1 2000/09/16 11:19:08 marco
  70. * Moved files from BSD to FreeBSD directory, with some small changes
  71. Revision 1.1.2.4 2000/09/16 11:10:43 marco
  72. * Introduced using sysunix and sysunixh
  73. Revision 1.1.2.3 2000/09/10 16:12:40 marco
  74. The rearrangement to linux for
  75. Revision 1.1.2.2 2000/08/05 18:33:29 peter
  76. * paramstr(0) fix for linux 2.0 kernels
  77. Revision 1.1.2.1 2000/07/14 07:33:15 michael
  78. + Fixed do_open call. Directory checking must not be performed
  79. Revision 1.1 2000/07/13 06:30:54 michael
  80. + Initial import
  81. Revision 1.49 2000/07/08 18:02:39 peter
  82. * do_open checks for directory, if directory then ioerror 2
  83. Revision 1.48 2000/06/30 22:14:03 peter
  84. * removed obsolete crtlib code
  85. * support EINTR for read/write to restart the syscall
  86. Revision 1.47 2000/05/11 17:55:13 peter
  87. * changed order of fpustate checking to first check the more
  88. specific states
  89. Revision 1.46 2000/05/08 14:27:36 peter
  90. * released newsignal
  91. * newsignal gives now better backtraces using the sigcontext eip/ebp
  92. fields
  93. Revision 1.45 2000/04/16 16:07:58 marco
  94. * BSD fixes
  95. Revision 1.44 2000/04/14 13:04:53 marco
  96. * Merged bsd/syslinux.pp and 1.43 linux/syslinux.pp to this file with ifdefs
  97. Revision 1.43 2000/04/07 14:56:36 peter
  98. * switch to direct asm if not correctfldcw defined
  99. Revision 1.42 2000/03/31 23:26:32 pierre
  100. * FPU needs reset for all SIGFPE even from integer division by zero
  101. Revision 1.41 2000/03/31 23:21:19 pierre
  102. * multiple exception handling works
  103. (for linux only if syslinux is compiled with -dnewsignal)
  104. Revision 1.40 2000/03/31 13:24:28 jonas
  105. * signal handling using sigaction when compiled with -dnewsignal
  106. (allows multiple signals to be received in one run)
  107. Revision 1.39 2000/03/25 12:28:37 peter
  108. * patch for getdir from Pierre
  109. Revision 1.38 2000/03/23 15:24:18 peter
  110. * remove handle check for do_close
  111. Revision 1.37 2000/02/09 16:59:32 peter
  112. * truncated log
  113. Revision 1.36 2000/02/09 12:17:51 peter
  114. * moved halt to system.inc
  115. * syslinux doesn't use direct asm anymore
  116. Revision 1.35 2000/02/08 11:47:09 peter
  117. * paramstr(0) support
  118. Revision 1.34 2000/01/20 23:38:02 peter
  119. * support fm_inout as stdoutput for assign(f,'');rewrite(f,1); becuase
  120. rewrite opens always with filemode 2
  121. Revision 1.33 2000/01/16 22:25:38 peter
  122. * check handle for file closing
  123. Revision 1.32 2000/01/07 16:41:41 daniel
  124. * copyright 2000
  125. Revision 1.31 2000/01/07 16:32:28 daniel
  126. * copyright 2000 added
  127. Revision 1.30 1999/12/01 22:57:31 peter
  128. * cmdline support
  129. Revision 1.29 1999/11/06 14:39:12 peter
  130. * truncated log
  131. Revision 1.28 1999/10/28 09:50:06 peter
  132. * use mmap instead of brk
  133. Revision 1.27 1999/09/10 15:40:35 peter
  134. * fixed do_open flags to be > $100, becuase filemode can be upto 255
  135. Revision 1.26 1999/09/08 16:14:43 peter
  136. * pointer fixes
  137. Revision 1.25 1999/07/28 23:18:36 peter
  138. * closedir fixes, which now disposes the pdir itself
  139. }