1/* MiniUPnP project 2 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ 3 * (c) 2006 Thomas Bernard 4 * This software is subject to the conditions detailed 5 * in the LICENCE file provided within the distribution */ 6 7#ifndef __DAEMONIZE_H__ 8#define __DAEMONIZE_H__ 9 10#include "config.h" 11 12#ifndef USE_DAEMON 13/* daemonize() 14 * "fork" to background, detach from terminal, etc... 15 * returns: pid of the daemon, exits upon failure */ 16int 17daemonize(void); 18#endif 19 20/* writepidfile() 21 * write the pid to a file */ 22int 23writepidfile(const char * fname, int pid); 24 25/* checkforrunning() 26 * check for another instance running 27 * returns: 0 only instance 28 * -1 invalid filename 29 * -2 another instance running */ 30int 31checkforrunning(const char * fname); 32 33#endif 34 35