[cs631apue] hw4 questions.

Jan Schaumann jschauma at stevens.edu
Mon Nov 14 14:22:16 EST 2011


afonsec1 <afonsec1 at stevens.edu> wrote:

> If we are in debug mode and therefore not daemonize, should we still  
> support signal handling? should we do a restart for signal handling?

Try to think about whether or not that makes sense.  What do you want to
debug when you are in debug mode?  Does that possibly include the
behaviour upon receiving a signal?

> From my understanding, when we go daemon, we close all file descriptor  
> for the giving process, so if we passed a log file name, we have to open  
> a descriptor to that file?

In order to write anything to the log file you require a file handle,
correct.

> Since we close the stderr fd on daemon mode too, should we log the fatal 
> messages (messages about reasons for terminating the program) on the 
> syslog? or just terminate without logging the event?

syslog(3) is the best solution, yes.

> I didn't specify the ai_family, so the way that I get address info is  
> agnostic.

I'm not sure I understand you correctly, but what you are describing
does not sound like it'd be portable code.  Can you provide an example
of what you're doing?

> Hence it really doesn't matter whether the address passed on  the (-i)
> option is ipv6, or ipv4, it will recognize it dynamically. Are  you
> okay with this? or do you want us to hard-code the address family?

Handling of IPv6 should be done explicitly.  (This also means that the
end user can implicitly disable it, which it sounds like it wouldn't be
possible in your approach.)

-Jan


More information about the cs631apue mailing list