Index: sys/compat/linux/linux_socket.c =================================================================== --- sys/compat/linux/linux_socket.c +++ sys/compat/linux/linux_socket.c @@ -790,24 +790,11 @@ static int linux_send(struct thread *td, struct linux_send_args *args) { - struct sendto_args /* { - int s; - caddr_t buf; - int len; - int flags; - caddr_t to; - int tolen; - } */ bsd_args; struct file *fp; int error, fflag; - bsd_args.s = args->s; - bsd_args.buf = (caddr_t)PTRIN(args->msg); - bsd_args.len = args->len; - bsd_args.flags = args->flags; - bsd_args.to = NULL; - bsd_args.tolen = 0; - error = sys_sendto(td, &bsd_args); + error = kern_sendto(td, args->s, PTRIN(args->msg), args->len, + args->flags, NULL, 0); if (error == ENOTCONN) { /* * Linux doesn't return ENOTCONN for non-blocking sockets. Index: sys/kern/uipc_syscalls.c =================================================================== --- sys/kern/uipc_syscalls.c +++ sys/kern/uipc_syscalls.c @@ -824,11 +824,20 @@ int sys_sendto(struct thread *td, struct sendto_args *uap) { + + return (kern_sendto(td, uap->s, uap->buf, uap->len, + uap->flags, uap->to, uap->tolen)); +} + +int +kern_sendto(struct thread *td, int s, const void *buf, size_t len, + int flags, const struct sockaddr *to, int tolen) +{ struct msghdr msg; struct iovec aiov; - msg.msg_name = __DECONST(void *, uap->to); - msg.msg_namelen = uap->tolen; + msg.msg_name = __DECONST(void *, to); + msg.msg_namelen = tolen; msg.msg_iov = &aiov; msg.msg_iovlen = 1; msg.msg_control = 0; @@ -836,9 +845,9 @@ if (SV_PROC_FLAG(td->td_proc, SV_AOUT)) msg.msg_flags = 0; #endif - aiov.iov_base = __DECONST(void *, uap->buf); - aiov.iov_len = uap->len; - return (sendit(td, uap->s, &msg, uap->flags)); + aiov.iov_base = __DECONST(void *, buf); + aiov.iov_len = len; + return (sendit(td, s, &msg, flags)); } #ifdef COMPAT_OLDSOCK Index: sys/sys/syscallsubr.h =================================================================== --- sys/sys/syscallsubr.h +++ sys/sys/syscallsubr.h @@ -243,6 +243,8 @@ fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits); int kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, struct mbuf *control, enum uio_seg segflg); +int kern_sendto(struct thread *td, int s, const void *buf, size_t len, + int flags, const struct sockaddr *to, int tolen); int kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups); int kern_setitimer(struct thread *, u_int, struct itimerval *, struct itimerval *);