Am Samstag, den 20.10.2007, 18:54 +0200 schrieb Jonas Maebe:
> On 20 Oct 2007, at 18:20, Marc Santhoff wrote:
> 
> >> writeln(stderr, '--> hit found: '+inttostr(fcnt) + ' - ' +
> >> inttostr(PInteger(longint(adr)-longint(fx))^) + ' - ' +
> >> floattostr(PSingle(adr)^));
> >
> > Very nasty thing:
> >
> > The output channel is temporarily blocked and gives back "EAGAIN".
> 
> I guess the initialisation code of the system unit should close and  
> reopen stdin/out/err to make sure none of them is configured for non- 
> blocking I/O.

Hm, I'm doing nothing but using an xterm for compiling and running the
program. System.pp does only open as far as I can tell:

<rtl/inc/tex.inc>
...
procedure OpenStdIO(var f:text;mode,hdl:longint);
begin
  Assign(f,'');
  TextRec(f).Handle:=hdl;
  TextRec(f).Mode:=mode;
  TextRec(f).Closefunc:[EMAIL PROTECTED];
  case mode of
    fmInput :
      TextRec(f).InOutFunc:[EMAIL PROTECTED];
    fmOutput :
      begin
        TextRec(f).InOutFunc:[EMAIL PROTECTED];
        if Do_Isdevice(hdl) then
          TextRec(f).FlushFunc:[EMAIL PROTECTED];
      end;
  else
   HandleError(102);
  end;
end;
...
</rtl/inc/tex.inc>

<rtl/bsd/system.pp>
...
procedure SysInitStdIO;
begin
  OpenStdIO(Input,fmInput,StdInputHandle);
  OpenStdIO(Output,fmOutput,StdOutputHandle);
  OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
  OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  OpenStdIO(StdErr,fmOutput,StdErrorHandle);
end;

...

Begin
  IsConsole := TRUE;
  IsLibrary := FALSE;
  StackLength := CheckInitialStkLen(InitialStkLen);
  StackBottom := Sptr - StackLength;
  { Set up signals handlers }
  InstallSignals;
  { Setup heap }
  InitHeap;
  SysInitExceptions;
  { Setup stdin, stdout and stderr }
  SysInitStdIO;
  { Reset IO Error }
  InOutRes:=0;
  { Arguments }
  SetupCmdLine;
  { threading }
  InitSystemThreads;
  initvariantmanager;
  initwidestringmanager;
End.
</<rtl/bsd/system.pp>>

Maybe it is an OS fault(?) ...

Marc


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to