123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- {
- $Id$
- This file is part of the Free Pascal run time library.
- Copyright (c) 1999-2000 by the Free Pascal development team.
- Solaris system unit
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- unit System;
- interface
- { include system-independent routine headers }
- {$I sysunixh.inc}
- implementation
- var
- Errno : longint; external name 'errno'; { declared in libc }
- { OS independant parts}
- {$I system.inc}
- {*****************************************************************************
- OS Memory allocation / deallocation
- ****************************************************************************}
- { OS dependant parts }
- {$I errno.inc}
- {$I bunxtype.inc}
- {$I osposix.inc}
- {$I sysposix.inc}
- function SysOSAlloc(size: ptrint): pointer;
- begin
- // result := sbrk(size);
- end;
- {$define HAS_SYSOSFREE}
- procedure SysOSFree(p: pointer; size: ptrint);
- begin
- // fpmunmap(p, size);
- end;
- function do_isdevice(handle:longint):boolean;
- begin
- do_isdevice:= (handle=StdInputHandle) or
- (handle=StdOutputHandle) or
- (handle=StdErrorHandle);
- end;
- {$I text.inc}
- {$I heap.inc}
- {*****************************************************************************
- UnTyped File Handling
- *****************************************************************************}
- {$i file.inc}
- {*****************************************************************************
- Typed File Handling
- *****************************************************************************}
- {$i typefile.inc}
- procedure SysInitStdIO;
- begin
- OpenStdIO(Input,fmInput,StdInputHandle);
- OpenStdIO(Output,fmOutput,StdOutputHandle);
- OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
- OpenStdIO(StdOut,fmOutput,StdOutputHandle);
- OpenStdIO(StdErr,fmOutput,StdErrorHandle);
- end;
- function GetProcessID: SizeUInt;
- begin
- GetProcessID := SizeUInt (fpGetPID);
- end;
- procedure pascalmain; external name 'PASCALMAIN';
- { Main entry point in C style, needed to capture program parameters. }
- procedure main(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
- begin
- argc:= argcparam;
- argv:= argvparam;
- envp:= envpparam;
- pascalmain; {run the pascal main program}
- end;
- Begin
- IsConsole := TRUE;
- IsLibrary := FALSE;
- StackLength := InitialStkLen;
- StackBottom := Sptr - StackLength;
- { Set up signals handlers }
- InstallSignals;
- { Setup heap }
- InitHeap;
- SysInitExceptions;
- { Arguments }
- SetupCmdLine;
- { Setup stdin, stdout and stderr }
- SysInitStdIO;
- { Reset IO Error }
- InOutRes:=0;
- (* This should be changed to a real value during *)
- (* thread driver initialization if appropriate. *)
- ThreadID := 1;
- {$ifdef HASVARIANT}
- initvariantmanager;
- {$endif HASVARIANT}
- End.
- {
- $Log$
- Revision 1.3 2004-12-05 14:36:38 hajny
- + GetProcessID added
- Revision 1.2 2004/11/06 22:22:28 florian
- * some sunos stuff from 1.0.x merged
- }
|