eloop_register_read_sock() data argument order - BUG or just inconsistency or nothing?

Patrik Lahti plahti
Thu Mar 25 13:20:55 PDT 2010

Hi everyone,

E.g. driver_wext.c:wpa_driver_wext_init() does this:

     eloop_register_read_sock(s, wpa_driver_wext_event_receive, drv, ctx);

But driver_bsd.c:wpa_driver_bsd_init() does:

         wpa_driver_bsd_event_receive, ctx, drv);

eloop.h says:
  * eloop_register_read_sock - Register handler for read events
  * @sock: File descriptor number for the socket
  * @handler: Callback function to be called when data is available for 
  * @eloop_data: Callback context data (eloop_ctx)
  * @user_data: Callback context data (sock_ctx)
  * Returns: 0 on success, -1 on failure
  * Register a read socket notifier for the given file descriptor. The 
  * function will be called whenever data is available for reading from the
  * socket. The handler function is responsible for clearing the event after
  * having processed it in order to avoid eloop from calling the handler 
  * for the same event.
int eloop_register_read_sock(int sock, eloop_sock_handler handler,
                  void *eloop_data, void *user_data);

I think driver_bsd.c is correct, or am I missing something? Maybe it 
doesn't matter...? It seems the eloop_data is conceptually the global 
context and user_data is the local context. And it would make sense that 
the drv is passed to eloop_register_read_sock() as the local context 
like driver_bsd.c does.

This is in 0.6.10.

PS. I am not subscribed to this list so I would appreciate if you can cc 
me on responses. Thank you!

Regards and Thanks in advance,

More information about the Hostap mailing list