From: Balachandar on
Hello,
I am trying to implement my own transport layer protocol in Linux for
an experiment. I am going to use socket interface and add my protocol
using sock_register. For the proto_ops i can see that the parameters
for the sendmsg and recvmsg are (struct kiocb *iocb, struct socket
*sock, struct msghdr *msg, size_t len, int flags). But there are three
types of user api's send, sendto, sendmsg. Of these three only sendmsg
contains a parameter for msghdr. I find that the other two api's are
incompatible with the parameters supplied by the kernel to my kernel-
space sendmsg function. So what happens when we use send and sendto
user-space api's? Hope i am clear..

Thanks,
Bala
From: Nicolas George on
Balachandar wrote in message
<ba58c009-f6bd-49c2-bb43-18e489b14e77(a)c33g2000yqm.googlegroups.com>:
> I am trying to implement my own transport layer protocol in Linux for
> an experiment. I am going to use socket interface and add my protocol
> using sock_register. For the proto_ops i can see that the parameters
> for the sendmsg and recvmsg are (struct kiocb *iocb, struct socket
> *sock, struct msghdr *msg, size_t len, int flags). But there are three
> types of user api's send, sendto, sendmsg.

You forget write, and all neighbour system calls: write can also be used
with sockets.

> Of these three only sendmsg
> contains a parameter for msghdr. I find that the other two api's are
> incompatible with the parameters supplied by the kernel to my kernel-
> space sendmsg function. So what happens when we use send and sendto
> user-space api's? Hope i am clear..

You could just read the source code for the send and sendto system calls:
send calls sendto providing a default value for the argument that sendto has
and send does not have; sendto allocates a msghdr structure and fills it
with the arguments it have, and default values for the arguments it does not
have. They are just simplified wrappers.