* nano sleep (merged)

This commit is contained in:
peter 2000-10-26 22:51:12 +00:00
parent c53066252b
commit 19165e8110
3 changed files with 77 additions and 48 deletions

View File

@ -592,6 +592,12 @@ begin
end;
Function NanoSleep(const req : timespec;var rem : timespec) : longint;
begin
NanoSleep:=Do_SysCall(syscall_nr_nanosleep,longint(@req),longint(@rem));
LinuxError:=Errno;
end;
Function IOCtl(Handle,Ndx: Longint;Data: Pointer):boolean;
{
@ -631,8 +637,8 @@ begin
sa.handler.sh:=handler;
FillChar(sa.sa_mask,sizeof(sigset),#0);
sa.sa_flags := 0;
{ if (sigintr and signum) =0 then {restart behaviour needs libc}
sa.sa_flags :=sa.sa_flags or SA_RESTART; }
{ if (sigintr and signum) =0 then {restart behaviour needs libc}
sa.sa_flags :=sa.sa_flags or SA_RESTART;}
sigaction(signum,@sa,@osa);
if ErrNo<>0 then
signal:=NIL
@ -645,39 +651,42 @@ end;
function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; assembler;
asm
pushl %esi
movl 12(%ebp), %esi // get stack addr
subl $4, %esi
movl 20(%ebp), %eax // get __arg
movl %eax, (%esi)
subl $4, %esi
movl 8(%ebp), %eax // get __fn
movl %eax, (%esi)
pushl 16(%ebp)
pushl %esi
mov syscall_nr_rfork, %eax
int $0x80 // call actualsyscall
jb .L2
test %edx, %edx
jz .L1
movl %esi,%esp
popl %eax
call %eax
addl $8, %esp
call halt // Does not return
.L2:
mov %eax,ErrNo
mov $-1,%eax
jmp .L1
// jmp PIC_PLT(HIDENAME(cerror))
pushl %esi
movl 12(%ebp), %esi // get stack addr
subl $4, %esi
movl 20(%ebp), %eax // get __arg
movl %eax, (%esi)
subl $4, %esi
movl 8(%ebp), %eax // get __fn
movl %eax, (%esi)
pushl 16(%ebp)
pushl %esi
mov syscall_nr_rfork, %eax
int $0x80 // call actualsyscall
jb .L2
test %edx, %edx
jz .L1
movl %esi,%esp
popl %eax
call %eax
addl $8, %esp
call halt // Does not return
.L2:
mov %eax,ErrNo
mov $-1,%eax
jmp .L1
// jmp PIC_PLT(HIDENAME(cerror))
.L1:
addl $8, %esp
popl %esi
addl $8, %esp
popl %esi
end;
{
$Log$
Revision 1.2 2000-09-18 13:14:50 marco
Revision 1.3 2000-10-26 22:51:12 peter
* nano sleep (merged)
Revision 1.2 2000/09/18 13:14:50 marco
* Global Linux +bsd to (rtl/freebsd rtl/unix rtl/linux structure)
Revision 1.3 2000/09/11 14:05:31 marco
@ -685,5 +694,5 @@ end;
Revision 1.2 2000/07/13 11:33:47 michael
+ removed logs
}
}

View File

@ -845,6 +845,16 @@ begin
syscall(syscall_nr_pause,sr);
end;
Function NanoSleep(const req : timespec;var rem : timespec) : longint;
var Sr : Syscallregs;
begin
sr.reg2:=longint(@req);
sr.reg3:=longint(@rem);
NanoSleep:=Syscall(syscall_nr_nanosleep,sr);
LinuxError:=Errno;
end;
Function IOCtl(Handle,Ndx: Longint;Data: Pointer):boolean;
{
@ -1170,11 +1180,14 @@ begin
insb
end ['ECX','EDI','EDX'];
end;
{$ENDIF}
{$ENDIF}
{
$Log$
Revision 1.3 2000-10-02 17:57:37 peter
Revision 1.4 2000-10-26 22:51:12 peter
* nano sleep (merged)
Revision 1.3 2000/10/02 17:57:37 peter
* removed warning (merged)
Revision 1.2 2000/09/18 13:14:50 marco
@ -1188,5 +1201,5 @@ end;
Revision 1.2 2000/07/13 11:33:48 michael
+ removed logs
}

View File

@ -33,7 +33,8 @@ var
{********************
Process
********************}
const {Checked for BSD using Linuxthreads port}
const
{Checked for BSD using Linuxthreads port}
{ cloning flags }
CSIGNAL = $000000ff; // signal mask to be sent at exit
CLONE_VM = $00000100; // set if VM shared between processes
@ -104,6 +105,12 @@ const
F_GetOwn = 8;
F_SetOwn = 9;
{********************
IOCtl(TermIOS)
********************}
{Is too freebsd/Linux specific}
{$I termios.inc}
{********************
@ -344,6 +351,7 @@ Procedure SigRaise(Sig:integer);
Function Alarm(Sec : Longint) : longint;
Procedure Pause;
{$endif}
Function NanoSleep(const req : timespec;var rem : timespec) : longint;
{**************************
IOCtl/Termios Functions
@ -1789,8 +1797,6 @@ end;
******************************************************************************}
Function TCGetAttr(fd:longint;var tios:TermIOS):boolean;
begin
{$ifndef BSD}
@ -1806,7 +1812,7 @@ Function TCSetAttr(fd:longint;OptAct:longint;var tios:TermIOS):boolean;
var
nr:longint;
begin
{$ifndef BSD}
{$ifndef BSD}
case OptAct of
TCSANOW : nr:=TCSETS;
TCSADRAIN : nr:=TCSETSW;
@ -1842,7 +1848,7 @@ end;
Procedure CFSetOSpeed(var tios:TermIOS;speed:Longint);
begin
{$ifndef BSD}
{$ifndef BSD}
CFSetISpeed(tios,speed);
{$else}
tios.c_ospeed:=speed;
@ -1867,21 +1873,20 @@ begin
with tios do
begin
c_iflag:=c_iflag and (not (IMAXBEL or IXOFF or INPCK or BRKINT or
PARMRK or ISTRIP or INLCR or IGNCR or ICRNL or IXON or
IGNPAR));
PARMRK or ISTRIP or INLCR or IGNCR or ICRNL or IXON or
IGNPAR));
c_iflag:=c_iflag OR IGNBRK;
c_oflag:=c_oflag and (not OPOST);
c_lflag:=c_lflag and (not (ECHO or ECHOE or ECHOK or ECHONL or ICANON or
ISIG or IEXTEN or NOFLSH or TOSTOP or PENDIN));
c_lflag:=c_lflag and (not (ECHO or ECHOE or ECHOK or ECHONL or ICANON or
ISIG or IEXTEN or NOFLSH or TOSTOP or PENDIN));
c_cflag:=(c_cflag and (not (CSIZE or PARENB))) or (CS8 OR cread);
c_cc[VMIN]:=1;
c_cc[VTIME]:=0;
end;
end;
{$endif}
end;
Function TCSendBreak(fd,duration:longint):boolean;
begin
{$ifndef BSD}
@ -2603,7 +2608,10 @@ End.
{
$Log$
Revision 1.4 2000-10-11 13:59:16 marco
Revision 1.5 2000-10-26 22:51:12 peter
* nano sleep (merged)
Revision 1.4 2000/10/11 13:59:16 marco
* FreeBSD TermIOS support and minor changes to some related files.
Revision 1.3 2000/10/10 12:02:35 marco
@ -2619,7 +2627,6 @@ End.
Revision 1.6 2000/09/11 14:05:31 marco
* FreeBSD support and removed old signalhandling
Revision 1.5 2000/09/06 20:47:34 peter
* removed previous fsplit() patch as it's not the correct behaviour for
LFNs. The code showing the bug could easily be adapted (merged)