chiark / gitweb /
Report input file start to debug log
[innduct.git] / innduct.h
index 6802fd8ae9cbbdb56dcf0ff74041e05e031a89c0..273fb5ec7758df00f196a34dfe8580621b45c5c4 100644 (file)
--- a/innduct.h
+++ b/innduct.h
 
 #define DUMPV(fmt,pfx,v) fprintf(f, " " #v "=" fmt, pfx v);
 
-#define FOR_CONN(conn) \
-  for ((conn)=LIST_HEAD(conns); (conn); (conn)=LIST_NEXT((conn)))
+#define FOR_LIST_NODE(nodevar, list) \
+  for ((nodevar)=LIST_HEAD(list); (nodevar); (nodevar)=LIST_NEXT((nodevar)))
+
+#define FOR_CONN(conn) FOR_LIST_NODE(conn, conns)
 
 /*----- doubly linked lists -----*/
 
@@ -176,6 +178,7 @@ extern int backlog_spontrescan_periods;
 extern int spontaneous_flush_periods;
 extern int max_separated_periods;
 extern int need_activity_periods;
+extern int stats_log_periods;
 extern int lowvol_thresh;
 extern int lowvol_periods;
 
@@ -217,6 +220,10 @@ typedef enum {
   RCI_max
 } ResultCountIndex;
 
+typedef enum {
+  read_ok, read_blank, read_err, nooffer_missing,
+  ECI_max
+} EventCountIndex;
 
 /*----- transmission buffers -----*/
 
@@ -236,6 +243,11 @@ struct XmitDetails {
 
 /*----- core operational data structure types -----*/
 
+typedef struct {
+  int results[art_MaxState][RCI_max];
+  int events[ECI_max];
+} Counts;
+
 struct InputFile {
   /* This is also an instance of struct oop_readable */
   struct oop_readable readable; /* first */
@@ -253,8 +265,7 @@ struct InputFile {
   long inprogress; /* includes queue.count and also articles in conns */
   long autodefer; /* -1 means not doing autodefer */
 
-  int counts[art_MaxState][RCI_max];
-  int readcount_ok, readcount_blank, readcount_err, count_nooffer_missing;
+  Counts counts;
   char path[];
 };
 
@@ -318,7 +329,8 @@ char *xasprintf(const char *fmt, ...) PRINTF(1,2);
 int close_perhaps(int *fd);
 void xclose(int fd, const char *what, const char *what2);
 void xclose_perhaps(int *fd, const char *what, const char *what2);
-pid_t xfork(const char *what);
+pid_t xfork(const char *what); /* also runs postfork in child */
+pid_t xfork_bare(const char *what);
 
 void on_fd_read_except(int fd, oop_call_fd callback);
 void cancel_fd_read_except(int fd);
@@ -382,6 +394,10 @@ void conn_dispose(Conn *conn);
 void vconnfail(Conn *conn, const char *fmt, va_list al) PRINTF(2,0);
 void connfail(Conn *conn, const char *fmt, ...)         PRINTF(2,3);
 
+void notice_conns_more(const char *new_kind);
+void notice_conns_fewer(void);
+void notice_conns_stats(void);
+
 int allow_connect_start(void);
 void connect_start(void);
 
@@ -473,7 +489,7 @@ extern pid_t inndcomm_child;
 
 /*========== general operational variables ==========*/
 
-/* innduct.c */
+/* duct.c */
 extern oop_source *loop;
 extern ConnList conns;
 extern char *path_lock, *path_flushing, *path_defer, *path_dump;
@@ -482,11 +498,14 @@ extern pid_t self_pid;
 extern int *lowvol_perperiod;
 extern int lowvol_circptr;
 extern int lowvol_total; /* does not include current period */
+extern int until_stats_log;
 
 /* statemc.c */
 extern StateMachineState sms;
 extern int until_flush;
 extern InputFile *main_input_file, *flushing_input_file, *backlog_input_file;
+extern Counts backlog_counts;
+extern int backlog_counts_report;
 extern FILE *defer;
 extern int until_connect, until_backlog_nextscan;
 extern double accept_proportion;