[fpc-pascal]Problem with daemon.pp

Nylund Sakari nylsak at nic.fi
Sun Sep 10 12:52:14 CEST 2000


Hello !
 
I'm new on this list and perhaps have missed info what I'm looking for...  
forgive me .  I upgraded to latest fpc (1.0). I think I had previously
something 0.99-?(abt year old or so).
 
Then I returned to daemon.pp that is introduced on UNITS section of
fpc-homepages. Previously I managed to compile daemon.pp and also made
some programs of my own using this source as base. Now I found out that I
cant use (compile) them any more with new version of fpc.  First problem
in daemon.pp was:
  new(aHup);
  new(aTerm);
    aTerm^.sa_handler := @DoSig;  <-------------here
    aTerm^.sa_mask := 0;
    aTerm^.sa_flags := 0;
    aTerm^.sa_restorer := nil;
    aHup^.sa_handler := @DoSig;  <-------------and here
    aHup^.sa_mask := 0;
 
After some thinking and manual reading :-O I replaced "aTerm^.sa_handler"
as "aTerm^.handler.sh"  and passed all without erros in compile.   

How ever, running program will not work. It gives runtime error 2. I have
pinpointed erro to:
 
  Case pid of
       0 : Begin { we are in the child }
          Close(input);  { close standard in }
          Close(output); { close standard out }
          Assign(output,'/dev/null');
          ReWrite(output);  <--------- HERE
          Close(stderr); { close standard error }
          Assign(stderr,'/dev/null');
          ReWrite(stderr);  <----------AND HERE
 
 Now I just do not have any more ideas !
 I tested also with: program test; uses Linux; var ofile : text;  Begin
       Assign ofile,ยด/dev/null');
       rewrite(ofile);
       close(ofile);
 end.
 
Compiles OK, but ends also to runtime error 2 !
 
Any ideas ? Something has changed between fpc versions but I can not dig
it
out from manuals or homepage ! (I guess it's there, I just can't see it
;-(  )  

Please help !
Saku  oh1kh at sral.fi 






More information about the fpc-pascal mailing list