mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-09 23:26:47 +02:00
loggong
git-svn-id: svn://elaine/murooma/trunk@190 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
18ec79e97a
commit
0f49d851b9
7 changed files with 130 additions and 43 deletions
|
@ -165,47 +165,6 @@ private:
|
|||
};
|
||||
|
||||
|
||||
void daemonize()
|
||||
{
|
||||
/* Our process ID and Session ID */
|
||||
pid_t pid, sid;
|
||||
|
||||
/* Fork off the parent process */
|
||||
pid = fork();
|
||||
if (pid < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* If we got a good PID, then
|
||||
we can exit the parent process. */
|
||||
if (pid > 0)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
/* Change the file mode mask */
|
||||
umask(0);
|
||||
|
||||
/* Open any logs here */
|
||||
|
||||
/* Create a new SID for the child process */
|
||||
sid = setsid();
|
||||
if (sid < 0)
|
||||
{
|
||||
/* Log the failure */
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Change the current working directory */
|
||||
if ((chdir("/")) < 0)
|
||||
{
|
||||
/* Log the failure */
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Close out the standard file descriptors */
|
||||
close(STDIN_FILENO);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue