ares_reinit.3 (1774B)
1 .\" 2 .\" Copyright 2023 by the c-ares project and its contributors 3 .\" SPDX-License-Identifier: MIT 4 .\" 5 .TH ARES_REINIT 3 "12 November 2023" 6 .SH NAME 7 ares_reinit \- ReInitialize a resolver channel from system configuration. 8 .SH SYNOPSIS 9 .nf 10 #include <ares.h> 11 12 int ares_reinit(ares_channel_t *\fIchannel\fP) 13 .fi 14 .SH DESCRIPTION 15 The \fBares_reinit(3)\fP function re-reads the system configuration and safely 16 applies the configuration to the existing channel. System configuration will 17 never override user-provided settings such as provided via 18 \fBares_init_options(3)\fP or \fBares_set_servers(3)\fP. 19 20 Any existing queries will be automatically requeued if the server they are 21 currently assigned to is removed from the system configuration. 22 23 This function may cause additional file descriptors to be created, and existing 24 ones to be destroyed if server configuration has changed. 25 26 \Bares_reinit(3)\fP, when compiled with thread safety, will spawn a background 27 thread to read the configuration and apply it. It is crucial that developers 28 use the \fBARES_OPT_SOCK_STATE_CB\fP or \fBARES_OPT_EVENT_THREAD\fP so that 29 notifications of changes are alerted. If using \fBares_getsock(3)\fP or 30 \fBares_fds(3)\fP, no notification is possible which could cause a stall. 31 32 .SH RETURN VALUES 33 \fIares_reinit(3)\fP can return any of the following values: 34 .TP 14 35 .B ARES_SUCCESS 36 Initialization succeeded. 37 .TP 14 38 .B ARES_EFILE 39 A configuration file could not be read. 40 .TP 14 41 .B ARES_ENOMEM 42 The process's available memory was exhausted. 43 44 .SH AVAILABILITY 45 This function was first introduced in c-ares version 1.22.0. 46 .SH SEE ALSO 47 .BR ares_init (3), 48 .BR ares_init_options (3), 49 .BR ares_destroy (3), 50 .BR ares_dup (3), 51 .BR ares_library_init (3), 52 .BR ares_set_servers (3), 53 .BR ares_threadsafety (3)