socket KPI upcall questions
socket KPI upcall questions
- Subject: socket KPI upcall questions
- From: email@hidden
- Date: Sun, 26 Mar 2006 14:52:37 -0800
I'm using the socket KPI in an IOKit driver and I had some questions
about socket upcalls:
1. The documentation in kpi_socket.h for the sock_upcall function says
it can be called concurrently by multiple threads. Is this even true
for a single socket? For example, if I do a socket_connect and it
completes and calls my upcall then while my upcall is running data
becomes available on the socket, will it reenter my upcall to tell me
data is available?
What I'm concerned about is that since the upcall doesn't tell you
what event it is calling you for, I'm using a state variable in my
per-socket upcall cookie to know when to move from the "connecting" to
"reading" state. If I can be re-entered while in my upcall, I'll need
to somehow protect my state variable. I've read that you can't block
in an upcall so I'd need to use something like a simple lock (is a
simple safe in an upcall?).
2. If my socket is non-blocking, is it safe to call socket KPI
functions, such as sock_receive from my upcall? I'd like to chain
upcall completions. I see from the source in Darwin that functions
like sock_getpeername take the socket_lock so I wasn't sure if the
socket KPI is safe to call from my upcall.
3. If I call socket_connect on a TCP socket, will my upcall be called
if there is a connection failure (e.g. server not listening on that
port) or only on connection success?
4. If I call socket_connect on a TCP socket then need to abort it
before my upcall is called for connection completion, is it safe to
just call socket_close?
Any info would be appreciated. Thanks!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden