You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rtpengine/lib/auxlib.c

29 lines
501 B

#include "auxlib.h"
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include "loglib.h"
void daemonize(void) {
if (fork())
_exit(0);
write_log = (write_log_t *) syslog;
stdin = freopen("/dev/null", "r", stdin);
stdout = freopen("/dev/null", "w", stdout);
stderr = freopen("/dev/null", "w", stderr);
setpgrp();
}
void wpidfile(const char *pidfile) {
FILE *fp;
if (!pidfile)
return;
fp = fopen(pidfile, "w");
if (fp) {
fprintf(fp, "%u\n", getpid());
fclose(fp);
}
}