Passing a socket fd from user mode to a kernel module
Passing a socket fd from user mode to a kernel module
- Subject: Passing a socket fd from user mode to a kernel module
- From: Joe Lowe <email@hidden>
- Date: Fri, 16 Jul 2010 18:54:56 -0700
I have a file system kernel module that exposes a remote file system via
a file system protocol over a socket. Creating/connecting the socket and
performing initial authentication to the server is done in user mode.
The socket is then handed to the kernel module via an ioctl to a control
device.
I have worked out what seem to be the correct kernel calls for this.
converting the fd to a socket reference in the kernel module:
file_socket
sock_retain
file_drop
using the socket from a dedicated kernel thread:
sock_send
sock_receive
cleanup:
sock_shutdown
sock_release
The primary problem is that the sock_retain and sock_release kernel
calls are private exports and are not defined in the public kernel
headers. Without these calls the socket will get torn down when the user
mode process exits or closes the fd.
Am I missing something?
Joe Lowe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden