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

« back to all changes in this revision

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