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

« back to all changes in this revision

Viewing changes to rtl/linux/unxsysc.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
 
    $Id: unxsysc.inc,v 1.5 2004/04/22 17:17:23 peter Exp $
3
 
    This file is part of the Free Pascal run time library.
4
 
    Copyright (c) 2001 by Free Pascal development team
5
 
 
6
 
    Some calls for the unix unit.
7
 
 
8
 
    See the file COPYING.FPC, included in this distribution,
9
 
    for details about the copyright.
10
 
 
11
 
    This program is distributed in the hope that it will be useful,
12
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 
 
15
 
 ***********************************************************************}
16
 
 
17
 
function fpNice(N:cint):cint;
18
 
{
19
 
  Set process priority. A positive N means a lower priority.
20
 
  A negative N increases priority.
21
 
 
22
 
Doesn't exist in BSD. Linux emu uses setpriority in a construct as below:
23
 
}
24
 
 
25
 
{$ifdef cpux86_64}
26
 
var
27
 
  oldprio : cint;
28
 
{$endif}  
29
 
begin
30
 
{$ifdef cpux86_64}
31
 
  oldprio:=fpGetPriority(Prio_Process,0);
32
 
  fpNice:=fpSetPriority(Prio_Process,0,oldprio+N);
33
 
  if fpNice=0 then
34
 
    fpNice:=fpGetPriority(Prio_Process,0);
35
 
{$else}  
36
 
  fpNice:=do_syscall(Syscall_nr_nice,N);
37
 
{$endif}
38
 
end;
39
 
 
40
 
Function fpGetPriority(Which,Who:cint):cint;
41
 
{
42
 
  Get Priority of process, process group, or user.
43
 
   Which : selects what kind of priority is used.
44
 
           can be one of the following predefined Constants :
45
 
              Prio_User.
46
 
              Prio_PGrp.
47
 
              Prio_Process.
48
 
   Who : depending on which, this is , respectively :
49
 
              Uid
50
 
              Pid
51
 
              Process Group id
52
 
   Errors are reported in linuxerror _only_. (priority can be negative)
53
 
}
54
 
begin
55
 
  if (which<prio_process) or (which>prio_user) then
56
 
   begin
57
 
     { We can save an interrupt here }
58
 
     fpgetpriority:=-1;
59
 
     fpsetErrno(ESysEinval);
60
 
   end
61
 
  else
62
 
     fpGetPriority:=do_syscall(syscall_nr_GetPriority,which,who);
63
 
end;
64
 
 
65
 
Function fpSetPriority(Which,Who,What:cint):cint;
66
 
{
67
 
 Set Priority of process, process group, or user.
68
 
   Which : selects what kind of priority is used.
69
 
           can be one of the following predefined Constants :
70
 
              Prio_User.
71
 
              Prio_PGrp.
72
 
              Prio_Process.
73
 
   Who : depending on value of which, this is, respectively :
74
 
              Uid
75
 
              Pid
76
 
              Process Group id
77
 
   what : A number between -20 and 20. -20 is most favorable, 20 least.
78
 
          0 is the default.
79
 
}
80
 
begin
81
 
  if ((which<prio_process) or (which>prio_user)) or ((what<-20) or (what>20)) then
82
 
   fpseterrno(ESyseinval)  { We can save an interrupt here }
83
 
  else
84
 
   begin
85
 
     fpSetPriority:=do_syscall(Syscall_nr_Setpriority,which,who,what);
86
 
   end;
87
 
end;
88
 
 
89
 
Function fpLstat(path:pchar;Info:pstat):cint;
90
 
{
91
 
  Get all information on a link (the link itself), and return it in info.
92
 
}
93
 
 
94
 
begin
95
 
 fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
96
 
end;
97
 
 
98
 
Function fpLstat(Filename: PathStr;Info:pstat):cint;
99
 
{
100
 
  Get all information on a link (the link itself), and return it in info.
101
 
}
102
 
 
103
 
begin
104
 
 FileName:=FileName+#0;
105
 
 fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(@filename[1]),TSysParam(info));
106
 
end;
107
 
 
108
 
Function fpSymlink(oldname,newname:pchar):cint;
109
 
{
110
 
  We need this for erase
111
 
}
112
 
 
113
 
begin
114
 
 fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
115
 
end;
116
 
 
117
 
{
118
 
 $Log: unxsysc.inc,v $
119
 
 Revision 1.5  2004/04/22 17:17:23  peter
120
 
   * x86-64 fixes
121
 
 
122
 
 Revision 1.4  2004/01/01 16:10:23  marco
123
 
  * fpreadlink(pathstr) moved to unxovl (since not platform specific),
124
 
        small fixes for "make all OPT='-dFPC_USE_LIBC'
125
 
 
126
 
 Revision 1.3  2003/11/13 13:11:55  marco
127
 
  * Linuxerror remove + hdr+log added
128
 
 
129
 
 
130
 
}
 
 
b'\\ No newline at end of file'