1 /* common stuff for cgi-fcgi-interp and prefork-interp */
16 #include <sys/types.h>
18 #include <sys/utsname.h>
19 #include <sys/socket.h>
30 #include <nettle/sha.h>
33 #include "timespeccmp.h"
37 extern const char *interp, *ident;
38 extern int numservers, debugmode;
39 extern int check_interval;
41 extern struct sha256_ctx identsc;
43 extern const char our_name[];
46 extern const char *run_base, *script, *socket_path, *lock_path;
47 extern const char *run_base_mkdir_p;
50 bool find_run_base_var_run(void);
51 void find_socket_path(void);
53 bool stab_isnewer(const struct stat *a, const struct stat *b);
54 void stab_mtimenow(struct stat *out);
55 int acquire_lock(void);
56 bool check_garbage_vs(const struct stat *started);
57 bool check_garbage(void);
58 void tidy_garbage(void);
60 extern const struct cmdinfo cmdinfos[];
62 // returns script pathname
63 const char *process_opts(const char *const **argv_io);
65 void vmsgcore(int estatus, int errnoval, const char *fmt, va_list al);
67 #define DEF_MSG(func, attrs, estatus, errnoval, after) \
68 static void func(const char *fmt, ...) \
69 __attribute__((unused, format(printf,1,2))) attrs; \
70 static void func(const char *fmt, ...) { \
73 vmsgcore(estatus,errnoval,fmt,al); \
77 DEF_MSG(warninge, /*empty*/, 0, errno, { });
78 DEF_MSG(warning , /*empty*/, 0, 0, { });
80 #define DEF_DIE(func, errnoval) \
81 DEF_MSG(func, __attribute__((noreturn)), 127, errnoval, { abort(); })
88 void fusagemessage(FILE *f);
89 void usagemessage(void);
90 void of_help(const struct cmdinfo *ci, const char *val);
91 void of_iassign(const struct cmdinfo *ci, const char *val);
92 void ident_addstring(const struct cmdinfo *ci, const char *string);
93 void off_ident_addenv(const struct cmdinfo *ci, const char *name);