summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1999-01-11 05:28:44 +0000
committermsmith <msmith@FreeBSD.org>1999-01-11 05:28:44 +0000
commitc319cef85823dfc262035ce8e05b52a1f9730102 (patch)
tree8f6a82289243759268a664fe58b1985713095925 /sys/compat/linux
parent710a04e8b4ed8d86aa05f8184e8993e3b202034f (diff)
downloadFreeBSD-src-c319cef85823dfc262035ce8e05b52a1f9730102.zip
FreeBSD-src-c319cef85823dfc262035ce8e05b52a1f9730102.tar.gz
Fix linux sendmsg() emulation
Submitted by: Brian Feldman <green@unixhelp.org>
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_socket.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index e9f4c43..e757fc1 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_socket.c,v 1.13 1998/03/28 10:33:04 bde Exp $
+ * $Id: linux_socket.c,v 1.14 1998/12/30 21:20:00 sos Exp $
*/
/* XXX we use functions that might not exist. */
@@ -811,7 +811,40 @@ linux_socketcall(struct proc *p, struct linux_socketcall_args *args)
case LINUX_GETSOCKOPT:
return linux_getsockopt(p, args->args);
case LINUX_SENDMSG:
- return sendmsg(p, args->args);
+ do {
+ int error;
+ int level;
+ caddr_t control;
+ struct {
+ int s;
+ const struct msghdr *msg;
+ int flags;
+ } *uap = args->args;
+
+ error = copyin(&uap->msg->msg_control,
+ &control, sizeof(caddr_t));
+ if (error)
+ return error;
+ if (control == NULL)
+ goto done;
+ error = copyin(&((struct cmsghdr *)control)->cmsg_level,
+ &level, sizeof(int));
+ if (error)
+ return error;
+ if (level == 1) {
+ /*
+ * Linux thinks that SOL_SOCKET is 1; we know that it's really
+ * 0xffff, of course.
+ */
+ level = SOL_SOCKET;
+ error = copyout(&level, &((struct cmsghdr *)control)->
+ cmsg_level, sizeof(int));
+ if (error)
+ return error;
+ }
+ done:
+ return sendmsg(p, args->args);
+ } while (0);
case LINUX_RECVMSG:
return recvmsg(p, args->args);
OpenPOWER on IntegriCloud