| 6584 | #endif /* __linux__ */ |
| 6585 | |
| 6586 | void createPidFile(void) { |
| 6587 | /* If pidfile requested, but no pidfile defined, use |
| 6588 | * default pidfile path */ |
| 6589 | if (!cserver.pidfile) cserver.pidfile = zstrdup(CONFIG_DEFAULT_PID_FILE); |
| 6590 | |
| 6591 | /* Try to write the pid file in a best-effort way. */ |
| 6592 | FILE *fp = fopen(cserver.pidfile,"w"); |
| 6593 | if (fp) { |
| 6594 | fprintf(fp,"%d\n",(int)getpid()); |
| 6595 | fclose(fp); |
| 6596 | } |
| 6597 | } |
| 6598 | |
| 6599 | void daemonize(void) { |
| 6600 | int fd; |