#include #include #include #include #include main(int argc, char *argv[]) { int no_fds = 0; int fd = -1; int rc = 0; pid_t sid; /* * Fork a child process * Exit parent * Change directory to "/" * Redirect stdin, stdout, stderr to "/dev/null" */ rc = daemon (0, 0); if ( rc < 0 ) { exit(EXIT_FAILURE); } /* Create a new session */ setsid(); /* Set the file mode creation mask */ umask(022); /* Close the associated standard file descriptors */ close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); /* Start micasad */ return execv ("/usr/bin/mono", argv); }