chiark / gitweb /
Cope with NNTP_STRLEN abolishment (replaced with NNTP_MAXLEN_COMMAND)
[innduct.git] / innduct.h
index 00be640f73a33aca2e15ab2202cee214d6dab8df..69af7d95f348583294920895df7c26b16feae4d9 100644 (file)
--- a/innduct.h
+++ b/innduct.h
@@ -59,6 +59,7 @@
 #include <time.h>
 #include <math.h>
 #include <ctype.h>
+#include <limits.h>
 
 #include <oop.h>
 #include <oop-read.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 -----*/
 
@@ -184,7 +187,7 @@ extern double max_bad_data_ratio;
 extern int max_bad_data_initial;
 
 
-/*----- statistics -----*/
+/*----- article states, and statistics -----*/
 
 typedef enum {      /* in queue                 in conn->sent             */
   art_Unchecked,    /*   not checked, not sent    checking                */
@@ -321,13 +324,14 @@ void dbg(const char *fmt, ...) PRINTF(1,2);
 void logv(int sysloglevel, const char *pfx, int errnoval,
          const char *fmt, va_list al) PRINTF(5,0);
 
-char *xvasprintf(const char *fmt, va_list al) PRINTF(1,0);
-char *xasprintf(const char *fmt, ...) PRINTF(1,2);
+char *mvasprintf(const char *fmt, va_list al) PRINTF(1,0);
+char *masprintf(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);
@@ -365,7 +369,7 @@ static inline int isewouldblock(int errnoval) {
   INNLOGSET(die,      "fatal",    LOG_ERR)     \
   INNLOGSET(warn,     "warning",  LOG_WARNING) \
   INNLOGSET(notice,   "notice",   LOG_NOTICE)  \
-  INNLOGSET(trace,    "trace",    LOG_NOTICE)
+  INNLOGSET(debug,    "debug",    LOG_DEBUG)
 #define INNLOGSET_DECLARE(fn, pfx, sysloglevel)                                \
   void duct_log_##fn(int l, const char *fmt, va_list al, int errval)   \
     PRINTF(3,0);