是否有一个很好的理由,写我自己的以进程的功能,而不是使用守护进程(3)? [英] Is there a good reason to write my own daemonize function instead of using daemon(3)?
问题描述
有很多在网络上的守护程序示例实现的。大多数我看到不使用守护进程(3)函数在后台运行的程序。是不是只是一个口味,无知的事情,或者是有一个很好的理由写我自己以进程的功能?是否有使用守护进程(3)特定的劣势?它是不安全的?
There are a lot of example implementations of daemons on the net. Most that I saw do not use the daemon(3) function to run the program in the background. Is that just a matter of taste, ignorance, or is there a good reason to write my own daemonize function? Is there a specific disadvantage in using daemon(3)? Is it insecure?
推荐答案
BSD的守护进程()函数是非常有限的,并邀请滥用。只有极少数可以守护程序正确使用此功能。
The BSD daemon() function is very limited and invites misuse. Only very few daemons may use this function correctly.
该systemd手册页有一个什么样的正确书写的SysV守护程序daemonizing时做一个列表:
The systemd man pages have a list of what a correctly written SysV daemon should do when daemonizing:
http://0pointer.de/public/systemd-man/daemon.html
这篇关于是否有一个很好的理由,写我自己的以进程的功能,而不是使用守护进程(3)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!