~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/solaris/sysos.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal run time library.
 
3
    Copyright (c) 2001 by Free Pascal development team
 
4
 
 
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
 
 
9
    See the file COPYING.FPC, included in this distribution,
 
10
    for details about the copyright.
 
11
 
 
12
    This program is distributed in the hope that it will be useful,
 
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
15
 
 
16
 **********************************************************************}
 
17
 
 
18
const clib = 'c';
 
19
 
 
20
type libcint=longint;
 
21
     plibcint=^libcint;
 
22
 
 
23
function geterrnolocation: Plibcint; cdecl;external clib name '___errno';
 
24
 
 
25
function geterrno:libcint; [public, alias: 'FPC_SYS_GETERRNO'];
 
26
begin
 
27
 geterrno:=geterrnolocation^;
 
28
end;
 
29
 
 
30
procedure seterrno(err:libcint); [public, alias: 'FPC_SYS_SETERRNO'];
 
31
begin
 
32
  geterrnolocation^:=err;
 
33
end;
 
34
 
 
35
{ OS dependant parts  }
 
36
 
 
37
{$I errno.inc}                          // error numbers
 
38
{$I ostypes.inc}                        // c-types, unix base types, unix base structures
 
39
{$I osmacro.inc}
 
40
 
 
41
{$Linklib c}
 
42
{$i oscdeclh.inc}
 
43
 
 
44
{*****************************************************************************
 
45
                            Error conversion
 
46
*****************************************************************************}
 
47
 
 
48
Function PosixToRunError  (PosixErrno : longint) : longint;
 
49
{
 
50
  Convert ErrNo error to the correct Inoutres value
 
51
}
 
52
 
 
53
begin
 
54
  if PosixErrNo=0 then { Else it will go through all the cases }
 
55
   exit(0);
 
56
  case PosixErrNo of
 
57
   ESysENFILE,
 
58
   ESysEMFILE : Inoutres:=4;
 
59
   ESysENOENT : Inoutres:=2;
 
60
    ESysEBADF : Inoutres:=6;
 
61
   ESysENOMEM,
 
62
   ESysEFAULT : Inoutres:=217;
 
63
   ESysEINVAL : Inoutres:=218;
 
64
    ESysEPIPE,
 
65
    ESysEINTR,
 
66
      ESysEIO,
 
67
   ESysEAGAIN,
 
68
   ESysENOSPC : Inoutres:=101;
 
69
 ESysENAMETOOLONG : Inoutres := 3;
 
70
    ESysEROFS,
 
71
   ESysEEXIST,
 
72
   ESysENOTEMPTY,
 
73
   ESysEACCES : Inoutres:=5;
 
74
   ESysEISDIR : InOutRes:=5;
 
75
  else
 
76
    begin
 
77
       InOutRes := Integer(PosixErrno);
 
78
    end;
 
79
  end;
 
80
 PosixToRunError:=InOutRes;
 
81
end;
 
82
 
 
83
Function Errno2InoutRes : longint;
 
84
 
 
85
begin
 
86
  Errno2InoutRes:=PosixToRunError(getErrno);
 
87
  InoutRes:=Errno2InoutRes;
 
88
end;
 
89
 
 
90
 
 
91
 
 
92
{*****************************************************************************
 
93
                          Low Level File Routines
 
94
*****************************************************************************}
 
95
 
 
96
function do_isdevice(handle:longint):boolean;
 
97
begin
 
98
  do_isdevice:= (handle=StdInputHandle) or
 
99
                (handle=StdOutputHandle) or
 
100
                (handle=StdErrorHandle);
 
101
end;
 
102
 
 
103