mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-29 09:19:37 +02:00
* fixed sparc alignment issues with popen/pclose
git-svn-id: trunk@4346 -
This commit is contained in:
parent
848b7b8914
commit
7522d8d967
@ -17,25 +17,31 @@ Function PClose(Var F:file) : cint;
|
||||
var
|
||||
pl : ^cint;
|
||||
res : cint;
|
||||
pid: cint;
|
||||
|
||||
begin
|
||||
fpclose(filerec(F).Handle);
|
||||
{ closed our side, Now wait for the other - this appears to be needed ?? }
|
||||
pl:=@(filerec(f).userdata[2]);
|
||||
fpwaitpid(pl^,@res,0);
|
||||
{ avoid alignment error on sparc }
|
||||
move(pl^,pid,sizeof(pid));
|
||||
fpwaitpid(pid,@res,0);
|
||||
pclose:=res shr 8;
|
||||
end;
|
||||
|
||||
Function PClose(Var F:text) :cint;
|
||||
var
|
||||
pl : ^longint;
|
||||
res : longint;
|
||||
pl : ^cint;
|
||||
res : cint;
|
||||
pid: cint;
|
||||
|
||||
begin
|
||||
fpclose(Textrec(F).Handle);
|
||||
{ closed our side, Now wait for the other - this appears to be needed ?? }
|
||||
pl:=@(textrec(f).userdata[2]);
|
||||
fpwaitpid(pl^,@res,0);
|
||||
{ avoid alignment error on sparc }
|
||||
move(pl^,pid,sizeof(pid));
|
||||
fpwaitpid(pid,@res,0);
|
||||
pclose:=res shr 8;
|
||||
end;
|
||||
{$ENDIF}
|
||||
@ -110,4 +116,4 @@ Function fpFlock (fd,mode : longint) : cint;
|
||||
if (result=-1) and (errno=EACCES)
|
||||
errno:=EWOULDBLOCK;
|
||||
}
|
||||
end;
|
||||
end;
|
||||
|
@ -859,7 +859,8 @@ begin
|
||||
textrec(f).bufptr:=@textrec(f).buffer;
|
||||
{Save the process ID - needed when closing }
|
||||
pl:=@(textrec(f).userdata[2]);
|
||||
pl^:=pid;
|
||||
{ avoid alignment error on sparc }
|
||||
move(pid,pl^,sizeof(pid));
|
||||
textrec(f).closefunc:=@PCloseText;
|
||||
end;
|
||||
POpen:=0;
|
||||
@ -972,7 +973,8 @@ begin
|
||||
end;
|
||||
{Save the process ID - needed when closing }
|
||||
pl:=@(filerec(f).userdata[2]);
|
||||
pl^:=pid;
|
||||
{ avoid alignment error on sparc }
|
||||
move(pid,pl^,sizeof(pid));
|
||||
end;
|
||||
POpen:=0;
|
||||
end;
|
||||
@ -1035,11 +1037,13 @@ begin
|
||||
close(pipi);
|
||||
{Save the process ID - needed when closing }
|
||||
pl:=@(textrec(StreamIn).userdata[2]);
|
||||
pl^:=pid;
|
||||
{ avoid alignment error on sparc }
|
||||
move(pid,pl^,sizeof(pid));
|
||||
textrec(StreamIn).closefunc:=@PCloseText;
|
||||
{Save the process ID - needed when closing }
|
||||
pl:=@(textrec(StreamOut).userdata[2]);
|
||||
pl^:=pid;
|
||||
{ avoid alignment error on sparc }
|
||||
move(pid,pl^,sizeof(pid));
|
||||
textrec(StreamOut).closefunc:=@PCloseText;
|
||||
AssignStream:=Pid;
|
||||
end;
|
||||
@ -1125,15 +1129,18 @@ begin
|
||||
Close(PipeIn);
|
||||
// Save the process ID - needed when closing
|
||||
pl := @(TextRec(StreamIn).userdata[2]);
|
||||
pl^ := pid;
|
||||
{ avoid alignment error on sparc }
|
||||
move(pid,pl^,sizeof(pid));
|
||||
TextRec(StreamIn).closefunc := @PCloseText;
|
||||
// Save the process ID - needed when closing
|
||||
pl := @(TextRec(StreamOut).userdata[2]);
|
||||
pl^ := pid;
|
||||
{ avoid alignment error on sparc }
|
||||
move(pid,pl^,sizeof(pid));
|
||||
TextRec(StreamOut).closefunc := @PCloseText;
|
||||
// Save the process ID - needed when closing
|
||||
pl := @(TextRec(StreamErr).userdata[2]);
|
||||
pl^ := pid;
|
||||
{ avoid alignment error on sparc }
|
||||
move(pid,pl^,sizeof(pid));
|
||||
TextRec(StreamErr).closefunc := @PCloseText;
|
||||
AssignStream := pid;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user