X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=blobdiff_plain;f=innduct.h;h=231524d04b0fdaaa54d5687fe10d474a66f71904;hp=d6dc8dd033c6516b26cfdc68785cb3efac50aabc;hb=HEAD;hpb=62a5c8052810dc6e5716c1e1e3bf63294a350167 diff --git a/innduct.h b/innduct.h index d6dc8dd..c85d057 100644 --- a/innduct.h +++ b/innduct.h @@ -2,25 +2,9 @@ * innduct * tailing reliable realtime streaming feeder for inn * - * Copyright (C) 2010 Ian Jackson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * (I believe that when you compile and link this as part of the inn2 - * build, with the Makefile runes I have provided, all the libraries - * and files which end up included in innduct are licence-compatible - * with GPLv3. If not then please let me know. -Ian Jackson.) + * Copyright Ian Jackson + * and contributors; see LICENCE.txt. + * SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef INNDUCT_H @@ -59,6 +43,7 @@ #include #include #include +#include #include #include @@ -71,7 +56,7 @@ #define INNDCOMMCHILD_ESTATUS_FAIL 26 #define INNDCOMMCHILD_ESTATUS_NONESUCH 27 -#define MAX_LINE_FEEDFILE (NNTP_MSGID_MAXLEN + sizeof(TOKEN)*2 + 10) +#define MAX_LINE_FEEDFILE (NNTP_MAXLEN_MSGID + sizeof(TOKEN)*2 + 10) #define MAX_CLI_COMMAND 1000 #define VA va_list al; va_start(al,fmt) @@ -84,8 +69,10 @@ #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 +171,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 */ @@ -319,15 +306,16 @@ void info(const char *fmt, ...) PRINTF(1,2); 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); + const char *fmt, va_list al) PRINTF(4,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,10 +353,10 @@ 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); + PRINTF(2,0); INNLOGSETS(INNLOGSET_DECLARE) /*----- duct.c -----*/ @@ -391,6 +379,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); @@ -497,6 +489,8 @@ extern int until_stats_log; 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;