Skip to contentSkip to conversation

Document the kernel_recvmsg() function

PATCH Applied Martin Lucina 3 participants 4 messages Dec 10, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Document the kernel_recvmsg() function

[Updated and sent to the netdev mailing list, Eric thx for the pointer]

Hi,

so, today we spent all day figuring out how the kernel_sendmsg() function *actually* works. This patch adds some documentation to help the next poor sod.

-mato

Quoted 1 line

From 1a977fc0b9544c53761ba3c4c26ca1aac2018663 Mon Sep 17 00:00:00 2001

From: Martin Lucina <[email protected]>
Date: Thu, 9 Dec 2010 17:11:18 +0100
Subject: [PATCH] Document the kernel_recvmsg() function

---
 net/socket.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
net/socket.c +15 -0
index 3ca2fd9..088fb3f 100644
@@ -732,6 +732,21 @@ static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
 	return ret;
 }
 
+/**
+ * kernel_recvmsg - Receive a message from a socket (kernel space)
+ * @sock:       The socket to receive the message from
+ * @msg:        Received message
+ * @vec:        Input s/g array for message data
+ * @num:        Size of input s/g array
+ * @size:       Number of bytes to read
+ * @flags:      Message flags (MSG_DONTWAIT, etc...)
+ *
+ * On return the msg structure contains the scatter/gather array passed in the
+ * vec argument. The array is modified so that it consists of the unfilled
+ * portion of the original array.
+ *
+ * The returned value is the total number of bytes received, or an error.
+ */
 int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
 		   struct kvec *vec, size_t num, size_t size, int flags)
 {
Signature · 1 line
1.7.1
#1 lore raw
Quoted 5 lines · On Fri, 10 Dec 2010 11:04:05 +0100 Martin Lucina wrote:

[Updated and sent to the netdev mailing list, Eric thx for the pointer]

Hi,

so, today we spent all day figuring out how the kernel_sendmsg() function

                                                  ^^^^^^^^^^^^^^

Maybe you could document that one also?? Thanks.

Quoted 32 lines

*actually* works. This patch adds some documentation to help the next poor sod.

-mato

From 1a977fc0b9544c53761ba3c4c26ca1aac2018663 Mon Sep 17 00:00:00 2001
From: Martin Lucina <[email protected]>
Date: Thu, 9 Dec 2010 17:11:18 +0100
Subject: [PATCH] Document the kernel_recvmsg() function

---
 net/socket.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
net/socket.c +8 -0
index 3ca2fd9..088fb3f 100644
@@ -732,6 +732,21 @@ static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
 	return ret;
 }
 
+/**
+ * kernel_recvmsg - Receive a message from a socket (kernel space)
+ * @sock:       The socket to receive the message from
+ * @msg:        Received message
+ * @vec:        Input s/g array for message data
+ * @num:        Size of input s/g array
+ * @size:       Number of bytes to read
+ * @flags:      Message flags (MSG_DONTWAIT, etc...)

net/socket.c static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, · line 752

Quoted 10 lines
net/socket.c +7 -0
+ *
+ * On return the msg structure contains the scatter/gather array passed in the
+ * vec argument. The array is modified so that it consists of the unfilled
+ * portion of the original array.
+ *
+ * The returned value is the total number of bytes received, or an error.
+ */
 int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
 		   struct kvec *vec, size_t num, size_t size, int flags)
 {

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#2 lore raw
Quoted 11 lines · [email protected] said:
Quoted 5 lines · On Fri, 10 Dec 2010 11:04:05 +0100 Martin Lucina wrote:

[Updated and sent to the netdev mailing list, Eric thx for the pointer]

Hi,

so, today we spent all day figuring out how the kernel_sendmsg() function

                                                  ^^^^^^^^^^^^^^

Maybe you could document that one also?? Thanks.

Sorry, that was a typo. But yes, we'll get to kernel_sendmsg(), as soon as we can actually test that properly...

In any case, kernel_recvmsg() appears to be the more evil of the two, since it was not obvious at all that it modifies the pointers passed in to kvec.

-mato