* small fixes. FreeBSD now cycles

This commit is contained in:
marco 2003-09-15 20:08:49 +00:00
parent 505f97b75a
commit 08eb5ac89f
9 changed files with 101 additions and 56 deletions

View File

@ -44,14 +44,14 @@ procedure actualsyscall; assembler; {inline requires a dummy push IIRC}
mov $-1,%eax
end;
function FpSysCall(sysnr:TSysParam):TSysResult; assembler; [public,alias:'FPC_DOSYS0'];
function FpSysCall(sysnr:TSysParam):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif} assembler; [public,alias:'FPC_DOSYS0'];
asm
movl sysnr,%eax
call actualsyscall
end;
function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS1'];
function FpSysCall(sysnr,param1:TSysParam):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif} assembler;[public,alias:'FPC_DOSYS1'];
asm
movl sysnr,%eax
@ -60,7 +60,7 @@ function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'
addl $4,%esp
end;
function FpSysCall(sysnr,param1:integer):TSysResult; assembler;[public,alias:'FPC_DOSYS1w'];
function FpSysCall(sysnr,param1:integer):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif}assembler;[public,alias:'FPC_DOSYS1w'];
asm
movl sysnr,%eax
@ -69,7 +69,7 @@ function FpSysCall(sysnr,param1:integer):TSysResult; assembler;[public,alias:'FP
add $2,%esp
end;
function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler; [public,alias:'FPC_DOSYS2'];
function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif}assembler; [public,alias:'FPC_DOSYS2'];
asm
movl sysnr,%eax
@ -79,7 +79,7 @@ function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler; [public
addl $8,%esp
end;
function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS3'];
function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif}assembler;[public,alias:'FPC_DOSYS3'];
asm
movl sysnr,%eax
@ -90,7 +90,7 @@ function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[
addl $12,%esp
end;
function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS4'];
function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult;{$ifndef VER1_0} oldfpccall;{$endif} assembler;[public,alias:'FPC_DOSYS4'];
asm
movl sysnr,%eax
@ -103,7 +103,7 @@ asm
end;
function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_DOSYS5'];
function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult;{$ifndef VER1_0} oldfpccall;{$endif} assembler;[public,alias:'FPC_DOSYS5'];
asm
movl sysnr,%eax
@ -116,7 +116,7 @@ function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResul
addl $20,%esp
end;
function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64; assembler;[public,alias:'FPC_DOSYS6'];
function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64; {$ifndef VER1_0} oldfpccall;{$endif} assembler;[public,alias:'FPC_DOSYS6'];
asm
movl sysnr,%eax
@ -130,7 +130,7 @@ asm
addl $24,%esp
end;
function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64; assembler; [public,alias:'FPC_DOSYS7'];
function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64;{$ifndef VER1_0} oldfpccall;{$endif} assembler; [public,alias:'FPC_DOSYS7'];
asm
movl sysnr,%eax

View File

@ -34,19 +34,22 @@ Type
TSysParam = Longint;
function do_sysCall(sysnr:TSysParam):TSysResult; external name 'FPC_DOSYS0';
function do_sysCall(sysnr,param1:TSysParam):TSysResult; external name 'FPC_DOSYS1';
//function do_sysCall(sysnr,param1:integer):TSysResult; external name 'FPC_DOSYS1w';
function do_sysCall(sysnr,param1,param2:TSysParam):TSysResult; external name 'FPC_DOSYS2';
function do_sysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_DOSYS3';
function do_sysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_DOSYS4';
function do_sysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; external name 'FPC_DOSYS5';
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64; external name 'FPC_DOSYS6';
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64; external name 'FPC_DOSYS7';
function do_sysCall(sysnr:TSysParam):TSysResult;{$ifndef VER1_0} oldfpccall;{$endif} external name 'FPC_DOSYS0';
function do_sysCall(sysnr,param1:TSysParam):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif}external name 'FPC_DOSYS1';
//function do_sysCall(sysnr,param1:integer):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif}external name 'FPC_DOSYS1w';
function do_sysCall(sysnr,param1,param2:TSysParam):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif} external name 'FPC_DOSYS2';
function do_sysCall(sysnr,param1,param2,param3:TSysParam):TSysResult;{$ifndef VER1_0} oldfpccall;{$endif} external name 'FPC_DOSYS3';
function do_sysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult;{$ifndef VER1_0} oldfpccall;{$endif} external name 'FPC_DOSYS4';
function do_sysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; {$ifndef VER1_0} oldfpccall;{$endif} external name 'FPC_DOSYS5';
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64;{$ifndef VER1_0} oldfpccall;{$endif} external name 'FPC_DOSYS6';
function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64; {$ifndef VER1_0} oldfpccall;{$endif} external name 'FPC_DOSYS7';
{
$Log$
Revision 1.7 2003-09-14 20:15:01 marco
Revision 1.8 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.7 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.6 2003/05/30 19:58:40 marco

View File

@ -100,7 +100,7 @@ Begin
Fpopen:=do_syscall(syscall_nr_open,TSysParam(path),TSysParam(flags),TSysParam(mode));
End;
function Fpclose(fd : cint): cint;
function Fpclose(fd : cint): cint; [public, alias : 'FPC_SYSC_CLOSE'];
begin
Fpclose:=do_syscall(syscall_nr_close,fd);
@ -525,10 +525,10 @@ begin
FpGetPID:=do_syscall(syscall_nr_getpid);
end;
function gettimeofday(tp: ptimeval;tzp:ptimezone):cint; [public, alias: 'FPC_SYSC_GETTIMEOFDAY'];
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; [public, alias: 'FPC_SYSC_GETTIMEOFDAY'];
begin
gettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
end;
Function FpNanoSleep(const req : timespec;var rem : timespec) : longint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
@ -598,7 +598,10 @@ end;
{
$Log$
Revision 1.6 2003-09-14 20:15:01 marco
Revision 1.7 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.6 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.5 2003/08/21 22:23:34 olle

View File

@ -21,7 +21,7 @@ Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint; external name 'F
Function FpGetPid:LongInt; external name 'FPC_SYSC_GETPID';
//Function FpReadLink(name,linkname:pchar;maxlen:longint):longint; external name 'FPC_SYSC_READLINK';
function gettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
{ Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or Unix/freebsd}
Function FpNanoSleep (const req : timespec;var rem : timespec) : longint; external name 'FPC_SYSC_NANOSLEEP';
@ -30,7 +30,10 @@ Function Fpgetcwd (path:pchar; siz:size_t):pchar; external name 'FPC_SYSC_GETCWD
{
$Log$
Revision 1.2 2003-09-14 20:15:01 marco
Revision 1.3 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.2 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.1 2003/01/05 19:01:28 marco

View File

@ -90,6 +90,7 @@ begin
LinuxError:=FpGetErrno;
end;
Function StatFS(Path:Pathstr;Var Info:Tstatfs):Boolean;
{
@ -116,7 +117,7 @@ begin
LinuxError:=FpGetErrno;
end;
Function AssignPipe(var pipe_in,pipe_out:longint):boolean;
Function AssignPipe(var pipe_in,pipe_out:longint):boolean; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
{
Sets up a pair of file variables, which act as a pipe. The first one can
be read from, the second one can be written to.
@ -213,7 +214,10 @@ end;
{
$Log$
Revision 1.9 2003-09-15 07:09:58 marco
Revision 1.10 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.9 2003/09/15 07:09:58 marco
* small fixes, round 1
Revision 1.8 2003/09/14 20:15:01 marco

View File

@ -20,13 +20,45 @@ unit Linux;
interface
Type
TSysinfo = packed record
uptime : longint;
loads : array[1..3] of longint;
totalram,
freeram,
sharedram,
bufferram,
totalswap,
freeswap : longint;
procs : integer;
s : string[18];
end;
PSysInfo = ^TSysInfo;
Function Sysinfo(var Info:TSysinfo):Boolean;
implementation
Uses Syscall;
Function Sysinfo(var Info:TSysinfo):Boolean;
{
Get system info
}
Begin
Sysinfo:=do_SysCall(SysCall_nr_Sysinfo,longint(@info))=0;
End;
end.
{
$Log$
Revision 1.1 2003-09-15 14:12:17 marco
Revision 1.2 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.1 2003/09/15 14:12:17 marco
* moved linux.pp contents to linuxold etc

View File

@ -28,11 +28,11 @@ unit oldlinux;
Interface
Uses BaseUnix;
Uses BaseUnix,Unix;
{ Get Types and Constants }
{$i sysconst.inc}
{$i systypes.inc}
//{$i systypes.inc}
{$i ptypes.inc}
{$i ostypes.inc}
@ -142,7 +142,7 @@ const
********************}
Type
{
UTimBuf = packed record{in BSD array[0..1] of timeval, but this is
backwards compatible with linux version}
actime,
@ -156,23 +156,11 @@ Type
{$endif}
: longint;
end;
}
UTimeBuf=UTimBuf;
TUTimeBuf=UTimeBuf;
PUTimeBuf=^UTimeBuf;
TSysinfo = packed record
uptime : longint;
loads : array[1..3] of longint;
totalram,
freeram,
sharedram,
bufferram,
totalswap,
freeswap : longint;
procs : integer;
s : string[18];
end;
PSysInfo = ^TSysInfo;
{******************************************************************************
Procedure/Functions
@ -231,7 +219,7 @@ Function Shell(const Command:String):Longint;
Function Shell(const Command:AnsiString):Longint;
Function Fork:longint;
{Clone for FreeBSD is copied from the LinuxThread port, and rfork based}
function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
//function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
Procedure ExitProcess(val:longint);
Function WaitPid(Pid:longint;Status:pointer;Options:Longint):Longint; {=>PID (Status Valid), 0 (No Status), -1: Error, special case errno=EINTR }
Function WaitProcess(Pid:longint):Longint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
@ -357,7 +345,6 @@ Function GetEnv(P:string):Pchar;
{$ifndef BSD}
Function GetDomainName:String;
Function GetHostName:String;
Function Sysinfo(var Info:TSysinfo):Boolean;
Function Uname(var unamerec:utsname):Boolean;
{$endif}
{**************************
@ -437,7 +424,7 @@ function MUnMap (P : Pointer; Size : Longint) : Boolean;
Port IO functions
***************************}
Function IOperm (From,Num : Cardinal; Value : Longint) : boolean;
//Function IOperm (From,Num : Cardinal; Value : Longint) : boolean;
{$ifndef BSD}
Function IoPL(Level : longint) : Boolean;
{$endif}
@ -502,7 +489,9 @@ Function S_ISSOCK(m:word):boolean;
Implementation
Uses Strings, Unix;
Uses Strings;
{$i ossysch.inc}
{ Get the definitions of textrec and filerec }
@ -968,7 +957,7 @@ end;
{$endif}
{$endif}
{$ifdef BSD}
{$ifdef bsd}
Function stime (t : longint) : Boolean;
begin
@ -1007,8 +996,6 @@ begin
ExecLE(ToDo,EnvP);
end;
{ Include timezone handling routines which use /usr/share/timezone info }
{$i timezone.inc}
@ -1192,7 +1179,7 @@ begin
linuxerror:=fpgeterrno;
end;
{$ifdef BSD}
{$ifdef xBSD}
Function Fcntl(Fd:longint;Cmd:longint):longint;
{
Read or manipulate a file.(See also fcntl (2) )
@ -3143,7 +3130,10 @@ finalization
end.
{
$Log$
Revision 1.1 2003-09-15 14:12:17 marco
Revision 1.2 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.1 2003/09/15 14:12:17 marco
* moved linux.pp contents to linuxold etc
Revision 1.31 2003/09/14 20:15:01 marco

View File

@ -209,8 +209,12 @@ CONST
{$ifdef ver1_0}
Fpmunmap(longint(pthread_getspecific(tlskey)),threadvarblocksize);
{$else}
{$ifdef BSD} // don't ask :-)
Fpmunmap(longint(pthread_getspecific(tlskey)),threadvarblocksize);
{$else}
Fpmunmap(pointer(pthread_getspecific(tlskey)),threadvarblocksize);
{$endif}
{$endif}
end;
{ Include OS independent Threadvar initialization }
@ -432,7 +436,10 @@ initialization
end.
{
$Log$
Revision 1.9 2003-09-14 20:15:01 marco
Revision 1.10 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.9 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.8 2003/03/27 17:14:27 armin

View File

@ -727,7 +727,7 @@ var
year,day,month:Word;
tz:timeval;
begin
gettimeofday(@tz,nil);
fpgettimeofday(@tz,nil);
EpochToLocal(tz.tv_sec,year,month,day,hour,min,sec);
msec:=tz.tv_usec div 1000;
usec:=tz.tv_usec mod 1000;
@ -2155,7 +2155,10 @@ End.
{
$Log$
Revision 1.31 2003-09-14 20:15:01 marco
Revision 1.32 2003-09-15 20:08:49 marco
* small fixes. FreeBSD now cycles
Revision 1.31 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.30 2003/07/08 21:23:24 peter