* save/restore errno inside reenable_signal, because it can be called

from inside signal handlers

git-svn-id: trunk@12997 -
This commit is contained in:
Jonas Maebe 2009-04-04 09:59:41 +00:00
parent ba10015c04
commit 1f6ec36064
5 changed files with 21 additions and 1 deletions

View File

@ -298,6 +298,7 @@ function reenable_signal(sig : longint) : boolean;
var
e : TSigSet;
i,j : byte;
olderrno: cint;
begin
fillchar(e,sizeof(e),#0);
{ set is 1 based PM }
@ -305,8 +306,11 @@ begin
i:=sig mod (sizeof(cuLong) * 8);
j:=sig div (sizeof(cuLong) * 8);
e[j]:=1 shl i;
{ this routine is called from a signal handler, so must not change errno }
olderrno:=geterrno;
fpsigprocmask(SIG_UNBLOCK,@e,nil);
reenable_signal:=geterrno=0;
seterrno(olderrno);
end;
// signal handler is arch dependant due to processorexception to language

View File

@ -153,6 +153,7 @@ function reenable_signal(sig : longint) : boolean;
var
e,oe : TSigSet;
i,j : byte;
olderrno: cint;
begin
fillchar(e,sizeof(e),#0);
fillchar(oe,sizeof(oe),#0);
@ -161,8 +162,11 @@ begin
i:=sig mod 32;
j:=sig div 32;
e[j]:=1 shl i;
{ this routine is called from a signal handler, so must not change errno }
olderrno:=geterrno;
fpsigprocmask(SIG_UNBLOCK,@e,@oe);
reenable_signal:=geterrno=0;
seterrno(olderrno);
end;
{$i sighnd.inc}

View File

@ -298,6 +298,7 @@ function reenable_signal(sig : longint) : boolean;
var
e : TSigSet;
i,j : byte;
olderrno: cint;
begin
fillchar(e,sizeof(e),#0);
{ set is 1 based PM }
@ -305,8 +306,11 @@ begin
i:=sig mod (sizeof(cuLong) * 8);
j:=sig div (sizeof(cuLong) * 8);
e[j]:=1 shl i;
{ this routine is called from a signal handler, so must not change errno }
olderrno:=geterrno;
fpsigprocmask(SIG_UNBLOCK,@e,nil);
reenable_signal:=geterrno=0;
seterrno(olderrno);
end;
// signal handler is arch dependant due to processorexception to language
@ -454,4 +458,4 @@ begin
initunicodestringmanager;
{$endif VER2_2}
setupexecname;
end.
end.

View File

@ -216,6 +216,7 @@ function reenable_signal(sig : longint) : boolean;
var
e : TSigSet;
i,j : byte;
olderrno: cint;
begin
fillchar(e,sizeof(e),#0);
{ set is 1 based PM }
@ -223,8 +224,11 @@ begin
i:=sig mod (sizeof(cuLong) * 8);
j:=sig div (sizeof(cuLong) * 8);
e[j]:=1 shl i;
{ this routine is called from a signal handler, so must not change errno }
olderrno:=geterrno;
fpsigprocmask(SIG_UNBLOCK,@e,nil);
reenable_signal:=geterrno=0;
seterrno(olderrno);
end;
// signal handler is arch dependant due to processorexception to language

View File

@ -103,6 +103,7 @@ function reenable_signal(sig : longint) : boolean;
var
e,oe : TSigSet;
i,j : byte;
olderrno: cint;
begin
fillchar(e,sizeof(e),#0);
fillchar(oe,sizeof(oe),#0);
@ -111,8 +112,11 @@ begin
i:=sig mod 32;
j:=sig div 32;
e[j]:=1 shl i;
{ this routine is called from a signal handler, so must not change errno }
olderrno:=geterrno;
fpsigprocmask(SIG_UNBLOCK,@e,@oe);
reenable_signal:=geterrno=0;
seterrno(olderrno);
end;
{$i sighnd.inc}