diff --git a/rtl/bsd/baseunix.pp b/rtl/bsd/baseunix.pp index 81dc9fa048..ef59f5b58f 100644 --- a/rtl/bsd/baseunix.pp +++ b/rtl/bsd/baseunix.pp @@ -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 diff --git a/rtl/bsd/bunxfunc.inc b/rtl/bsd/bunxfunc.inc index 4ee8313762..a4c5938ea8 100644 --- a/rtl/bsd/bunxfunc.inc +++ b/rtl/bsd/bunxfunc.inc @@ -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 (whichprio_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 ((whichprio_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 diff --git a/rtl/bsd/bunxmain.inc b/rtl/bsd/bunxmain.inc index 4d3ff3e2b4..203ec38e9a 100644 --- a/rtl/bsd/bunxmain.inc +++ b/rtl/bsd/bunxmain.inc @@ -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 diff --git a/rtl/bsd/ossysc.inc b/rtl/bsd/ossysc.inc index 2b3de854e2..58b1d942dc 100644 --- a/rtl/bsd/ossysc.inc +++ b/rtl/bsd/ossysc.inc @@ -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 diff --git a/rtl/bsd/ossysch.inc b/rtl/bsd/ossysch.inc index 3550a7bf12..3e385775f6 100644 --- a/rtl/bsd/ossysch.inc +++ b/rtl/bsd/ossysch.inc @@ -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 diff --git a/rtl/bsd/unxsysc.inc b/rtl/bsd/unxsysc.inc index 5b3f8dd62d..77302a807c 100644 --- a/rtl/bsd/unxsysc.inc +++ b/rtl/bsd/unxsysc.inc @@ -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 (whichprio_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 ((whichprio_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 diff --git a/rtl/bsd/unxsysch.inc b/rtl/bsd/unxsysch.inc index f3d7e0261f..b70cd580eb 100644 --- a/rtl/bsd/unxsysch.inc +++ b/rtl/bsd/unxsysch.inc @@ -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 diff --git a/rtl/freebsd/ptypes.inc b/rtl/freebsd/ptypes.inc index 20e7bc2880..686bf213c7 100644 --- a/rtl/freebsd/ptypes.inc +++ b/rtl/freebsd/ptypes.inc @@ -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 diff --git a/rtl/freebsd/sysconst.inc b/rtl/freebsd/sysconst.inc index 6ba19c760e..4e20f8d010 100644 --- a/rtl/freebsd/sysconst.inc +++ b/rtl/freebsd/sysconst.inc @@ -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 diff --git a/rtl/linux/baseunix.pp b/rtl/linux/baseunix.pp index 3475008b9c..5bb9d7e216 100644 --- a/rtl/linux/baseunix.pp +++ b/rtl/linux/baseunix.pp @@ -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 diff --git a/rtl/linux/bunxfunc.inc b/rtl/linux/bunxfunc.inc index 933264fdc6..fcf78607df 100644 --- a/rtl/linux/bunxfunc.inc +++ b/rtl/linux/bunxfunc.inc @@ -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 (whichprio_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 ((whichprio_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 diff --git a/rtl/linux/ossysch.inc b/rtl/linux/ossysch.inc index b7b1122777..5be1e2e126 100644 --- a/rtl/linux/ossysch.inc +++ b/rtl/linux/ossysch.inc @@ -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) diff --git a/rtl/linux/ptypes.inc b/rtl/linux/ptypes.inc index a80ffca7ea..7bf2cc3c50 100644 --- a/rtl/linux/ptypes.inc +++ b/rtl/linux/ptypes.inc @@ -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 diff --git a/rtl/linux/sysconst.inc b/rtl/linux/sysconst.inc index d486412492..1305e04750 100644 --- a/rtl/linux/sysconst.inc +++ b/rtl/linux/sysconst.inc @@ -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 diff --git a/rtl/linux/unxsysc.inc b/rtl/linux/unxsysc.inc index d6dc0944f7..3fda7805a6 100644 --- a/rtl/linux/unxsysc.inc +++ b/rtl/linux/unxsysc.inc @@ -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 (whichprio_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 ((whichprio_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 diff --git a/rtl/linux/unxsysch.inc b/rtl/linux/unxsysch.inc index c959b62418..9a07174510 100644 --- a/rtl/linux/unxsysch.inc +++ b/rtl/linux/unxsysch.inc @@ -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 diff --git a/rtl/unix/bunxh.inc b/rtl/unix/bunxh.inc index 4d99c46758..ce9c9c8b8a 100644 --- a/rtl/unix/bunxh.inc +++ b/rtl/unix/bunxh.inc @@ -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 diff --git a/rtl/unix/bunxovl.inc b/rtl/unix/bunxovl.inc index 6622088078..e525fececf 100644 --- a/rtl/unix/bunxovl.inc +++ b/rtl/unix/bunxovl.inc @@ -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 diff --git a/rtl/unix/bunxovlh.inc b/rtl/unix/bunxovlh.inc index b45e025ae2..97857ebdd8 100644 --- a/rtl/unix/bunxovlh.inc +++ b/rtl/unix/bunxovlh.inc @@ -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 diff --git a/rtl/unix/oscdeclh.inc b/rtl/unix/oscdeclh.inc index 6b9a33c49a..2f7bfdc2c8 100644 --- a/rtl/unix/oscdeclh.inc +++ b/rtl/unix/oscdeclh.inc @@ -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 diff --git a/rtl/unix/unxdeclh.inc b/rtl/unix/unxdeclh.inc index e52c02f61c..8418684a85 100644 --- a/rtl/unix/unxdeclh.inc +++ b/rtl/unix/unxdeclh.inc @@ -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 diff --git a/rtl/unix/unxovl.inc b/rtl/unix/unxovl.inc index bcb09598ec..a2624563ae 100644 --- a/rtl/unix/unxovl.inc +++ b/rtl/unix/unxovl.inc @@ -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 diff --git a/rtl/unix/unxovlh.inc b/rtl/unix/unxovlh.inc index 5378102012..77f07727b0 100644 --- a/rtl/unix/unxovlh.inc +++ b/rtl/unix/unxovlh.inc @@ -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