aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-12-19 17:22:16 (GMT)
committerJouni Malinen <j@w1.fi>2009-12-19 17:22:16 (GMT)
commit0456ea16d8edfa47c4ff1ddabf4f496a3c5c67bd (patch)
treee9d5e769ac18c55f6fc7104f56b72fba7fcb0f7a /src/utils
parent9969e5a46a4671a6c75dfc6c2952296e170bf50b (diff)
downloadhostap-0456ea16d8edfa47c4ff1ddabf4f496a3c5c67bd.zip
hostap-0456ea16d8edfa47c4ff1ddabf4f496a3c5c67bd.tar.gz
hostap-0456ea16d8edfa47c4ff1ddabf4f496a3c5c67bd.tar.bz2
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.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/eloop.c12
-rw-r--r--src/utils/eloop.h30
-rw-r--r--src/utils/eloop_none.c11
-rw-r--r--src/utils/eloop_win.c11
4 files changed, 6 insertions, 58 deletions
diff --git a/src/utils/eloop.c b/src/utils/eloop.c
index 59fab99..a6b6025 100644
--- a/src/utils/eloop.c
+++ b/src/utils/eloop.c
@@ -50,8 +50,6 @@ struct eloop_sock_table {
};
struct eloop_data {
- void *user_data;
-
int max_sock;
struct eloop_sock_table readers;
@@ -81,10 +79,9 @@ static void eloop_sigsegv_handler(int sig)
#endif /* WPA_TRACE */
-int eloop_init(void *user_data)
+int eloop_init(void)
{
os_memset(&eloop, 0, sizeof(eloop));
- eloop.user_data = user_data;
#ifdef WPA_TRACE
signal(SIGSEGV, eloop_sigsegv_handler);
#endif /* WPA_TRACE */
@@ -408,7 +405,6 @@ static void eloop_process_pending_signals(void)
if (eloop.signals[i].signaled) {
eloop.signals[i].signaled = 0;
eloop.signals[i].handler(eloop.signals[i].sig,
- eloop.user_data,
eloop.signals[i].user_data);
}
}
@@ -588,9 +584,3 @@ void eloop_wait_for_read_sock(int sock)
FD_SET(sock, &rfds);
select(sock + 1, &rfds, NULL, NULL, NULL);
}
-
-
-void * eloop_get_user_data(void)
-{
- return eloop.user_data;
-}
diff --git a/src/utils/eloop.h b/src/utils/eloop.h
index cf83f38..1228f24 100644
--- a/src/utils/eloop.h
+++ b/src/utils/eloop.h
@@ -65,25 +65,19 @@ typedef void (*eloop_timeout_handler)(void *eloop_data, void *user_ctx);
/**
* eloop_signal_handler - eloop signal event callback type
* @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
* eloop_register_signal(), eloop_register_signal_terminate(), or
* eloop_register_signal_reconfig() call)
*/
-typedef void (*eloop_signal_handler)(int sig, void *eloop_ctx,
- void *signal_ctx);
+typedef void (*eloop_signal_handler)(int sig, void *signal_ctx);
/**
* 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
*
- * This function must be called before any other eloop_* function. user_data
- * can be used to configure a global (to the process) pointer that will be
- * passed as eloop_ctx parameter to signal handlers.
+ * This function must be called before any other eloop_* function.
*/
-int eloop_init(void *user_data);
+int eloop_init(void);
/**
* 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
* (i.e., only "safe functions" allowed) do not apply 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.
*/
int eloop_register_signal(int sig, eloop_signal_handler handler,
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
* 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
* the knowledge of exact details of the signals is hidden in eloop
* 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
* 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
* the knowledge of exact details of the signals is hidden in eloop
* 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);
-/**
- * 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 */
diff --git a/src/utils/eloop_none.c b/src/utils/eloop_none.c
index 215030b..18eae4e 100644
--- a/src/utils/eloop_none.c
+++ b/src/utils/eloop_none.c
@@ -41,8 +41,6 @@ struct eloop_signal {
};
struct eloop_data {
- void *user_data;
-
int max_sock, reader_count;
struct eloop_sock *readers;
@@ -60,10 +58,9 @@ struct eloop_data {
static struct eloop_data eloop;
-int eloop_init(void *user_data)
+int eloop_init(void)
{
memset(&eloop, 0, sizeof(eloop));
- eloop.user_data = user_data;
return 0;
}
@@ -402,9 +399,3 @@ void eloop_wait_for_read_sock(int sock)
* reading
*/
}
-
-
-void * eloop_get_user_data(void)
-{
- return eloop.user_data;
-}
diff --git a/src/utils/eloop_win.c b/src/utils/eloop_win.c
index c95aa76..671a776 100644
--- a/src/utils/eloop_win.c
+++ b/src/utils/eloop_win.c
@@ -50,8 +50,6 @@ struct eloop_signal {
};
struct eloop_data {
- void *user_data;
-
int max_sock;
size_t reader_count;
struct eloop_sock *readers;
@@ -79,10 +77,9 @@ struct eloop_data {
static struct eloop_data eloop;
-int eloop_init(void *user_data)
+int eloop_init(void)
{
os_memset(&eloop, 0, sizeof(eloop));
- eloop.user_data = user_data;
eloop.num_handles = 1;
eloop.handles = os_malloc(eloop.num_handles *
sizeof(eloop.handles[0]));
@@ -614,9 +611,3 @@ void eloop_wait_for_read_sock(int sock)
WSAEventSelect(sock, event, 0);
WSACloseEvent(event);
}
-
-
-void * eloop_get_user_data(void)
-{
- return eloop.user_data;
-}