* moved some calls from unix to baseunix. Darwin untested.

This commit is contained in:
marco 2004-11-14 12:21:08 +00:00
parent dc64bbefbf
commit 42404cd68e
23 changed files with 373 additions and 292 deletions

View File

@ -35,6 +35,7 @@ Uses UnixType;
{$i errno.inc} { Error numbers }
{$i bunxtype.inc} { Types }
{$i ostypes.inc}
{$ifdef FPC_USE_LIBC}
const clib = 'c';
{$i oscdeclh.inc}
@ -83,7 +84,10 @@ end.
{
$Log$
Revision 1.10 2004-05-31 18:03:51 jonas
Revision 1.11 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.10 2004/05/31 18:03:51 jonas
* moved fpgeterrno/fpseterrno declarations to before their actual usage
Revision 1.9 2004/03/04 22:15:16 marco

View File

@ -454,11 +454,114 @@ Function fpSelect(N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cin
begin
fpSelect:=do_syscall(syscall_nr_select,n,longint(readfds),longint(writefds),longint(exceptfds),longint(timeout));
end;
Function fpLstat(path:pchar;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
end;
Function fpLstat(Filename: ansistring;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(pchar(filename)),TSysParam(info));
end;
function fpNice(N:cint):cint;
{
Set process priority. A positive N means a lower priority.
A negative N decreases priority.
Doesn't exist in BSD. Linux emu uses setpriority in a construct as below:
}
var prio : cint;
begin
fpseterrno(0);
prio:=fpgetpriority(PRIO_PROCESS,0);
if (prio=-1) and (fpgeterrno<>0) then
exit(-1);
fpNice:=fpSetPriority(Prio_Process,0,prio+N);
end;
Function fpGetPriority(Which,Who:cint):cint;
{
Get Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on which, this is , respectively :
Uid
Pid
Process Group id
Errors are reported in linuxerror _only_. (priority can be negative)
}
begin
if (which<prio_process) or (which>prio_user) then
begin
{ We can save an interrupt here }
fpgetpriority:=0;
fpseterrno(ESysEinval);
end
else
begin
fpGetPriority:=do_syscall(syscall_nr_GetPriority,which,who);
end;
end;
Function fpSetPriority(Which,Who,What:cint):cint;
{
Set Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on value of which, this is, respectively :
Uid
Pid
Process Group id
what : A number between -20 and 20. -20 is most favorable, 20 least.
0 is the default.
}
begin
if ((which<prio_process) or (which>prio_user)) or ((what<-20) or (what>20)) then
fpseterrno(ESyseinval) { We can save an interrupt here }
else
begin
fpSetPriority:=do_syscall(Syscall_nr_Setpriority,which,who,what);
end;
end;
Function fpSymlink(oldname,newname:pchar):cint;
{
We need this for erase
}
begin
fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
end;
{$endif}
{
$Log$
Revision 1.8 2004-01-22 13:46:14 marco
Revision 1.9 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.8 2004/01/22 13:46:14 marco
bsd
Revision 1.7 2003/12/30 12:26:21 marco

View File

@ -19,7 +19,7 @@
****************************************************************************
}
{$I ostypes.inc}
{I ostypes.inc}
{$I bunxmacr.inc}
{$ifdef FPC_USE_LIBC}
@ -37,7 +37,10 @@
{
$Log$
Revision 1.4 2004-05-31 18:03:51 jonas
Revision 1.5 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.4 2004/05/31 18:03:51 jonas
* moved fpgeterrno/fpseterrno declarations to before their actual usage
Revision 1.3 2003/12/30 12:26:21 marco

View File

@ -586,6 +586,12 @@ begin
Fpgetcwd:=pt;
end;
Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint; [public, alias : 'FPC_SYSC_READLINK'];
begin
fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
end;
{$endif}
CONST
@ -621,9 +627,13 @@ begin
end;
{
$Log$
Revision 1.19 2004-07-18 11:32:24 marco
Revision 1.20 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.19 2004/07/18 11:32:24 marco
* small 1.0.x fix to earlier patch
Revision 1.18 2004/07/17 16:02:58 marco

View File

@ -20,10 +20,15 @@
//Function Fpmunmap(start:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
//function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name 'FPC_SYSC_MMAP';
Function Fpmunmap(start:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
{$ifndef FPC_USE_LIBC}
Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint; external name 'FPC_SYSC_IOCTL';
Function FpGetPid:LongInt; external name 'FPC_SYSC_GETPID';
//Function FpReadLink(name,linkname:pchar;maxlen:longint):longint; external name 'FPC_SYSC_READLINK';
Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name 'FPC_SYSC_READLINK';
{ Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or Unix/freebsd}
Function FpNanoSleep (req : ptimespec;rem : ptimespec) : cint; external name 'FPC_SYSC_NANOSLEEP';
@ -33,7 +38,10 @@ Function Fpgetcwd (path:pchar; siz:size_t):pchar; external name 'FPC_SYSC_GETCWD
{
$Log$
Revision 1.7 2003-12-30 12:26:21 marco
Revision 1.8 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.7 2003/12/30 12:26:21 marco
* FPC_USE_LIBC
Revision 1.6 2003/09/27 13:45:58 peter

View File

@ -13,111 +13,13 @@
**********************************************************************}
function fpNice(N:cint):cint;
{
Set process priority. A positive N means a lower priority.
A negative N decreases priority.
Doesn't exist in BSD. Linux emu uses setpriority in a construct as below:
}
var prio : cint;
begin
fpseterrno(0);
prio:=fpgetpriority(PRIO_PROCESS,0);
if (prio=-1) and (fpgeterrno<>0) then
exit(-1);
fpNice:=fpSetPriority(Prio_Process,0,prio+N);
end;
Function fpGetPriority(Which,Who:cint):cint;
{
Get Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on which, this is , respectively :
Uid
Pid
Process Group id
Errors are reported in linuxerror _only_. (priority can be negative)
}
begin
if (which<prio_process) or (which>prio_user) then
begin
{ We can save an interrupt here }
fpgetpriority:=0;
fpseterrno(ESysEinval);
end
else
begin
fpGetPriority:=do_syscall(syscall_nr_GetPriority,which,who);
end;
end;
Function fpSetPriority(Which,Who,What:cint):cint;
{
Set Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on value of which, this is, respectively :
Uid
Pid
Process Group id
what : A number between -20 and 20. -20 is most favorable, 20 least.
0 is the default.
}
begin
if ((which<prio_process) or (which>prio_user)) or ((what<-20) or (what>20)) then
fpseterrno(ESyseinval) { We can save an interrupt here }
else
begin
fpSetPriority:=do_syscall(Syscall_nr_Setpriority,which,who,what);
end;
end;
Function fpLstat(path:pchar;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
end;
Function fpLstat(Filename: ansistring;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(pchar(filename)),TSysParam(info));
end;
Function fpSymlink(oldname,newname:pchar):cint;
{
We need this for erase
}
begin
fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
end;
Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
begin
fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
end;
{
$Log$
Revision 1.7 2004-11-03 15:00:43 marco
Revision 1.8 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.7 2004/11/03 15:00:43 marco
* Pathstr eliminated
Revision 1.6 2004/07/03 22:48:49 marco

View File

@ -13,20 +13,14 @@
**********************************************************************}
function fpNice(N:cint):cint;
Function fpGetPriority(Which,Who:cint):cint;
Function fpSetPriority(Which,Who,What:cint):cint;
Function fpLstat(path:pchar;Info:pstat):cint;
Function fpLstat(Filename: ansistring;Info:pstat):cint;
Function fpSymlink(oldname,newname:pchar):cint;
Function fpReadLink(name,linkname:pchar;maxlen:cint):cint;
Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name 'FPC_SYSC_MMAP';
Function Fpmunmap(start:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
{
$Log$
Revision 1.6 2004-11-03 15:00:43 marco
Revision 1.7 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.6 2004/11/03 15:00:43 marco
* Pathstr eliminated
Revision 1.5 2004/01/01 17:07:21 marco

View File

@ -196,11 +196,17 @@ const
// wordsinsigset = 4; // words in sigset_t
{ For getting/setting priority }
Prio_Process = 0;
Prio_PGrp = 1;
Prio_User = 2;
{
$Log$
Revision 1.15 2004-10-31 14:34:14 marco
Revision 1.16 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.15 2004/10/31 14:34:14 marco
* statfs moved and updated
Revision 1.14 2004/09/09 20:29:06 jonas

View File

@ -17,10 +17,6 @@
const
{ For getting/setting priority }
Prio_Process = 0;
Prio_PGrp = 1;
Prio_User = 2;
{ Things for LSEEK call}
Seek_set = 0;
@ -121,7 +117,10 @@ type
{
$Log$
Revision 1.9 2003-11-19 10:12:02 marco
Revision 1.10 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.9 2003/11/19 10:12:02 marco
* more cleanups
Revision 1.8 2003/11/17 16:56:20 marco

View File

@ -20,6 +20,7 @@ Interface
Uses UnixType;
{$i aliasptp.inc}
{$i ostypes.inc}
{$define oldreaddir} // Keep using readdir system call instead
// of userland getdents stuff.
@ -79,7 +80,10 @@ end.
{
$Log$
Revision 1.9 2004-03-04 22:15:16 marco
Revision 1.10 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.9 2004/03/04 22:15:16 marco
* UnixType changes. Please report problems to me.
Revision 1.8 2004/01/04 21:04:08 jonas

View File

@ -16,7 +16,7 @@
**********************************************************************}
{$i ostypes.inc}
{i ostypes.inc}
{$ifndef FPC_USE_LIBC}
{$i syscallh.inc} // do_syscall declarations themselves
@ -459,11 +459,116 @@ begin
{$endif bunxfunc_fpselect_implemented}
end;
Function fpLstat(path:pchar;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
end;
Function fpLstat(Filename: ansistring;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(pchar(filename)),TSysParam(info));
end;
function fpNice(N:cint):cint;
{
Set process priority. A positive N means a lower priority.
A negative N increases priority.
Doesn't exist in BSD. Linux emu uses setpriority in a construct as below:
}
{$ifdef cpux86_64}
var
oldprio : cint;
{$endif}
begin
{$ifdef cpux86_64}
oldprio:=fpGetPriority(Prio_Process,0);
fpNice:=fpSetPriority(Prio_Process,0,oldprio+N);
if fpNice=0 then
fpNice:=fpGetPriority(Prio_Process,0);
{$else}
fpNice:=do_syscall(Syscall_nr_nice,N);
{$endif}
end;
Function fpGetPriority(Which,Who:cint):cint;
{
Get Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on which, this is , respectively :
Uid
Pid
Process Group id
Errors are reported in linuxerror _only_. (priority can be negative)
}
begin
if (which<prio_process) or (which>prio_user) then
begin
{ We can save an interrupt here }
fpgetpriority:=-1;
fpsetErrno(ESysEinval);
end
else
fpGetPriority:=do_syscall(syscall_nr_GetPriority,which,who);
end;
Function fpSetPriority(Which,Who,What:cint):cint;
{
Set Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on value of which, this is, respectively :
Uid
Pid
Process Group id
what : A number between -20 and 20. -20 is most favorable, 20 least.
0 is the default.
}
begin
if ((which<prio_process) or (which>prio_user)) or ((what<-20) or (what>20)) then
fpseterrno(ESyseinval) { We can save an interrupt here }
else
begin
fpSetPriority:=do_syscall(Syscall_nr_Setpriority,which,who,what);
end;
end;
Function fpSymlink(oldname,newname:pchar):cint;
{
We need this for erase
}
begin
fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
end;
{$endif}
{
$Log$
Revision 1.12 2004-10-24 13:55:52 peter
Revision 1.13 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.12 2004/10/24 13:55:52 peter
* fpselect for amd64,arm
Revision 1.11 2004/10/13 20:47:12 florian

View File

@ -15,18 +15,20 @@
****************************************************************************
}
//Function Fpmmap(adr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;off:off_t):pointer; external name 'FPC_SYSC_MMAP';
//Function Fpmunmap(adr:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer; external name 'FPC_SYSC_MMAP';
Function Fpmunmap(start:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
//function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name 'FPC_SYSC_READLINK';
Function FpIOCtl(handle:cint;ndx:culong;Data: Pointer):cint; external name 'FPC_SYSC_IOCTL';
Function FpGetPid:pid_t; external name 'FPC_SYSC_GETPID';
Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name 'FPC_SYSC_READLINK';
Function FpNanoSleep(req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
{
$Log$
Revision 1.6 2003-11-19 11:46:55 marco
Revision 1.7 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.6 2003/11/19 11:46:55 marco
* changes due to the previous *BSD changes. Mainly moving constants from
unix to systypes.inc (which acts as unxtypes.inc)

View File

@ -231,9 +231,17 @@ CONST
SIG_MAXSIG = 128; // highest signal version
{$endif}
{ For getting/setting priority }
Prio_Process = 0;
Prio_PGrp = 1;
Prio_User = 2;
{
$Log$
Revision 1.11 2004-09-09 20:29:06 jonas
Revision 1.12 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.11 2004/09/09 20:29:06 jonas
* fixed definition of pthread_mutex_t for non-linux targets (and for
linux as well, actually).
* base libpthread definitions are now in ptypes.inc, included in unixtype

View File

@ -15,10 +15,6 @@
Const
{ For getting/setting priority }
Prio_Process = 0;
Prio_PGrp = 1;
Prio_User = 2;
{ Things for LSEEK call }
@ -104,7 +100,10 @@ Const
{$endif}
{
$Log$
Revision 1.10 2004-02-21 16:27:29 marco
Revision 1.11 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.10 2004/02/21 16:27:29 marco
* hmprf, Linux has different ioctls kernel<->libc
Revision 1.9 2004/02/21 15:14:56 marco

View File

@ -14,108 +14,12 @@
***********************************************************************}
function fpNice(N:cint):cint;
{
Set process priority. A positive N means a lower priority.
A negative N increases priority.
Doesn't exist in BSD. Linux emu uses setpriority in a construct as below:
}
{$ifdef cpux86_64}
var
oldprio : cint;
{$endif}
begin
{$ifdef cpux86_64}
oldprio:=fpGetPriority(Prio_Process,0);
fpNice:=fpSetPriority(Prio_Process,0,oldprio+N);
if fpNice=0 then
fpNice:=fpGetPriority(Prio_Process,0);
{$else}
fpNice:=do_syscall(Syscall_nr_nice,N);
{$endif}
end;
Function fpGetPriority(Which,Who:cint):cint;
{
Get Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on which, this is , respectively :
Uid
Pid
Process Group id
Errors are reported in linuxerror _only_. (priority can be negative)
}
begin
if (which<prio_process) or (which>prio_user) then
begin
{ We can save an interrupt here }
fpgetpriority:=-1;
fpsetErrno(ESysEinval);
end
else
fpGetPriority:=do_syscall(syscall_nr_GetPriority,which,who);
end;
Function fpSetPriority(Which,Who,What:cint):cint;
{
Set Priority of process, process group, or user.
Which : selects what kind of priority is used.
can be one of the following predefined Constants :
Prio_User.
Prio_PGrp.
Prio_Process.
Who : depending on value of which, this is, respectively :
Uid
Pid
Process Group id
what : A number between -20 and 20. -20 is most favorable, 20 least.
0 is the default.
}
begin
if ((which<prio_process) or (which>prio_user)) or ((what<-20) or (what>20)) then
fpseterrno(ESyseinval) { We can save an interrupt here }
else
begin
fpSetPriority:=do_syscall(Syscall_nr_Setpriority,which,who,what);
end;
end;
Function fpLstat(path:pchar;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
end;
Function fpLstat(Filename: ansistring;Info:pstat):cint;
{
Get all information on a link (the link itself), and return it in info.
}
begin
fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(pchar(filename)),TSysParam(info));
end;
Function fpSymlink(oldname,newname:pchar):cint;
{
We need this for erase
}
begin
fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
end;
{
$Log$
Revision 1.6 2004-11-03 15:00:43 marco
Revision 1.7 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.6 2004/11/03 15:00:43 marco
* Pathstr eliminated
Revision 1.5 2004/04/22 17:17:23 peter

View File

@ -14,21 +14,22 @@
****************************************************************************
}
Function Fpmmap(adr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;off:off_t):pointer; external name 'FPC_SYSC_MMAP';
Function Fpmunmap(adr:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
//Function Fpmmap(adr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;off:off_t):pointer; external name 'FPC_SYSC_MMAP';
//Function Fpmunmap(adr:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
function fpNice(N:cint):cint;
Function fpGetPriority(Which,Who:cint):cint;
Function fpSetPriority(Which,Who,What:cint):cint;
Function fpLstat(path:pchar;Info:pstat):cint;
Function fpLstat(Filename: ansistring;Info:pstat):cint;
Function fpSymlink(oldname,newname:pchar):cint;
Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;
//function fpNice(N:cint):cint;
//Function fpGetPriority(Which,Who:cint):cint;
//Function fpSetPriority(Which,Who,What:cint):cint;
//Function fpSymlink(oldname,newname:pchar):cint;
//Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;
{
$Log$
Revision 1.6 2004-11-03 15:00:43 marco
Revision 1.7 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.6 2004/11/03 15:00:43 marco
* Pathstr eliminated
Revision 1.5 2004/01/01 16:10:23 marco

View File

@ -19,7 +19,7 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
TFilDes = Array [0..1] of cInt;
pFilDes = ^TFilDes;
// if you are looking for macro definitions, they are moved to bunxovlh.inc
// if you are looking for macro definitions or non C template overloaded versions, they are moved to bunxovlh.inc
Function FpSigProcMask(how : cInt; nset : pSigSet; oset : pSigSet): cInt;
Function FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt;
@ -87,13 +87,24 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint;
Function FpIOCtl (Handle:cint;Ndx: culong;Data: Pointer):cint;
Function FpNanoSleep (req : ptimespec;rem : ptimespec):cint;
Function fpLstat(path:pchar;Info:pstat):cint;
Function fpLstat(Filename: ansistring;Info:pstat):cint;
Function fpSymlink(oldname,newname:pchar):cint;
Function fpReadLink(name,linkname:pchar;maxlen:size_t):cint;
function fpNice(N:cint):cint;
Function fpGetPriority(Which,Who:cint):cint;
Function fpSetPriority(Which,Who,What:cint):cint;
Function Fpmmap(start:pointer;len:size_t;prot:cint;flags:cint;fd:cint;offst:off_t):pointer;
Function Fpmunmap(start:pointer;len:size_t):cint;
Function FpGetEnv (name : pChar): pChar;
// Function FpGetEnv (name : String): pChar; overloaded to bunxovlh.inc
{
$Log$
Revision 1.11 2003-12-30 12:24:01 marco
Revision 1.12 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.11 2003/12/30 12:24:01 marco
* FPC_USE_LIBC
Revision 1.10 2003/09/27 13:49:41 peter

View File

@ -339,10 +339,32 @@ begin
fpSelect:=fpSelect(T,p);
end;
Function fpReadLink(Name:ansistring):ansistring;
{
Read a link (where it points to)
}
var
LinkName : ansistring;
i : cint;
begin
SetLength(linkname,PATH_MAX);
i:=fpReadLink(pchar(name),pchar(linkname),PATH_MAX);
if i>0 then
begin
SetLength(linkname,i);
fpReadLink:=LinkName;
end
else
fpReadLink:='';
end;
{
$Log$
Revision 1.12 2004-11-02 14:49:48 florian
Revision 1.13 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.12 2004/11/02 14:49:48 florian
* fixed baseunix.signal for CPU using rt_sigaction
* fixed it for x86_64 too

View File

@ -89,11 +89,13 @@ Function wstopsig (Status : cInt): cInt;
Function wifsignaled (Status : cInt): cInt;
Function wtermsig (Status : cInt): cInt;
Function fpReadLink(Name:ansistring):ansistring;
{
$Log$
Revision 1.4 2003-12-30 12:24:01 marco
Revision 1.5 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.4 2003/12/30 12:24:01 marco
* FPC_USE_LIBC
Revision 1.3 2003/09/14 20:15:01 marco

View File

@ -50,9 +50,10 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function FpChmod (path : pChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
Function FPUtime(path:pchar;times:putimbuf):cint; cdecl; external clib name 'utime';
{$ifdef BSD}
{ifdef BSD}
function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external clib name 'sigprocmask';
{$endif}
function FPSigProcMask(how:cint;const nset : sigset;var oset : sigset):cint;cdecl; external clib name 'sigprocmask';
{endif}
function FpStat (path: pchar; var buf : stat): cint; cdecl; external clib name 'stat';
// {$ifdef FPC_IS_SYSTEM}
function FpTime (tloc:ptime_t): time_t; cdecl; external clib name 'time';
@ -87,9 +88,21 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function FpFcntl (fildes : cInt; cmd : cInt; var arg : flock): cInt; cdecl external clib name 'fcntl';
Function FPnanosleep (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
Function fpLstat (path:pchar;Info:pstat):cint; cdecl; external clib name 'lstat';
// function fpMUnMap (P : Pointer; Size : size_t) : cint; cdecl; external clib name 'munmap';
function fpNice (N:cint):cint; cdecl; external clib name 'nice';
Function fpGetPriority (Which,Who:cint):cint; cdecl; external clib name 'getpriority';
Function fpSetPriority (Which,Who,What:cint):cint; cdecl; external clib name 'setpriority';
Function fpSymlink (oldname,newname:pchar):cint; cdecl; external clib name 'symlink';
Function fpReadLink (name,linkname:pchar;maxlen:size_t):cint; cdecl; external clib name 'readlink';
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'gettimeofday';
{
$Log$
Revision 1.8 2004-02-06 20:47:00 jonas
Revision 1.9 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.8 2004/02/06 20:47:00 jonas
+ fpnanosleep for oscdeclh.inc
- removed obsolete darwin remarks from bsd/ossysc.inc

View File

@ -16,23 +16,18 @@
type filedesarray=array[0..1] of cint;
function fpMUnMap (P : Pointer; Size : size_t) : cint; cdecl; external clib name 'munmap';
Function fStatFS(Fd:Longint;Var Info:tstatfs):cint; cdecl; external clib name 'fstatfs';
Function fpFlock (fd,mode : longint) : cint; cdecl; external clib name 'flock';
Function fsync (fd : cint) : cint; cdecl; external clib name 'fsync';
Function StatFS (Path:pchar;Var Info:tstatfs):cint; cdecl; external clib name 'statfs';
function pipe (var fildes: filedesarray):cint; cdecl; external clib name 'pipe';
function fpNice(N:cint):cint; cdecl; external clib name 'nice';
Function fpGetPriority(Which,Who:cint):cint; cdecl; external clib name 'getpriority';
Function fpSetPriority(Which,Who,What:cint):cint; cdecl; external clib name 'setpriority';
Function fpLstat(path:pchar;Info:pstat):cint; cdecl; external clib name 'lstat';
Function fpSymlink(oldname,newname:pchar):cint; cdecl; external clib name 'symlink';
Function fpReadLink(name,linkname:pchar;maxlen:cint):cint; cdecl; external clib name 'readlink';
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'gettimeofday';
{
$Log$
Revision 1.4 2004-04-23 19:16:25 marco
Revision 1.5 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.4 2004/04/23 19:16:25 marco
* flock -> fpflock because of conflicting structure name
Revision 1.3 2004/01/04 21:05:01 jonas

View File

@ -26,28 +26,12 @@ begin
statfs:=statfs(pchar(path),info);
end;
Function fpReadLink(Name:ansistring):ansistring;
{
Read a link (where it points to)
}
var
LinkName : ansistring;
i : cint;
begin
SetLength(linkname,PATH_MAX);
i:=fpReadLink(pchar(name),pchar(linkname),PATH_MAX);
if i>0 then
begin
SetLength(linkname,i);
fpReadLink:=LinkName;
end
else
fpReadLink:='';
end;
{
$Log$
Revision 1.3 2004-11-03 15:00:43 marco
Revision 1.4 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.3 2004/11/03 15:00:43 marco
* Pathstr eliminated
Revision 1.2 2004/01/01 16:10:23 marco

View File

@ -17,12 +17,14 @@
Function PClose(Var F:file) : cint;
Function PClose (Var F:text) : cint;
Function StatFS(Path:ansistring;Var Info:Tstatfs):cint;
Function fpReadLink(Name:ansistring):ansistring;
//Function fpReadLink(Name:ansistring):ansistring;
{
$Log$
Revision 1.3 2004-11-03 15:00:43 marco
Revision 1.4 2004-11-14 12:21:08 marco
* moved some calls from unix to baseunix. Darwin untested.
Revision 1.3 2004/11/03 15:00:43 marco
* Pathstr eliminated
Revision 1.2 2004/01/01 16:10:23 marco