* fixed sparc alignment issues with popen/pclose

git-svn-id: trunk@4346 -
This commit is contained in:
Jonas Maebe 2006-08-04 13:07:01 +00:00
parent 848b7b8914
commit 7522d8d967
2 changed files with 25 additions and 12 deletions

View File

@ -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;

View File

@ -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;