* pipe cleanup from Ales, also fixes TProcess for AMD64.

git-svn-id: trunk@12006 -
This commit is contained in:
marco 2008-11-01 11:43:43 +00:00
parent 65637e301f
commit e0821f6682
2 changed files with 5 additions and 55 deletions

View File

@ -45,26 +45,13 @@ Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_
{
Sets up a pair of file variables, which act as a pipe. The first one can
be read from, the second one can be written to.
If the operation was unsuccesful, linuxerror is set.
If the operation was unsuccesful, errno is set.
}
var
ret : longint;
errn : cint;
{$ifdef FPC_USE_LIBC}
fdis : array[0..1] of cint;
{$endif}
pip : tfildes;
begin
{$ifndef FPC_USE_LIBC}
ret:=intAssignPipe(pipe_in,pipe_out,errn);
if ret=-1 Then
fpseterrno(errn);
{$ELSE}
fdis[0]:=pipe_in;
fdis[1]:=pipe_out;
ret:=pipe(fdis);
pipe_in:=fdis[0];
pipe_out:=fdis[1];
{$ENDIF}
AssignPipe:=ret;
assignPipe:=fppipe(pip);
pipe_in:=pip[0];
pipe_out:=pip[1];
end;

View File

@ -84,43 +84,6 @@ begin
fpFlock:=do_syscall(syscall_nr_flock,fd,mode);
end;
{$ifdef CPUI386}
// needs oldfpccall;
Function intAssignPipe(var pipe_in,pipe_out:longint;var errn:cint):cint; oldfpccall;
{
Sets up a pair of file variables, which act as a pipe. The first one can
be read from, the second one can be written to.
If the operation was unsuccesful, linuxerror is set.
}
begin
asm
mov $42,%eax
int $0x80
jb .Lerror
mov pipe_in,%ebx
mov %eax,(%ebx)
mov pipe_out,%ebx
mov $0,%eax
mov %edx,(%ebx)
mov %eax,%ebx
jmp .Lexit
.Lerror:
mov %eax,%ebx
mov $-1,%eax
.Lexit:
mov Errn,%edx
mov %ebx,(%edx)
end;
end;
{$else CPUI386}
Function intAssignPipe(var pipe_in,pipe_out:longint;var errn:cint):cint; oldfpccall;
begin
runerror(217);
end;
{$endif CPUI386}
function MUnMap (P : Pointer; Size : size_t) : cint;
begin
MUnMap:=do_syscall(syscall_nr_munmap,TSysParam(P),Size);