Info

int kernel_sendmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t len);

int kernel_recvmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t len, int flags);

int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen);

int kernel_listen(struct socket *sock, int backlog); int kernel_accept(struct socket *sock, struct socket **newsock, int flags);

int kernel_connect(struct socket *sock, struct sockaddr *addr, int addrlen, int flags); int kernel_getsockname(struct socket *sock, struct sockaddr *addr, int *addrlen);

int kernel_getpeername(struct socket *sock, struct sockaddr *addr, int *addrlen);

int kernel_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen); int kernel_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen); int kernel_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how);

With the exception of kernel_sendmsg and kernel_recvmsg, the parameters are more or less identical with the userland API, except that sockets are not specified by socket file descriptors, but directly by a pointer to an instance of struct socket. The implementation is simple since the functions work as simple wrapper routines around the pointers stored in the protocol operations proto_ops of struct socket:

Continue reading here: Netsocketc

Was this article helpful?

0 0