MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / createPidFile

Function createPidFile

src/server.cpp:6586–6597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6584#endif /* __linux__ */
6585
6586void 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
6599void daemonize(void) {
6600 int fd;

Callers 1

mainFunction · 0.85

Calls 1

zstrdupFunction · 0.85

Tested by

no test coverage detected