diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-08 13:24:39 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-08 13:24:39 +0200 |
commit | 973ae30e7c4f7a1afb385dd3d8eeea178f981445 (patch) | |
tree | 1a5d8be5b3ff273a141b6144bf3031b1bc3deb2d /src/qmail-send.c | |
parent | 66404f0bfbd78e635ff6381ca30b25157e0e1a09 (diff) |
fix deprecated prototypes
Diffstat (limited to 'src/qmail-send.c')
-rw-r--r-- | src/qmail-send.c | 120 |
1 files changed, 63 insertions, 57 deletions
diff --git a/src/qmail-send.c b/src/qmail-send.c index 6b7a737..2c5e514 100644 --- a/src/qmail-send.c +++ b/src/qmail-send.c @@ -72,24 +72,24 @@ int chanfdin[CHANNELS] = {2, 4}; int chanskip[CHANNELS] = {10, 20}; int flagexitasap = 0; -void sigterm() +static void sigterm() { flagexitasap = 1; } int flagrunasap = 0; -void sigalrm() +static void sigalrm() { flagrunasap = 1; } int flagreadasap = 0; -void sighup() +static void sighup() { flagreadasap = 1; } -void cleandied() +static void cleandied() { log1s("alert: lost connection to qmail-clean ... exiting\n"); flagexitasap = 1; @@ -97,7 +97,7 @@ void cleandied() int flagspawnalive[CHANNELS]; -void spawndied(int c) +static void spawndied(int c) { log1s("alert: oh no! lost spawn connection! dying...\n"); flagspawnalive[c] = 0; @@ -115,43 +115,49 @@ stralloc fn = {0}; stralloc fn2 = {0}; char fnmake_strnum[FMT_ULONG]; -void fnmake_init() +static void nomem() +{ + log1s("alert: out of memory, sleeping...\n"); + sleep(10); +} + +static void fnmake_init() { while (!stralloc_ready(&fn, FMTQFN)) nomem(); while (!stralloc_ready(&fn2, FMTQFN)) nomem(); } -void fnmake_info(unsigned long id) +static void fnmake_info(unsigned long id) { fn.len = fmtqfn(fn.s, "info/", id, 1); } -void fnmake_todo(unsigned long id) +static void fnmake_todo(unsigned long id) { fn.len = fmtqfn(fn.s, "todo/", id, 1); } -void fnmake_mess(unsigned long id) +static void fnmake_mess(unsigned long id) { fn.len = fmtqfn(fn.s, "mess/", id, 1); } -void fnmake_foop(unsigned long id) +static void fnmake_foop(unsigned long id) { fn.len = fmtqfn(fn.s, "foop/", id, 0); } -void fnmake_split(unsigned long id) +static void fnmake_split(unsigned long id) { fn.len = fmtqfn(fn.s, "", id, 1); } -void fnmake2_bounce(unsigned long id) +static void fnmake2_bounce(unsigned long id) { fn2.len = fmtqfn(fn2.s, "bounce/", id, 0); } -void fnmake_chanaddr(unsigned long id, int c) +static void fnmake_chanaddr(unsigned long id, int c) { fn.len = fmtqfn(fn.s, chanaddr[c], id, 1); } @@ -159,7 +165,7 @@ void fnmake_chanaddr(unsigned long id, int c) /* this file is too long ----------------------------------------- REWRITING */ -void senderadd(stralloc *sa, char *sender, char *recip) +static void senderadd(stralloc *sa, char *sender, char *recip) { int i; int j; @@ -188,7 +194,7 @@ void senderadd(stralloc *sa, char *sender, char *recip) /* this file is too long ---------------------------------------------- INFO */ -int getinfo(stralloc *sa, datetime_sec *dt, unsigned long id) +static int getinfo(stralloc *sa, datetime_sec *dt, unsigned long id) { int fdnumber; struct stat st; @@ -229,7 +235,7 @@ char fromqcbuf[1024]; stralloc comm_buf[CHANNELS] = {{0}, {0}}; int comm_pos[CHANNELS]; -void comm_init() +static void comm_init() { int c; @@ -241,14 +247,14 @@ void comm_init() spawndied(c); /* drastic, but better than risking deadlock */ } -int comm_canwrite(int c) +static int comm_canwrite(int c) { /* XXX: could allow a bigger buffer; say 10 recipients */ if (comm_buf[c].s && comm_buf[c].len) return 0; return 1; } -void comm_write(int c, int delnum, unsigned long id, char *sender, char *recip) +static void comm_write(int c, int delnum, unsigned long id, char *sender, char *recip) { char ch; @@ -266,7 +272,7 @@ void comm_write(int c, int delnum, unsigned long id, char *sender, char *recip) comm_pos[c] = 0; } -void comm_selprep(int *nfds, fd_set *wfds) +static void comm_selprep(int *nfds, fd_set *wfds) { int c; @@ -280,7 +286,7 @@ void comm_selprep(int *nfds, fd_set *wfds) } } -void comm_do(fd_set *wfds) +static void comm_do(fd_set *wfds) { int c; @@ -315,19 +321,19 @@ int flagcleanup; /* if 1, cleanupdir is initialized and ready */ readsubdir cleanupdir; datetime_sec cleanuptime; -void cleanup_init() +static void cleanup_init() { flagcleanup = 0; cleanuptime = now(); } -void cleanup_selprep(datetime_sec *wakeup) +static void cleanup_selprep(datetime_sec *wakeup) { if (flagcleanup) *wakeup = 0; if (*wakeup > cleanuptime) *wakeup = cleanuptime; } -void cleanup_do() +static void cleanup_do() { char ch; struct stat st; @@ -378,7 +384,7 @@ prioq pqchan[CHANNELS] = {{0}, {0}}; /* pqchan 1: -todo +info ?local +remote */ prioq pqfail = {0}; /* stat() failure; has to be pqadded again */ -void pqadd(unsigned long id) +static void pqadd(unsigned long id) { struct prioq_elt pe; struct prioq_elt pechan[CHANNELS]; @@ -433,7 +439,7 @@ FAIL: while (!prioq_insert(&pqfail, &pe)) nomem(); } -void pqstart() +static void pqstart() { readsubdir rs; int x; @@ -445,7 +451,7 @@ void pqstart() if (x > 0) pqadd(id); } -void pqfinish() +static void pqfinish() { int c; struct prioq_elt pe; @@ -463,7 +469,7 @@ void pqfinish() } } -void pqrun() +static void pqrun() { int c; int i; @@ -491,7 +497,7 @@ struct job { int numjobs; struct job *jo; -void job_init() +static void job_init() { int j; @@ -502,7 +508,7 @@ void job_init() } } -int job_avail() +static int job_avail() { int j; @@ -511,7 +517,7 @@ int job_avail() return 0; } -int job_open(unsigned long id, int channel) +static int job_open(unsigned long id, int channel) { int j; @@ -526,7 +532,7 @@ int job_open(unsigned long id, int channel) return j; } -void job_close(int j) +static void job_close(int j) { struct prioq_elt pe; struct stat st; @@ -564,7 +570,7 @@ void job_close(int j) /* this file is too long ------------------------------------------- BOUNCES */ -char *stripvdomprepend(char *recip) +static char *stripvdomprepend(char *recip) { int i; char *domain; @@ -593,7 +599,7 @@ char *stripvdomprepend(char *recip) stralloc bouncetext = {0}; -void addbounce(unsigned long id, char *recip, char *report) +static void addbounce(unsigned long id, char *recip, char *report) { int fd; int pos; @@ -640,7 +646,7 @@ void addbounce(unsigned long id, char *recip, char *report) close(fd); } -int injectbounce(unsigned long id) +static int injectbounce(unsigned long id) { struct qmail qqt; struct stat st; @@ -808,7 +814,7 @@ struct del *d[CHANNELS]; stralloc dline[CHANNELS]; char delbuf[2048]; -void del_status() +static void del_status() { int c; @@ -823,7 +829,7 @@ void del_status() log1s("\n"); } -void del_init() +static void del_init() { int c; int i; @@ -842,7 +848,7 @@ void del_init() del_status(); } -int del_canexit() +static int del_canexit() { int c; @@ -852,12 +858,12 @@ int del_canexit() return 1; } -int del_avail(int c) +static int del_avail(int c) { return flagspawnalive[c] && comm_canwrite(c) && (concurrencyused[c] < concurrency[c]); } -void del_start(int j, seek_pos mpos, char *recip) +static void del_start(int j, seek_pos mpos, char *recip) { int i; int c; @@ -896,7 +902,7 @@ void del_start(int j, seek_pos mpos, char *recip) del_status(); } -void markdone(int c, unsigned long id, seek_pos pos) +static void markdone(int c, unsigned long id, seek_pos pos) { struct stat st; int fd; @@ -925,7 +931,7 @@ void markdone(int c, unsigned long id, seek_pos pos) log3s("warning: trouble marking ", fn.s, "; message will be delivered twice!\n"); } -void del_dochan(int c) +static void del_dochan(int c) { int r; char ch; @@ -997,7 +1003,7 @@ void del_dochan(int c) } } -void del_selprep(int *nfds, fd_set *rfds) +static void del_selprep(int *nfds, fd_set *rfds) { int c; @@ -1008,7 +1014,7 @@ void del_selprep(int *nfds, fd_set *rfds) } } -void del_do(fd_set *rfds) +static void del_do(fd_set *rfds) { int c; @@ -1029,14 +1035,14 @@ struct { char buf[128]; } pass[CHANNELS]; -void pass_init() +static void pass_init() { int c; for (c = 0; c < CHANNELS; ++c) pass[c].id = 0; } -void pass_selprep(datetime_sec *wakeup) +static void pass_selprep(datetime_sec *wakeup) { int c; struct prioq_elt pe; @@ -1081,7 +1087,7 @@ static datetime_sec squareroot(datetime_sec x) /* result^2 <= x < (result + 1)^2 return y; } -datetime_sec nextretry(datetime_sec birth, int c) +static datetime_sec nextretry(datetime_sec birth, int c) { int n; @@ -1094,7 +1100,7 @@ datetime_sec nextretry(datetime_sec birth, int c) return birth + n * n; } -void pass_dochan(int c) +static void pass_dochan(int c) { datetime_sec birth; struct prioq_elt pe; @@ -1168,7 +1174,7 @@ trouble: while (!prioq_insert(&pqchan[c], &pe)) nomem(); } -void messdone(unsigned long id) +static void messdone(unsigned long id) { char ch; int c; @@ -1231,7 +1237,7 @@ FAIL: while (!prioq_insert(&pqdone, &pe)) nomem(); } -void pass_do() +static void pass_do() { int c; struct prioq_elt pe; @@ -1260,14 +1266,14 @@ int todofdin; int todofdout; int flagtodoalive; -void tododied() +static void tododied() { log1s("alert: lost connection to qmail-todo ... exiting\n"); flagexitasap = 1; flagtodoalive = 0; } -void todo_init() +static void todo_init() { todofdout = 7; todofdin = 8; @@ -1278,7 +1284,7 @@ void todo_init() return; } -void todo_selprep(int *nfds, fd_set *rfds, datetime_sec *wakeup) +static void todo_selprep(int *nfds, fd_set *rfds, datetime_sec *wakeup) { if (flagexitasap) { if (flagtodoalive) { @@ -1291,7 +1297,7 @@ void todo_selprep(int *nfds, fd_set *rfds, datetime_sec *wakeup) } } -void todo_del(char *s) +static void todo_del(char *s) { int flagchan[CHANNELS]; struct prioq_elt pe; @@ -1333,7 +1339,7 @@ void todo_del(char *s) return; } -void todo_do(fd_set *rfds) +static void todo_do(fd_set *rfds) { int r; char ch; @@ -1379,7 +1385,7 @@ void todo_do(fd_set *rfds) /* this file is too long ---------------------------------------------- MAIN */ -int getcontrols() +static int getcontrols() { if (control_init() == -1) return 0; if (control_readint(&lifetime, "control/queuelifetime") == -1) return 0; @@ -1420,7 +1426,7 @@ int getcontrols() stralloc newlocals = {0}; stralloc newvdoms = {0}; -void regetcontrols() +static void regetcontrols() { int r; @@ -1460,7 +1466,7 @@ void regetcontrols() while (!constmap_init(&mapvdoms, "", 0, 1)) nomem(); } -void reread() +static void reread() { if (chdir(auto_qmail) == -1) { log1s("alert: unable to reread controls: unable to switch to home directory\n"); |