分类:
2008-12-25 19:09:33
Chapter 13 exercises
|
As we might guess from , when the syslog facility is initialized, either by calling openlog
directly or on the first call to syslog, the special device file for the UNIX
domain datagram socket, /dev/log, has to be opened. What happens if the user
process (the daemon) calls chroot before calling openlog? |
答案: 就不能正确打开那个文件了,建议使用LOG_NDELAY
call openlog with
an option of LOG_NDELAY, before
calling chroot
|
Write a program that calls the daemonize function in . After calling this function, call getlogin () to see whether the process has a login name now that it has become
a daemon. Print the results to a file. |
答案:成为daemon之后,没有了controlling terminnal,这样getlogin就不能依据conrolling terminal去查看utmp文件从而找到login name了。当然有的实现可能不是这样的。在linux和solaris就查不出来,但是在Free BSD和Mac中,login name被记录在了process table entry中。因此还是可以不通过controlling terminal来查到login name的。