quoted from professional linux kernel architecture by Wolfgange Mauerer.
include/net/sock.h
http://lxr.linux.no/#linux+v2.6.34/include/net/sock.h#L836
struct socket_alloc {
struct socket socket;
struct inode vfs_inode;
}
inode and socket are linked by allocating one directly after the other in memory by using struct socket_alloc
The kernel provides two macros that prform the necessary pointer arithmetic to move from an inode to asociated socket instance (SOCKET_I) and vice versa (SOCK_INODE).
To simplify the situation, whenever a socket is attached to a file, sock_attach_fd() sets the private_data element of struct file so that it points to the socket instance.
socketcall system call
there are 17 operations
Keine Kommentare:
Kommentar veröffentlichen