trojan
trojan copied to clipboard
Add -d option to fork into background as a daemon
This is useful on systems like OpenBSD which don't have a service manager like systemd. The daemon() call is available on Linux and OpenBSD, not sure about other systems.
For portability, please avoid using daemon()
if possible. Go through a standard SysV daemon creation process is recommended. Or at least include unistd.h
properly when necessary.
For portability, please avoid using
daemon()
if possible. Go through a standard SysV daemon creation process is recommended.
Portability to what though? I guess it's only proprietary Unixes that don't have daemon()
but do have all the other POSIX APIs.
Or at least include
unistd.h
properly when necessary.
Yes OK. It's in stdlib.h
on Mac/BSD but unistd.h
on Linux.
To be honest, I like this feature.