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, *script, *socket_path, *lock_path;
39 extern struct sha256_ctx identsc;
40 extern const char *run_base;
42 extern const char our_name[];
44 bool find_run_base_var_run(void);
45 void find_socket_path(void);
47 int acquire_lock(void);
48 int flock_file(const char *lock_path);
50 extern const struct cmdinfo cmdinfos[];
51 #define PREFORK_CMDINFOS \
52 { "help", 0, .call=of_help }, \
53 { 0, 'g', 1, .sassignto= &ident }, \
54 { 0, 'G', 1, .call= ident_addstring }, \
55 { 0, 'E', 1, .call= off_ident_addenv },
57 void process_opts(const char *const **argv_io);
59 void vmsgcore(int estatus, int errnoval, const char *fmt, va_list al);
61 #define DEF_MSG(func, attrs, estatus, errnoval, after) \
62 static void func(const char *fmt, ...) \
63 __attribute__((unused, format(printf,1,2))) attrs; \
64 static void func(const char *fmt, ...) { \
67 vmsgcore(estatus,errnoval,fmt,al); \
71 DEF_MSG(warninge, /*empty*/, 0, errno, { });
72 DEF_MSG(warning , /*empty*/, 0, -1, { });
74 #define DEF_DIE(func, errnoval) \
75 DEF_MSG(func, __attribute__((noreturn)), 127, errnoval, { abort(); })
82 void fusagemessage(FILE *f);
83 void usagemessage(void);
84 void of_help(const struct cmdinfo *ci, const char *val);
85 void of_iassign(const struct cmdinfo *ci, const char *val);
86 void ident_addstring(const struct cmdinfo *ci, const char *string);
87 void off_ident_addenv(const struct cmdinfo *ci, const char *name);
88 void ident_addinit(void);
89 bool stabs_same_inode(struct stat *a, struct stat *b);
91 #define IDENT_ADD_OBJ(obj) \
92 sha256_update(&identsc, sizeof((obj)), (void*)&obj);