2011-09-28 19:14:08 +00:00
|
|
|
/* $Id: daemonize.h,v 1.6 2008/01/29 13:04:46 nanard Exp $ */
|
|
|
|
/* MiniUPnP project
|
|
|
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
2012-03-01 01:52:48 +00:00
|
|
|
* (c) 2006 Thomas Bernard
|
2011-09-28 19:14:08 +00:00
|
|
|
* This software is subject to the conditions detailed
|
|
|
|
* in the LICENCE file provided within the distribution */
|
|
|
|
|
2012-09-20 20:52:51 +00:00
|
|
|
#ifndef DAEMONIZE_H_INCLUDED
|
|
|
|
#define DAEMONIZE_H_INCLUDED
|
2011-09-28 19:14:08 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#ifndef USE_DAEMON
|
|
|
|
/* daemonize()
|
2012-03-01 01:52:48 +00:00
|
|
|
* "fork" to background, detach from terminal, etc...
|
2011-09-28 19:14:08 +00:00
|
|
|
* returns: pid of the daemon, exits upon failure */
|
|
|
|
int
|
|
|
|
daemonize(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* writepidfile()
|
|
|
|
* write the pid to a file */
|
|
|
|
int
|
|
|
|
writepidfile(const char * fname, int pid);
|
|
|
|
|
|
|
|
/* checkforrunning()
|
|
|
|
* check for another instance running
|
|
|
|
* returns: 0 only instance
|
|
|
|
* -1 invalid filename
|
|
|
|
* -2 another instance running */
|
|
|
|
int
|
|
|
|
checkforrunning(const char * fname);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|