eloop: Remove global user data pointer
This is not really needed since all signal handlers can use a context pointer provided during signal handler registration.
This commit is contained in:
parent
9969e5a46a
commit
0456ea16d8
13 changed files with 37 additions and 93 deletions
|
@ -251,7 +251,7 @@ hostapd_interface_init(struct hapd_interfaces *interfaces,
|
||||||
/**
|
/**
|
||||||
* handle_term - SIGINT and SIGTERM handler to terminate hostapd process
|
* handle_term - SIGINT and SIGTERM handler to terminate hostapd process
|
||||||
*/
|
*/
|
||||||
static void handle_term(int sig, void *eloop_ctx, void *signal_ctx)
|
static void handle_term(int sig, void *signal_ctx)
|
||||||
{
|
{
|
||||||
wpa_printf(MSG_DEBUG, "Signal %d received - terminating", sig);
|
wpa_printf(MSG_DEBUG, "Signal %d received - terminating", sig);
|
||||||
eloop_terminate();
|
eloop_terminate();
|
||||||
|
@ -262,19 +262,19 @@ static void handle_term(int sig, void *eloop_ctx, void *signal_ctx)
|
||||||
/**
|
/**
|
||||||
* handle_reload - SIGHUP handler to reload configuration
|
* handle_reload - SIGHUP handler to reload configuration
|
||||||
*/
|
*/
|
||||||
static void handle_reload(int sig, void *eloop_ctx, void *signal_ctx)
|
static void handle_reload(int sig, void *signal_ctx)
|
||||||
{
|
{
|
||||||
struct hapd_interfaces *interfaces = eloop_ctx;
|
struct hapd_interfaces *interfaces = signal_ctx;
|
||||||
wpa_printf(MSG_DEBUG, "Signal %d received - reloading configuration",
|
wpa_printf(MSG_DEBUG, "Signal %d received - reloading configuration",
|
||||||
sig);
|
sig);
|
||||||
hostapd_for_each_interface(interfaces, handle_reload_iface, NULL);
|
hostapd_for_each_interface(interfaces, handle_reload_iface, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void handle_dump_state(int sig, void *eloop_ctx, void *signal_ctx)
|
static void handle_dump_state(int sig, void *signal_ctx)
|
||||||
{
|
{
|
||||||
#ifdef HOSTAPD_DUMP_STATE
|
#ifdef HOSTAPD_DUMP_STATE
|
||||||
struct hapd_interfaces *interfaces = eloop_ctx;
|
struct hapd_interfaces *interfaces = signal_ctx;
|
||||||
hostapd_for_each_interface(interfaces, handle_dump_state_iface, NULL);
|
hostapd_for_each_interface(interfaces, handle_dump_state_iface, NULL);
|
||||||
#endif /* HOSTAPD_DUMP_STATE */
|
#endif /* HOSTAPD_DUMP_STATE */
|
||||||
}
|
}
|
||||||
|
@ -290,16 +290,16 @@ static int hostapd_global_init(struct hapd_interfaces *interfaces)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eloop_init(interfaces)) {
|
if (eloop_init()) {
|
||||||
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_NATIVE_WINDOWS
|
#ifndef CONFIG_NATIVE_WINDOWS
|
||||||
eloop_register_signal(SIGHUP, handle_reload, NULL);
|
eloop_register_signal(SIGHUP, handle_reload, interfaces);
|
||||||
eloop_register_signal(SIGUSR1, handle_dump_state, NULL);
|
eloop_register_signal(SIGUSR1, handle_dump_state, interfaces);
|
||||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||||
eloop_register_signal_terminate(handle_term, NULL);
|
eloop_register_signal_terminate(handle_term, interfaces);
|
||||||
|
|
||||||
#ifndef CONFIG_NATIVE_WINDOWS
|
#ifndef CONFIG_NATIVE_WINDOWS
|
||||||
openlog("hostapd", 0, LOG_DAEMON);
|
openlog("hostapd", 0, LOG_DAEMON);
|
||||||
|
|
|
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
|
||||||
os_memset(&ctx, 0, sizeof(ctx));
|
os_memset(&ctx, 0, sizeof(ctx));
|
||||||
inet_aton("127.0.0.1", &ctx.own_ip_addr);
|
inet_aton("127.0.0.1", &ctx.own_ip_addr);
|
||||||
|
|
||||||
if (eloop_init(&ctx)) {
|
if (eloop_init()) {
|
||||||
printf("Failed to initialize event loop\n");
|
printf("Failed to initialize event loop\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,6 @@ struct eloop_sock_table {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct eloop_data {
|
struct eloop_data {
|
||||||
void *user_data;
|
|
||||||
|
|
||||||
int max_sock;
|
int max_sock;
|
||||||
|
|
||||||
struct eloop_sock_table readers;
|
struct eloop_sock_table readers;
|
||||||
|
@ -81,10 +79,9 @@ static void eloop_sigsegv_handler(int sig)
|
||||||
#endif /* WPA_TRACE */
|
#endif /* WPA_TRACE */
|
||||||
|
|
||||||
|
|
||||||
int eloop_init(void *user_data)
|
int eloop_init(void)
|
||||||
{
|
{
|
||||||
os_memset(&eloop, 0, sizeof(eloop));
|
os_memset(&eloop, 0, sizeof(eloop));
|
||||||
eloop.user_data = user_data;
|
|
||||||
#ifdef WPA_TRACE
|
#ifdef WPA_TRACE
|
||||||
signal(SIGSEGV, eloop_sigsegv_handler);
|
signal(SIGSEGV, eloop_sigsegv_handler);
|
||||||
#endif /* WPA_TRACE */
|
#endif /* WPA_TRACE */
|
||||||
|
@ -408,7 +405,6 @@ static void eloop_process_pending_signals(void)
|
||||||
if (eloop.signals[i].signaled) {
|
if (eloop.signals[i].signaled) {
|
||||||
eloop.signals[i].signaled = 0;
|
eloop.signals[i].signaled = 0;
|
||||||
eloop.signals[i].handler(eloop.signals[i].sig,
|
eloop.signals[i].handler(eloop.signals[i].sig,
|
||||||
eloop.user_data,
|
|
||||||
eloop.signals[i].user_data);
|
eloop.signals[i].user_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -588,9 +584,3 @@ void eloop_wait_for_read_sock(int sock)
|
||||||
FD_SET(sock, &rfds);
|
FD_SET(sock, &rfds);
|
||||||
select(sock + 1, &rfds, NULL, NULL, NULL);
|
select(sock + 1, &rfds, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void * eloop_get_user_data(void)
|
|
||||||
{
|
|
||||||
return eloop.user_data;
|
|
||||||
}
|
|
||||||
|
|
|
@ -65,25 +65,19 @@ typedef void (*eloop_timeout_handler)(void *eloop_data, void *user_ctx);
|
||||||
/**
|
/**
|
||||||
* eloop_signal_handler - eloop signal event callback type
|
* eloop_signal_handler - eloop signal event callback type
|
||||||
* @sig: Signal number
|
* @sig: Signal number
|
||||||
* @eloop_ctx: Registered callback context data (global user_data from
|
|
||||||
* eloop_init() call)
|
|
||||||
* @signal_ctx: Registered callback context data (user_data from
|
* @signal_ctx: Registered callback context data (user_data from
|
||||||
* eloop_register_signal(), eloop_register_signal_terminate(), or
|
* eloop_register_signal(), eloop_register_signal_terminate(), or
|
||||||
* eloop_register_signal_reconfig() call)
|
* eloop_register_signal_reconfig() call)
|
||||||
*/
|
*/
|
||||||
typedef void (*eloop_signal_handler)(int sig, void *eloop_ctx,
|
typedef void (*eloop_signal_handler)(int sig, void *signal_ctx);
|
||||||
void *signal_ctx);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eloop_init() - Initialize global event loop data
|
* eloop_init() - Initialize global event loop data
|
||||||
* @user_data: Pointer to global data passed as eloop_ctx to signal handlers
|
|
||||||
* Returns: 0 on success, -1 on failure
|
* Returns: 0 on success, -1 on failure
|
||||||
*
|
*
|
||||||
* This function must be called before any other eloop_* function. user_data
|
* This function must be called before any other eloop_* function.
|
||||||
* can be used to configure a global (to the process) pointer that will be
|
|
||||||
* passed as eloop_ctx parameter to signal handlers.
|
|
||||||
*/
|
*/
|
||||||
int eloop_init(void *user_data);
|
int eloop_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eloop_register_read_sock - Register handler for read events
|
* eloop_register_read_sock - Register handler for read events
|
||||||
|
@ -231,10 +225,6 @@ int eloop_is_timeout_registered(eloop_timeout_handler handler,
|
||||||
* handler has returned. This means that the normal limits for sighandlers
|
* handler has returned. This means that the normal limits for sighandlers
|
||||||
* (i.e., only "safe functions" allowed) do not apply for the registered
|
* (i.e., only "safe functions" allowed) do not apply for the registered
|
||||||
* callback.
|
* callback.
|
||||||
*
|
|
||||||
* Signals are 'global' events and there is no local eloop_data pointer like
|
|
||||||
* with other handlers. The global user_data pointer registered with
|
|
||||||
* eloop_init() will be used as eloop_ctx for signal handlers.
|
|
||||||
*/
|
*/
|
||||||
int eloop_register_signal(int sig, eloop_signal_handler handler,
|
int eloop_register_signal(int sig, eloop_signal_handler handler,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
@ -251,10 +241,6 @@ int eloop_register_signal(int sig, eloop_signal_handler handler,
|
||||||
* sighandlers (i.e., only "safe functions" allowed) do not apply for the
|
* sighandlers (i.e., only "safe functions" allowed) do not apply for the
|
||||||
* registered callback.
|
* registered callback.
|
||||||
*
|
*
|
||||||
* Signals are 'global' events and there is no local eloop_data pointer like
|
|
||||||
* with other handlers. The global user_data pointer registered with
|
|
||||||
* eloop_init() will be used as eloop_ctx for signal handlers.
|
|
||||||
*
|
|
||||||
* This function is a more portable version of eloop_register_signal() since
|
* This function is a more portable version of eloop_register_signal() since
|
||||||
* the knowledge of exact details of the signals is hidden in eloop
|
* the knowledge of exact details of the signals is hidden in eloop
|
||||||
* implementation. In case of operating systems using signal(), this function
|
* implementation. In case of operating systems using signal(), this function
|
||||||
|
@ -275,10 +261,6 @@ int eloop_register_signal_terminate(eloop_signal_handler handler,
|
||||||
* limits for sighandlers (i.e., only "safe functions" allowed) do not apply
|
* limits for sighandlers (i.e., only "safe functions" allowed) do not apply
|
||||||
* for the registered callback.
|
* for the registered callback.
|
||||||
*
|
*
|
||||||
* Signals are 'global' events and there is no local eloop_data pointer like
|
|
||||||
* with other handlers. The global user_data pointer registered with
|
|
||||||
* eloop_init() will be used as eloop_ctx for signal handlers.
|
|
||||||
*
|
|
||||||
* This function is a more portable version of eloop_register_signal() since
|
* This function is a more portable version of eloop_register_signal() since
|
||||||
* the knowledge of exact details of the signals is hidden in eloop
|
* the knowledge of exact details of the signals is hidden in eloop
|
||||||
* implementation. In case of operating systems using signal(), this function
|
* implementation. In case of operating systems using signal(), this function
|
||||||
|
@ -331,10 +313,4 @@ int eloop_terminated(void);
|
||||||
*/
|
*/
|
||||||
void eloop_wait_for_read_sock(int sock);
|
void eloop_wait_for_read_sock(int sock);
|
||||||
|
|
||||||
/**
|
|
||||||
* eloop_get_user_data - Get global user data
|
|
||||||
* Returns: user_data pointer that was registered with eloop_init()
|
|
||||||
*/
|
|
||||||
void * eloop_get_user_data(void);
|
|
||||||
|
|
||||||
#endif /* ELOOP_H */
|
#endif /* ELOOP_H */
|
||||||
|
|
|
@ -41,8 +41,6 @@ struct eloop_signal {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct eloop_data {
|
struct eloop_data {
|
||||||
void *user_data;
|
|
||||||
|
|
||||||
int max_sock, reader_count;
|
int max_sock, reader_count;
|
||||||
struct eloop_sock *readers;
|
struct eloop_sock *readers;
|
||||||
|
|
||||||
|
@ -60,10 +58,9 @@ struct eloop_data {
|
||||||
static struct eloop_data eloop;
|
static struct eloop_data eloop;
|
||||||
|
|
||||||
|
|
||||||
int eloop_init(void *user_data)
|
int eloop_init(void)
|
||||||
{
|
{
|
||||||
memset(&eloop, 0, sizeof(eloop));
|
memset(&eloop, 0, sizeof(eloop));
|
||||||
eloop.user_data = user_data;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,9 +399,3 @@ void eloop_wait_for_read_sock(int sock)
|
||||||
* reading
|
* reading
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void * eloop_get_user_data(void)
|
|
||||||
{
|
|
||||||
return eloop.user_data;
|
|
||||||
}
|
|
||||||
|
|
|
@ -50,8 +50,6 @@ struct eloop_signal {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct eloop_data {
|
struct eloop_data {
|
||||||
void *user_data;
|
|
||||||
|
|
||||||
int max_sock;
|
int max_sock;
|
||||||
size_t reader_count;
|
size_t reader_count;
|
||||||
struct eloop_sock *readers;
|
struct eloop_sock *readers;
|
||||||
|
@ -79,10 +77,9 @@ struct eloop_data {
|
||||||
static struct eloop_data eloop;
|
static struct eloop_data eloop;
|
||||||
|
|
||||||
|
|
||||||
int eloop_init(void *user_data)
|
int eloop_init(void)
|
||||||
{
|
{
|
||||||
os_memset(&eloop, 0, sizeof(eloop));
|
os_memset(&eloop, 0, sizeof(eloop));
|
||||||
eloop.user_data = user_data;
|
|
||||||
eloop.num_handles = 1;
|
eloop.num_handles = 1;
|
||||||
eloop.handles = os_malloc(eloop.num_handles *
|
eloop.handles = os_malloc(eloop.num_handles *
|
||||||
sizeof(eloop.handles[0]));
|
sizeof(eloop.handles[0]));
|
||||||
|
@ -614,9 +611,3 @@ void eloop_wait_for_read_sock(int sock)
|
||||||
WSAEventSelect(sock, event, 0);
|
WSAEventSelect(sock, event, 0);
|
||||||
WSACloseEvent(event);
|
WSACloseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void * eloop_get_user_data(void)
|
|
||||||
{
|
|
||||||
return eloop.user_data;
|
|
||||||
}
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ static void timeout_toggled(DBusTimeout *timeout, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void process_wakeup_main(int sig, void *eloop_ctx, void *signal_ctx)
|
static void process_wakeup_main(int sig, void *signal_ctx)
|
||||||
{
|
{
|
||||||
struct ctrl_iface_dbus_priv *iface = signal_ctx;
|
struct ctrl_iface_dbus_priv *iface = signal_ctx;
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ static void timeout_toggled(DBusTimeout *timeout, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void process_wakeup_main(int sig, void *eloop_ctx, void *signal_ctx)
|
static void process_wakeup_main(int sig, void *signal_ctx)
|
||||||
{
|
{
|
||||||
struct ctrl_iface_dbus_new_priv *iface = signal_ctx;
|
struct ctrl_iface_dbus_new_priv *iface = signal_ctx;
|
||||||
|
|
||||||
|
|
|
@ -949,10 +949,9 @@ static int scard_get_triplets(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void eapol_test_terminate(int sig, void *eloop_ctx,
|
static void eapol_test_terminate(int sig, void *signal_ctx)
|
||||||
void *signal_ctx)
|
|
||||||
{
|
{
|
||||||
struct wpa_supplicant *wpa_s = eloop_ctx;
|
struct wpa_supplicant *wpa_s = signal_ctx;
|
||||||
wpa_msg(wpa_s, MSG_INFO, "Signal %d received - terminating", sig);
|
wpa_msg(wpa_s, MSG_INFO, "Signal %d received - terminating", sig);
|
||||||
eloop_terminate();
|
eloop_terminate();
|
||||||
}
|
}
|
||||||
|
@ -1128,7 +1127,7 @@ int main(int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eloop_init(&wpa_s)) {
|
if (eloop_init()) {
|
||||||
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1171,8 +1170,8 @@ int main(int argc, char *argv[])
|
||||||
eloop_register_timeout(timeout, 0, eapol_test_timeout, &eapol_test,
|
eloop_register_timeout(timeout, 0, eapol_test_timeout, &eapol_test,
|
||||||
NULL);
|
NULL);
|
||||||
eloop_register_timeout(0, 0, send_eap_request_identity, &wpa_s, NULL);
|
eloop_register_timeout(0, 0, send_eap_request_identity, &wpa_s, NULL);
|
||||||
eloop_register_signal_terminate(eapol_test_terminate, NULL);
|
eloop_register_signal_terminate(eapol_test_terminate, &wpa_s);
|
||||||
eloop_register_signal_reconfig(eapol_test_terminate, NULL);
|
eloop_register_signal_reconfig(eapol_test_terminate, &wpa_s);
|
||||||
eloop_run();
|
eloop_run();
|
||||||
|
|
||||||
eloop_cancel_timeout(eapol_test_timeout, &eapol_test, NULL);
|
eloop_cancel_timeout(eapol_test_timeout, &eapol_test, NULL);
|
||||||
|
|
|
@ -277,10 +277,9 @@ static void wpa_init_conf(struct wpa_supplicant *wpa_s, const char *ifname)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void eapol_test_terminate(int sig, void *eloop_ctx,
|
static void eapol_test_terminate(int sig, void *signal_ctx)
|
||||||
void *signal_ctx)
|
|
||||||
{
|
{
|
||||||
struct wpa_supplicant *wpa_s = eloop_ctx;
|
struct wpa_supplicant *wpa_s = signal_ctx;
|
||||||
wpa_msg(wpa_s, MSG_INFO, "Signal %d received - terminating", sig);
|
wpa_msg(wpa_s, MSG_INFO, "Signal %d received - terminating", sig);
|
||||||
eloop_terminate();
|
eloop_terminate();
|
||||||
}
|
}
|
||||||
|
@ -317,7 +316,7 @@ int main(int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eloop_init(&wpa_s)) {
|
if (eloop_init()) {
|
||||||
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -354,8 +353,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
eloop_register_timeout(30, 0, eapol_test_timeout, &preauth_test, NULL);
|
eloop_register_timeout(30, 0, eapol_test_timeout, &preauth_test, NULL);
|
||||||
eloop_register_timeout(0, 100000, eapol_test_poll, &wpa_s, NULL);
|
eloop_register_timeout(0, 100000, eapol_test_poll, &wpa_s, NULL);
|
||||||
eloop_register_signal_terminate(eapol_test_terminate, NULL);
|
eloop_register_signal_terminate(eapol_test_terminate, &wpa_s);
|
||||||
eloop_register_signal_reconfig(eapol_test_terminate, NULL);
|
eloop_register_signal_reconfig(eapol_test_terminate, &wpa_s);
|
||||||
eloop_run();
|
eloop_run();
|
||||||
|
|
||||||
if (preauth_test.auth_timed_out)
|
if (preauth_test.auth_timed_out)
|
||||||
|
|
|
@ -351,7 +351,7 @@ int main(int argc, char *argv[])
|
||||||
wpa_debug_level = 0;
|
wpa_debug_level = 0;
|
||||||
wpa_debug_show_keys = 1;
|
wpa_debug_show_keys = 1;
|
||||||
|
|
||||||
if (eloop_init(&wpa)) {
|
if (eloop_init()) {
|
||||||
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "wpa_priv control directory: '%s'", ctrl_dir);
|
wpa_printf(MSG_DEBUG, "wpa_priv control directory: '%s'", ctrl_dir);
|
||||||
|
|
||||||
if (eloop_init(NULL)) {
|
if (eloop_init()) {
|
||||||
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -546,10 +546,9 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_states state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wpa_supplicant_terminate(int sig, void *eloop_ctx,
|
static void wpa_supplicant_terminate(int sig, void *signal_ctx)
|
||||||
void *signal_ctx)
|
|
||||||
{
|
{
|
||||||
struct wpa_global *global = eloop_ctx;
|
struct wpa_global *global = signal_ctx;
|
||||||
struct wpa_supplicant *wpa_s;
|
struct wpa_supplicant *wpa_s;
|
||||||
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
|
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
|
||||||
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING "- signal %d "
|
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING "- signal %d "
|
||||||
|
@ -647,10 +646,9 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wpa_supplicant_reconfig(int sig, void *eloop_ctx,
|
static void wpa_supplicant_reconfig(int sig, void *signal_ctx)
|
||||||
void *signal_ctx)
|
|
||||||
{
|
{
|
||||||
struct wpa_global *global = eloop_ctx;
|
struct wpa_global *global = signal_ctx;
|
||||||
struct wpa_supplicant *wpa_s;
|
struct wpa_supplicant *wpa_s;
|
||||||
wpa_printf(MSG_DEBUG, "Signal %d received - reconfiguring", sig);
|
wpa_printf(MSG_DEBUG, "Signal %d received - reconfiguring", sig);
|
||||||
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
|
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
|
||||||
|
@ -2320,7 +2318,7 @@ struct wpa_global * wpa_supplicant_init(struct wpa_params *params)
|
||||||
wpa_debug_timestamp = global->params.wpa_debug_timestamp =
|
wpa_debug_timestamp = global->params.wpa_debug_timestamp =
|
||||||
params->wpa_debug_timestamp;
|
params->wpa_debug_timestamp;
|
||||||
|
|
||||||
if (eloop_init(global)) {
|
if (eloop_init()) {
|
||||||
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
||||||
wpa_supplicant_deinit(global);
|
wpa_supplicant_deinit(global);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2389,8 +2387,8 @@ int wpa_supplicant_run(struct wpa_global *global)
|
||||||
wpa_s->ctrl_iface);
|
wpa_s->ctrl_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
eloop_register_signal_terminate(wpa_supplicant_terminate, NULL);
|
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
|
||||||
eloop_register_signal_reconfig(wpa_supplicant_reconfig, NULL);
|
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
|
||||||
|
|
||||||
eloop_run();
|
eloop_run();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue