The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
misc.h
Go to the documentation of this file.
1 
24 #ifndef _MISC_H
25 #include <projectcommon.h>
26 #include <configcontext.h>
27 #ifndef WIN32
28 #include <syslog.h>
29 #endif
30 #include <stdio.h>
31 
32 #define STD_PID_DIR "/var/run"
33 
34 extern const char* assim_syslogid;
35 
37 typedef enum {
38  PID_NOTRUNNING, //< Nothing seems to be running for this pidfile
39  PID_DEAD, //< The pid file exists, but its process doesn't
40  PID_NOTUS, //< Something is running, but we don't think it's one of us
41  PID_RUNNING, //< The pid file exists, and looks like one of us
43 char * proj_get_sysname(void);
44 
47 WINEXPORT void daemonize_me(gboolean stay_in_foreground
48 , const char * dirtorunin
49 , char* pidfile);
50 WINEXPORT void assimilation_openlog(const char* logname);
51 WINEXPORT PidRunningStat are_we_already_running(const char * pidfile, int* pid);
53 gboolean create_pid_file(const char * pidfile);
54 WINEXPORT void remove_pid_file(const char * pidfile);
55 WINEXPORT int kill_pid_service(const char * pidfile, int signal);
56 void rmpid_and_exit_on_signal(const char * pidfile, int signal);
57 WINEXPORT gchar ** assim_merge_environ(const gchar *const* env, ConfigContext*);
58 WINEXPORT void assim_free_environ(gchar ** env);
59 WINEXPORT gsize setpipebuf(int fd, gsize bufsize);
60 WINEXPORT gsize getpipebuf(int fd);
61 #endif /* MISC_H */
62