mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 20:09:18 +02:00
* nano sleep (merged)
This commit is contained in:
parent
c53066252b
commit
19165e8110
@ -592,6 +592,12 @@ begin
|
|||||||
end;
|
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;
|
Function IOCtl(Handle,Ndx: Longint;Data: Pointer):boolean;
|
||||||
{
|
{
|
||||||
@ -631,8 +637,8 @@ begin
|
|||||||
sa.handler.sh:=handler;
|
sa.handler.sh:=handler;
|
||||||
FillChar(sa.sa_mask,sizeof(sigset),#0);
|
FillChar(sa.sa_mask,sizeof(sigset),#0);
|
||||||
sa.sa_flags := 0;
|
sa.sa_flags := 0;
|
||||||
{ if (sigintr and signum) =0 then
{restart behaviour needs libc}
|
{ if (sigintr and signum) =0 then {restart behaviour needs libc}
|
||||||
sa.sa_flags :=sa.sa_flags or SA_RESTART;
}
|
sa.sa_flags :=sa.sa_flags or SA_RESTART;}
|
||||||
sigaction(signum,@sa,@osa);
|
sigaction(signum,@sa,@osa);
|
||||||
if ErrNo<>0 then
|
if ErrNo<>0 then
|
||||||
signal:=NIL
|
signal:=NIL
|
||||||
@ -645,39 +651,42 @@ end;
|
|||||||
|
|
||||||
function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; assembler;
|
function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint; assembler;
|
||||||
asm
|
asm
|
||||||
pushl %esi
|
pushl %esi
|
||||||
movl 12(%ebp), %esi // get stack addr
|
movl 12(%ebp), %esi // get stack addr
|
||||||
subl $4, %esi
|
subl $4, %esi
|
||||||
movl 20(%ebp), %eax // get __arg
|
movl 20(%ebp), %eax // get __arg
|
||||||
movl %eax, (%esi)
|
movl %eax, (%esi)
|
||||||
subl $4, %esi
|
subl $4, %esi
|
||||||
movl 8(%ebp), %eax // get __fn
|
movl 8(%ebp), %eax // get __fn
|
||||||
movl %eax, (%esi)
|
movl %eax, (%esi)
|
||||||
pushl 16(%ebp)
|
pushl 16(%ebp)
|
||||||
pushl %esi
|
pushl %esi
|
||||||
mov syscall_nr_rfork, %eax
|
mov syscall_nr_rfork, %eax
|
||||||
int $0x80 // call actualsyscall
|
int $0x80 // call actualsyscall
|
||||||
jb .L2
|
jb .L2
|
||||||
test %edx, %edx
|
test %edx, %edx
|
||||||
jz .L1
|
jz .L1
|
||||||
movl %esi,%esp
|
movl %esi,%esp
|
||||||
popl %eax
|
popl %eax
|
||||||
call %eax
|
call %eax
|
||||||
addl $8, %esp
|
addl $8, %esp
|
||||||
call halt // Does not return
|
call halt // Does not return
|
||||||
.L2:
|
.L2:
|
||||||
mov %eax,ErrNo
|
mov %eax,ErrNo
|
||||||
mov $-1,%eax
|
mov $-1,%eax
|
||||||
jmp .L1
|
jmp .L1
|
||||||
// jmp PIC_PLT(HIDENAME(cerror))
|
// jmp PIC_PLT(HIDENAME(cerror))
|
||||||
.L1:
|
.L1:
|
||||||
addl $8, %esp
|
addl $8, %esp
|
||||||
popl %esi
|
popl %esi
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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)
|
* Global Linux +bsd to (rtl/freebsd rtl/unix rtl/linux structure)
|
||||||
|
|
||||||
Revision 1.3 2000/09/11 14:05:31 marco
|
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
|
Revision 1.2 2000/07/13 11:33:47 michael
|
||||||
+ removed logs
|
+ removed logs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -845,6 +845,16 @@ begin
|
|||||||
syscall(syscall_nr_pause,sr);
|
syscall(syscall_nr_pause,sr);
|
||||||
end;
|
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;
|
Function IOCtl(Handle,Ndx: Longint;Data: Pointer):boolean;
|
||||||
{
|
{
|
||||||
@ -1170,11 +1180,14 @@ begin
|
|||||||
insb
|
insb
|
||||||
end ['ECX','EDI','EDX'];
|
end ['ECX','EDI','EDX'];
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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)
|
* removed warning (merged)
|
||||||
|
|
||||||
Revision 1.2 2000/09/18 13:14:50 marco
|
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
|
Revision 1.2 2000/07/13 11:33:48 michael
|
||||||
+ removed logs
|
+ removed logs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ var
|
|||||||
{********************
|
{********************
|
||||||
Process
|
Process
|
||||||
********************}
|
********************}
|
||||||
const
{Checked for BSD using Linuxthreads port}
|
const
|
||||||
|
{Checked for BSD using Linuxthreads port}
|
||||||
{ cloning flags }
|
{ cloning flags }
|
||||||
CSIGNAL = $000000ff; // signal mask to be sent at exit
|
CSIGNAL = $000000ff; // signal mask to be sent at exit
|
||||||
CLONE_VM = $00000100; // set if VM shared between processes
|
CLONE_VM = $00000100; // set if VM shared between processes
|
||||||
@ -104,6 +105,12 @@ const
|
|||||||
F_GetOwn = 8;
|
F_GetOwn = 8;
|
||||||
F_SetOwn = 9;
|
F_SetOwn = 9;
|
||||||
|
|
||||||
|
{********************
|
||||||
|
IOCtl(TermIOS)
|
||||||
|
********************}
|
||||||
|
|
||||||
|
{Is too freebsd/Linux specific}
|
||||||
|
|
||||||
{$I termios.inc}
|
{$I termios.inc}
|
||||||
|
|
||||||
{********************
|
{********************
|
||||||
@ -344,6 +351,7 @@ Procedure SigRaise(Sig:integer);
|
|||||||
Function Alarm(Sec : Longint) : longint;
|
Function Alarm(Sec : Longint) : longint;
|
||||||
Procedure Pause;
|
Procedure Pause;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
Function NanoSleep(const req : timespec;var rem : timespec) : longint;
|
||||||
|
|
||||||
{**************************
|
{**************************
|
||||||
IOCtl/Termios Functions
|
IOCtl/Termios Functions
|
||||||
@ -1789,8 +1797,6 @@ end;
|
|||||||
******************************************************************************}
|
******************************************************************************}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Function TCGetAttr(fd:longint;var tios:TermIOS):boolean;
|
Function TCGetAttr(fd:longint;var tios:TermIOS):boolean;
|
||||||
begin
|
begin
|
||||||
{$ifndef BSD}
|
{$ifndef BSD}
|
||||||
@ -1806,7 +1812,7 @@ Function TCSetAttr(fd:longint;OptAct:longint;var tios:TermIOS):boolean;
|
|||||||
var
|
var
|
||||||
nr:longint;
|
nr:longint;
|
||||||
begin
|
begin
|
||||||
{$ifndef BSD}
|
{$ifndef BSD}
|
||||||
case OptAct of
|
case OptAct of
|
||||||
TCSANOW : nr:=TCSETS;
|
TCSANOW : nr:=TCSETS;
|
||||||
TCSADRAIN : nr:=TCSETSW;
|
TCSADRAIN : nr:=TCSETSW;
|
||||||
@ -1842,7 +1848,7 @@ end;
|
|||||||
|
|
||||||
Procedure CFSetOSpeed(var tios:TermIOS;speed:Longint);
|
Procedure CFSetOSpeed(var tios:TermIOS;speed:Longint);
|
||||||
begin
|
begin
|
||||||
{$ifndef BSD}
|
{$ifndef BSD}
|
||||||
CFSetISpeed(tios,speed);
|
CFSetISpeed(tios,speed);
|
||||||
{$else}
|
{$else}
|
||||||
tios.c_ospeed:=speed;
|
tios.c_ospeed:=speed;
|
||||||
@ -1867,21 +1873,20 @@ begin
|
|||||||
with tios do
|
with tios do
|
||||||
begin
|
begin
|
||||||
c_iflag:=c_iflag and (not (IMAXBEL or IXOFF or INPCK or BRKINT or
|
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
|
PARMRK or ISTRIP or INLCR or IGNCR or ICRNL or IXON or
|
||||||
IGNPAR));
|
IGNPAR));
|
||||||
c_iflag:=c_iflag OR IGNBRK;
|
c_iflag:=c_iflag OR IGNBRK;
|
||||||
c_oflag:=c_oflag and (not OPOST);
|
c_oflag:=c_oflag and (not OPOST);
|
||||||
c_lflag:=c_lflag and (not (ECHO or ECHOE or ECHOK or ECHONL or ICANON or
|
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));
|
ISIG or IEXTEN or NOFLSH or TOSTOP or PENDIN));
|
||||||
c_cflag:=(c_cflag and (not (CSIZE or PARENB))) or (CS8 OR cread);
|
c_cflag:=(c_cflag and (not (CSIZE or PARENB))) or (CS8 OR cread);
|
||||||
c_cc[VMIN]:=1;
|
c_cc[VMIN]:=1;
|
||||||
c_cc[VTIME]:=0;
|
c_cc[VTIME]:=0;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Function TCSendBreak(fd,duration:longint):boolean;
|
Function TCSendBreak(fd,duration:longint):boolean;
|
||||||
begin
|
begin
|
||||||
{$ifndef BSD}
|
{$ifndef BSD}
|
||||||
@ -2603,7 +2608,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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.
|
* FreeBSD TermIOS support and minor changes to some related files.
|
||||||
|
|
||||||
Revision 1.3 2000/10/10 12:02:35 marco
|
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
|
Revision 1.6 2000/09/11 14:05:31 marco
|
||||||
* FreeBSD support and removed old signalhandling
|
* FreeBSD support and removed old signalhandling
|
||||||
|
|
||||||
|
|
||||||
Revision 1.5 2000/09/06 20:47:34 peter
|
Revision 1.5 2000/09/06 20:47:34 peter
|
||||||
* removed previous fsplit() patch as it's not the correct behaviour for
|
* removed previous fsplit() patch as it's not the correct behaviour for
|
||||||
LFNs. The code showing the bug could easily be adapted (merged)
|
LFNs. The code showing the bug could easily be adapted (merged)
|
||||||
|
Loading…
Reference in New Issue
Block a user