X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/1843f70b733127fcba3321d9d69359e05905f8cc..1ddb1855402d48ad735e46abaf0d662e45600ecd:/src/src/functions.h diff --git a/src/src/functions.h b/src/src/functions.h index 401300d94..d27c23baa 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -3,7 +3,7 @@ *************************************************/ /* Copyright (c) University of Cambridge 1995 - 2018 */ -/* Copyright (c) The Exim Maintainers 2020 */ +/* Copyright (c) The Exim Maintainers 2020 - 2021 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -56,7 +56,7 @@ extern BOOL tls_client_start(client_conn_ctx *, smtp_connect_args *, extern void tls_client_creds_reload(BOOL); extern void tls_close(void *, int); -extern BOOL tls_could_read(void); +extern BOOL tls_could_getc(void); extern void tls_daemon_init(void); extern int tls_daemon_tick(void); extern BOOL tls_dropprivs_validate_require_cipher(BOOL); @@ -85,7 +85,7 @@ extern void tls_watch_invalidate(void); #endif extern int tls_write(void *, const uschar *, size_t, BOOL); extern uschar *tls_validate_require_cipher(void); -extern void tls_version_report(FILE *); +extern gstring *tls_version_report(gstring *); # ifdef SUPPORT_DANE extern int tlsa_lookup(const host_item *, dns_answer *, BOOL); @@ -186,7 +186,7 @@ extern int dcc_process(uschar **); #endif extern void debug_logging_activate(uschar *, uschar *); -extern void debug_logging_stop(void); +extern void debug_logging_stop(BOOL); extern void debug_print_argv(const uschar **); extern void debug_print_ids(uschar *); extern void debug_printf_indent(const char *, ...) PRINTF_FUNCTION(1,2); @@ -236,7 +236,7 @@ extern BOOL dscp_lookup(const uschar *, int, int *, int *, int *); extern void enq_end(uschar *); extern BOOL enq_start(uschar *, unsigned); #ifndef DISABLE_EVENT -extern uschar *event_raise(uschar *, const uschar *, uschar *); +extern uschar *event_raise(uschar *, const uschar *, uschar *, int *); extern void msg_event_raise(const uschar *, const address_item *); #endif @@ -475,10 +475,10 @@ extern void set_process_info(const char *, ...) PRINTF_FUNCTION(1,2); extern void sha1_end(hctx *, const uschar *, int, uschar *); extern void sha1_mid(hctx *, const uschar *); extern void sha1_start(hctx *); +extern void show_string(BOOL, gstring *); extern int sieve_interpret(uschar *, int, uschar *, uschar *, uschar *, uschar *, address_item **, uschar **); extern void sigalrm_handler(int); -extern BOOL smtp_buffered(void); extern void smtp_closedown(uschar *); extern void smtp_command_timeout_exit(void) NORETURN; extern void smtp_command_sigterm_exit(void) NORETURN; @@ -630,7 +630,7 @@ extern void tree_walk(tree_node *, void (*)(uschar*, uschar*, void*), void *) extern void unspool_mbox(void); #endif #ifdef SUPPORT_I18N -extern void utf8_version_report(FILE *); +extern gstring *utf8_version_report(gstring *); #endif extern int verify_address(address_item *, FILE *, int, int, int, int, @@ -811,11 +811,11 @@ Returns: copy of string in new store, with letters lowercased */ static inline uschar * -string_copylc(const uschar *s) +string_copylc(const uschar * s) { -uschar *ss = store_get(Ustrlen(s) + 1, is_tainted(s)); -uschar *p = ss; -while (*s != 0) *p++ = tolower(*s++); +uschar * ss = store_get(Ustrlen(s) + 1, is_tainted(s)); +uschar * p = ss; +while (*s) *p++ = tolower(*s++); *p = 0; return ss; } @@ -837,7 +837,7 @@ Returns: copy of string in new store, with letters lowercased */ static inline uschar * -string_copynlc(uschar *s, int n) +string_copynlc(uschar * s, int n) { uschar *ss = store_get(n + 1, is_tainted(s)); uschar *p = ss; @@ -901,7 +901,7 @@ static inline gstring * string_get_tainted_trc(unsigned size, BOOL tainted, const char * func, unsigned line) { gstring * g = store_get_3(sizeof(gstring) + size, tainted, func, line); -g->size = size; +g->size = size; /*XXX would be good if we could see the actual alloc size */ g->ptr = 0; g->s = US(g + 1); return g; @@ -990,7 +990,6 @@ could be used and would handle that implicitly. */ static inline dns_answer * store_get_dns_answer_trc(const uschar * func, unsigned line) { -/* return store_get_3(sizeof(dns_answer), TRUE, CCS func, line); use tainted mem */ return store_malloc_3(sizeof(dns_answer), CCS func, line); } @@ -1255,6 +1254,14 @@ child_open(uschar **argv, uschar **envp, int newumask, int *infdptr, outfdptr, make_leader, purpose); } +/* Return 1 if fd is usable per pollbits, else 0 */ +static inline int +poll_one_fd(int fd, short pollbits, int tmo_millisec) +{ +struct pollfd p = {.fd = fd, .events = pollbits}; +return poll(&p, 1, tmo_millisec); +} + # endif /* !COMPILE_UTILITY */ /******************************************************************************/