Re: Fork, session leader and printing to stdout

From: Henrique de Moraes Holschuh (hmh_at_debian.org)
Date: 11/23/04

  • Next message: ms linux: "Re: Not recieving e-mails from this list anymore"
    Date: Tue, 23 Nov 2004 09:27:04 -0200
    To: Shaul Karl <shaulk@013.net>
    
    

    On Tue, 23 Nov 2004, Shaul Karl wrote:
    > What will happen when a daemon process with no controlling terminal
    > tries to print to its stdout?

    It depends. Many daemons guard against this by opening /dev/null on
    descriptors 0, 1 and 2.

    Otherwise, they will get a write error. Most code doesn't check for them
    when printing out messages, so nothing weird happens.

    > More specifically, consider the following pseudo code:

    It won't work, it is full of errors :P and you want to fclose(stdout), too.

    -- 
      "One disk to rule them all, One disk to find them. One disk to bring
      them all and in the darkness grind them. In the Land of Redmond
      where the shadows lie." -- The Silicon Valley Tarot
      Henrique Holschuh
    -- 
    To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: ms linux: "Re: Not recieving e-mails from this list anymore"

    Relevant Pages

    • Fork, session leader and printing to stdout
      ... What will happen when a daemon process with no controlling terminal ... tries to print to its stdout? ... consider the following pseudo code: ... int main ...
      (Debian-User)
    • STDOUT and STDERR to same file
      ... I have a daemon process that works but I am currently running it with ... magic to duplicate that to STDOUT as well (ie same file output) ... Ken Foskey ...
      (perl.beginners)