linux_socket.c (111173) | linux_socket.c (111797) |
---|---|
1/*- 2 * Copyright (c) 1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/compat/linux/linux_socket.c 111173 2003-02-20 11:24:55Z ume $ | 28 * $FreeBSD: head/sys/compat/linux/linux_socket.c 111797 2003-03-03 09:14:26Z des $ |
29 */ 30 31/* XXX we use functions that might not exist. */ 32#include "opt_compat.h" 33#include "opt_inet6.h" 34 35#ifndef COMPAT_43 36#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!" --- 74 unchanged lines hidden (view full) --- 111 if (alloclen == sizeof (struct sockaddr_in6) - sizeof (u_int32_t)) { 112 alloclen = sizeof (struct sockaddr_in6); 113 oldv6size = 1; 114 } 115#endif 116 117 MALLOC(kosa, struct osockaddr *, alloclen, mtype, M_WAITOK); 118 | 29 */ 30 31/* XXX we use functions that might not exist. */ 32#include "opt_compat.h" 33#include "opt_inet6.h" 34 35#ifndef COMPAT_43 36#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!" --- 74 unchanged lines hidden (view full) --- 111 if (alloclen == sizeof (struct sockaddr_in6) - sizeof (u_int32_t)) { 112 alloclen = sizeof (struct sockaddr_in6); 113 oldv6size = 1; 114 } 115#endif 116 117 MALLOC(kosa, struct osockaddr *, alloclen, mtype, M_WAITOK); 118 |
119 if ((error = copyin(osa, (caddr_t) kosa, *osalen))) | 119 if ((error = copyin(osa, kosa, *osalen))) |
120 goto out; 121 122 bdom = linux_to_bsd_domain(kosa->sa_family); 123 if (bdom == -1) { 124 error = EINVAL; 125 goto out; 126 } 127 --- 232 unchanged lines hidden (view full) --- 360{ 361 struct osockaddr sa; 362 int error, bdom; 363 364 /* 365 * Only read/write the osockaddr family part, the rest is 366 * not changed. 367 */ | 120 goto out; 121 122 bdom = linux_to_bsd_domain(kosa->sa_family); 123 if (bdom == -1) { 124 error = EINVAL; 125 goto out; 126 } 127 --- 232 unchanged lines hidden (view full) --- 360{ 361 struct osockaddr sa; 362 int error, bdom; 363 364 /* 365 * Only read/write the osockaddr family part, the rest is 366 * not changed. 367 */ |
368 error = copyin((caddr_t) osa, (caddr_t) &sa, sizeof(sa.sa_family)); | 368 error = copyin(osa, &sa, sizeof(sa.sa_family)); |
369 if (error) 370 return (error); 371 372 bdom = bsd_to_linux_domain(sa.sa_family); 373 if (bdom == -1) 374 return (EINVAL); 375 376 sa.sa_family = bdom; --- 620 unchanged lines hidden (view full) --- 997 struct msghdr *nmsg = NULL; 998 int error; 999 int level; 1000 caddr_t control; 1001 1002 if ((error = copyin(args, &linux_args, sizeof(linux_args)))) 1003 return (error); 1004 | 369 if (error) 370 return (error); 371 372 bdom = bsd_to_linux_domain(sa.sa_family); 373 if (bdom == -1) 374 return (EINVAL); 375 376 sa.sa_family = bdom; --- 620 unchanged lines hidden (view full) --- 997 struct msghdr *nmsg = NULL; 998 int error; 999 int level; 1000 caddr_t control; 1001 1002 if ((error = copyin(args, &linux_args, sizeof(linux_args)))) 1003 return (error); 1004 |
1005 error = copyin(linux_args.msg, (caddr_t) &msg, sizeof(msg)); | 1005 error = copyin(linux_args.msg, &msg, sizeof(msg)); |
1006 if (error) 1007 return (error); 1008 1009 if (msg.msg_name) { 1010 struct sockaddr *sa; 1011 caddr_t sg = stackgap_init(); 1012 1013 nmsg = (struct msghdr *) stackgap_alloc(&sg, --- 66 unchanged lines hidden (view full) --- 1080 1081 bsd_args.s = linux_args.s; 1082 bsd_args.msg = linux_args.msg; 1083 bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags); 1084 error = recvmsg(td, &bsd_args); 1085 if (error) 1086 return (error); 1087 | 1006 if (error) 1007 return (error); 1008 1009 if (msg.msg_name) { 1010 struct sockaddr *sa; 1011 caddr_t sg = stackgap_init(); 1012 1013 nmsg = (struct msghdr *) stackgap_alloc(&sg, --- 66 unchanged lines hidden (view full) --- 1080 1081 bsd_args.s = linux_args.s; 1082 bsd_args.msg = linux_args.msg; 1083 bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags); 1084 error = recvmsg(td, &bsd_args); 1085 if (error) 1086 return (error); 1087 |
1088 error = copyin((caddr_t)linux_args.msg, (caddr_t)&msg, sizeof(msg)); | 1088 error = copyin(linux_args.msg, &msg, sizeof(msg)); |
1089 if (error) 1090 return (error); 1091 if (msg.msg_name && msg.msg_namelen > 2) 1092 error = linux_sa_put(msg.msg_name); 1093 return (error); 1094} 1095 1096struct linux_shutdown_args { --- 168 unchanged lines hidden --- | 1089 if (error) 1090 return (error); 1091 if (msg.msg_name && msg.msg_namelen > 2) 1092 error = linux_sa_put(msg.msg_name); 1093 return (error); 1094} 1095 1096struct linux_shutdown_args { --- 168 unchanged lines hidden --- |