+ Add modify_ldt to linux unit

+ Add sched_yield to linux unit
  - Remove clone for m68k from linux unit (unimplemented assembler section)
  + Add fpsigtimedwait to baseunix unit

git-svn-id: trunk@15602 -
This commit is contained in:
daniel 2010-07-18 21:53:26 +00:00
parent 99a75c56fc
commit 1009a84e25
6 changed files with 51 additions and 46 deletions

View File

@ -50,6 +50,16 @@ begin
FPsigsuspend:= do_syscall(syscall_nr_sigsuspend,TSysParam(@sigmask)); FPsigsuspend:= do_syscall(syscall_nr_sigsuspend,TSysParam(@sigmask));
end; end;
function fpsigtimedwait(const sigset:TSigSet;info:Psiginfo;timeout:Ptimespec):cint;
begin
FpSigTimedWait:=do_syscall(syscall_nr_sigtimedwait,
Tsysparam(@sigset),
Tsysparam(info),
Tsysparam(timeout));
end;
Type // implementation side for now. Should move to BSD unit. Type // implementation side for now. Should move to BSD unit.
ITimerVal= Record ITimerVal= Record
It_Interval, It_Interval,

View File

@ -205,6 +205,7 @@ syscall_nr_getdirentries =196;
syscall_nr_sigaction =342; syscall_nr_sigaction =342;
syscall_nr_sigpending =343; syscall_nr_sigpending =343;
syscall_nr_sigreturn =344; syscall_nr_sigreturn =344;
syscall_nr_sigtimedwait =345;
syscall_nr___acl_get_file =347; syscall_nr___acl_get_file =347;
syscall_nr___acl_set_file =348; syscall_nr___acl_set_file =348;
syscall_nr___acl_get_fd =349; syscall_nr___acl_get_fd =349;
@ -305,6 +306,7 @@ syscall_nr_getdirentries =196;
syscall_nr_sigpending = 343; syscall_nr_sigpending = 343;
syscall_nr_sigprocmask = 340; syscall_nr_sigprocmask = 340;
syscall_nr_sigsuspend = 341; syscall_nr_sigsuspend = 341;
syscall_nr_sigtimedwait = 345;
syscall_nr_socket = 97; syscall_nr_socket = 97;
syscall_nr_socketpair = 135; syscall_nr_socketpair = 135;
syscall_nr_stat = 188; syscall_nr_stat = 188;

View File

@ -50,6 +50,19 @@ begin
fpsigsuspend:= do_syscall(syscall_nr_rt_sigsuspend,TSysParam(@sigmask),TSysParam(8)); fpsigsuspend:= do_syscall(syscall_nr_rt_sigsuspend,TSysParam(@sigmask),TSysParam(8));
end; end;
function fpsigtimedwait(const sigset:TSigSet;info:Psiginfo;timeout:Ptimespec):cint;
begin
{Sizeof(Tsigset)=16 for Free Pascal, but the Linux kernel has a different idea,
it wants a Tsigset of 8 bytes. So we have to hardcode :( }
FpSigTimedWait:=do_syscall(syscall_nr_rt_sigtimedwait,
Tsysparam(@sigset),
Tsysparam(info),
Tsysparam(timeout),
Tsysparam(8 {sizeof(Tsigset)}));
end;
Type Type
ITimerVal= Record ITimerVal= Record
It_Interval, It_Interval,

View File

@ -186,9 +186,6 @@ type
{$ifdef cpui386} {$ifdef cpui386}
{$define clone_implemented} {$define clone_implemented}
{$endif} {$endif}
{$ifdef cpum68k}
{$define clone_implemented}
{$endif}
{$ifdef clone_implemented} {$ifdef clone_implemented}
function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; {$ifdef FPC_USE_LIBC} cdecl; external name 'clone'; {$endif} function clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; {$ifdef FPC_USE_LIBC} cdecl; external name 'clone'; {$endif}
@ -221,6 +218,9 @@ type
TUser_Desc = user_desc; TUser_Desc = user_desc;
PUser_Desc = ^user_desc; PUser_Desc = ^user_desc;
function modify_ldt(func:cint;p:pointer;bytecount:culong):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'modify_ldt'; {$endif}
procedure sched_yield; {$ifdef FPC_USE_LIBC} cdecl; external name 'sched_yield'; {$endif}
type type
EPoll_Data = record EPoll_Data = record
@ -367,7 +367,7 @@ begin
{ Do the system call } { Do the system call }
pushl %ebx pushl %ebx
movl flags,%ebx movl flags,%ebx
movl SysCall_nr_clone,%eax movl syscall_nr_clone,%eax
int $0x80 int $0x80
popl %ebx popl %ebx
test %eax,%eax test %eax,%eax
@ -378,53 +378,30 @@ begin
call *%ebx call *%ebx
{ exit process } { exit process }
movl %eax,%ebx movl %eax,%ebx
movl $1,%eax movl syscall_nr_exit,%eax
int $0x80 int $0x80
.Lclone_end: .Lclone_end:
movl %eax,__RESULT movl %eax,__RESULT
end; end;
{$endif cpui386} {$endif cpui386}
{$ifdef cpum68k}
{ No yet translated, my m68k assembler is too weak for such things PM }
(*
asm
{ Insert the argument onto the new stack. }
movl sp,%ecx
subl $8,%ecx
movl args,%eax
movl %eax,4(%ecx)
{ Save the function pointer as the zeroth argument.
It will be popped off in the child in the ebx frobbing below. }
movl func,%eax
movl %eax,0(%ecx)
{ Do the system call }
pushl %ebx
movl flags,%ebx
movl SysCall_nr_clone,%eax
int $0x80
popl %ebx
test %eax,%eax
jnz .Lclone_end
{ We're in the new thread }
subl %ebp,%ebp { terminate the stack frame }
call *%ebx
{ exit process }
movl %eax,%ebx
movl $1,%eax
int $0x80
.Lclone_end:
movl %eax,__RESULT
end;
*)
{$endif cpum68k}
end; end;
{$endif} {$endif}
function modify_ldt(func:cint;p:pointer;bytecount:culong):cint;
begin
modify_ldt:=do_syscall(syscall_nr_modify_ldt,Tsysparam(func),
Tsysparam(p),
Tsysparam(bytecount));
end;
procedure sched_yield;
begin
do_syscall(syscall_nr_sched_yield);
end;
function epoll_create(size: cint): cint; function epoll_create(size: cint): cint;
begin begin
epoll_create := do_syscall(syscall_nr_epoll_create,tsysparam(size)); epoll_create := do_syscall(syscall_nr_epoll_create,tsysparam(size));

View File

@ -20,10 +20,11 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
// if you are looking for macro definitions or non C template overloaded versions, 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; external name 'FPC_SYSC_SIGPROCMASK'; Function FpSigProcMask (how : cInt; nset : pSigSet; oset : pSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
Function FpSigProcMask(how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK'; Function FpSigProcMask (how : cInt; Const nset : TSigSet; var oset : TSigSet): cInt; external name 'FPC_SYSC_SIGPROCMASK';
Function FpSigPending (var nset : TSigSet): cInt; Function FpSigPending (var nset : TSigSet): cInt;
Function FpSigSuspend (Const sigmask : TSigSet): cInt; Function FpSigSuspend (Const sigmask : TSigSet): cInt;
Function FpSigTimedWait (Const sigset : TSigSet; info : Psiginfo; timeout:Ptimespec): cInt;
Function FpUmask (cmask : TMode): TMode; Function FpUmask (cmask : TMode): TMode;
Function FpLink (existing : pChar; newone : pChar): cInt; Function FpLink (existing : pChar; newone : pChar): cInt;

View File

@ -65,6 +65,8 @@ const
Function FpGetcwd (path:pChar; siz:TSize):pChar; cdecl; external clib name 'getcwd'; Function FpGetcwd (path:pChar; siz:TSize):pChar; cdecl; external clib name 'getcwd';
function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external clib name 'sigprocmask'; function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint;cdecl; external clib name 'sigprocmask';
function FPSigProcMask(how:cint;const nset : sigset;var oset : sigset):cint;cdecl; external clib name 'sigprocmask'; function FPSigProcMask(how:cint;const nset : sigset;var oset : sigset):cint;cdecl; external clib name 'sigprocmask';
Function FpSigTimedWait (Const sigset : TSigSet; info : Psiginfo; timeout:Ptimespec): cInt; cdecl; external clib name 'sigtimedwait';
Function FpSigTimedWait (Const sigset : TSigSet; info : Psiginfo; var timeout:Ttimespec): cInt; cdecl; external clib name 'sigtimedwait';
function FpTime (tloc:ptime_t): time_t; cdecl; external clib name 'time'; function FpTime (tloc:ptime_t): time_t; cdecl; external clib name 'time';
Function FpTime (var tloc : Time_t): Time_t; cdecl; external clib name 'time'; Function FpTime (var tloc : Time_t): Time_t; cdecl; external clib name 'time';
function FpTimes (var buffer : tms): TClock; cdecl; external clib name 'times'; function FpTimes (var buffer : tms): TClock; cdecl; external clib name 'times';