tweak code to work with darwin

git-svn-id: trunk@8275 -
This commit is contained in:
micha 2005-12-08 11:30:15 +00:00
parent 87bb2cef8b
commit 10b74e3eb0
2 changed files with 11 additions and 1 deletions

View File

@ -70,6 +70,11 @@ end;
uses BaseUnix, TermIO;
{$ifdef DARWIN}
const
FIONREAD = $4004667;
{$endif}
function TAsyncProcess.GetNumBytesAvailable: dword;
begin
if not (poUsePipes in Options) then
@ -79,7 +84,7 @@ begin
// FIONSPACE -> bytes available for writing without blocking
// does not work on all platforms (not defined on linux e.g.)
{$ifdef UseLinuxThreading}
if fpioctl(Output.Handle, $4004667f, @Result) = -1 then
if fpioctl(Output.Handle, FIONREAD, @Result) = -1 then
{$ENDIF}
Result := 0;
end;

View File

@ -137,8 +137,13 @@ var
threadsync_giochannel: pgiochannel;
childsig_pending: boolean;
{$ifdef DARWIN}
procedure ChildEventHandler(sig: longint; var siginfo: tsiginfo_t;
var sigcontext: sigcontextrec); cdecl;
{$else}
procedure ChildEventHandler(sig: longint; siginfo: psiginfo;
sigcontext: psigcontext); cdecl;
{$endif}
begin
childsig_pending := true;
WakeMainThread(nil);