Index: include/protocols/talkd.h =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/include/protocols/talkd.h,v retrieving revision 1.1 diff -u -u -r1.1 talkd.h --- include/protocols/talkd.h 17 Jun 2003 02:50:26 -0000 1.1 +++ include/protocols/talkd.h 11 Sep 2003 18:24:22 -0000 @@ -55,6 +55,16 @@ */ /* + * XXX: Nothing should explicity reference the structure osockaddr. + * It is for binary compatibility only. The talk protocol doesn't + * understand this yet. + */ +struct osockaddr { + u_short sa_family; + char sa_data[14]; +}; + +/* * Client->server request message format. */ typedef struct { Index: sys/conf/files =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/conf/files,v retrieving revision 1.12 diff -u -u -r1.12 files --- sys/conf/files 6 Sep 2003 21:51:11 -0000 1.12 +++ sys/conf/files 10 Sep 2003 13:02:00 -0000 @@ -1433,4 +1433,4 @@ dev/drm/radeon/radeon_mem.c optional radeondrm dev/drm/radeon/radeon_state.c optional radeondrm dev/drm/tdfx/tdfx_drv.c optional tdfxdrm - +emulation/43bsd/43bsd_socket.c optional compat_43 Index: sys/emulation/43bsd/43bsd_socket.c =================================================================== RCS file: sys/emulation/43bsd/43bsd_socket.c diff -N sys/emulation/43bsd/43bsd_socket.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sys/emulation/43bsd/43bsd_socket.c 10 Sep 2003 19:50:03 -0000 @@ -0,0 +1,178 @@ +/* + * 43BSD_SOCKET.C - 4.3BSD compatibility socket syscalls + * + * Copyright (c) 1982, 1986, 1989, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly$ + * from: DragonFly kern/uipc_syscalls.c,v 1.13 + * + * The original versions of these syscalls used to live in + * kern/uipc_syscalls.c. These are heavily modified to use the + * new split syscalls. + */ + +#include "opt_compat.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "43bsd_socket.h" + +/* + * System call interface to the socket abstraction. + */ + +static int +compat_43_getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len) +{ + struct sockaddr *sa; + int error; + + *namp = NULL; + if (len > SOCK_MAXADDRLEN) + return ENAMETOOLONG; + if (len < offsetof(struct sockaddr, sa_data[0])) + return EDOM; + MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK); + error = copyin(uaddr, sa, len); + if (error) { + FREE(sa, M_SONAME); + } else { + /* + * Convert to the 4.4BSD sockaddr structure. + */ + sa->sa_family = sa->sa_len; + sa->sa_len = len; + *namp = sa; + } + return error; +} + +static int +compat_43_copyout_sockaddr(struct sockaddr *sa, caddr_t uaddr) +{ + int error, sa_len; + + /* Save the length of sa before we destroy it */ + sa_len = sa->sa_len; + ((struct osockaddr *)sa)->sa_family = sa->sa_family; + + error = copyout(sa, uaddr, sa_len); + + return (error); +} + +int +oaccept(struct accept_args *uap) +{ + struct sockaddr *sa = NULL; + int sa_len; + int error; + + if (uap->name) { + error = copyin(uap->anamelen, &sa_len, sizeof(sa_len)); + if (error) + return (error); + + error = kern_accept(uap->s, &sa, &sa_len, &uap->sysmsg_result); + + if (error) { + /* + * return a namelen of zero for older code which + * might ignore the return value from accept. + */ + sa_len = 0; + copyout(&sa_len, uap->anamelen, sizeof(*uap->anamelen)); + } else { + compat_43_copyout_sockaddr(sa, uap->name); + if (error == 0) { + error = copyout(&sa_len, uap->anamelen, + sizeof(*uap->anamelen)); + } + } + if (sa) + FREE(sa, M_SONAME); + } else { + error = kern_accept(uap->s, NULL, 0, &uap->sysmsg_result); + } + return (error); +} + +int +ogetsockname(struct getsockname_args *uap) +{ + struct sockaddr *sa = NULL; + int error, sa_len; + + error = copyin(uap->alen, &sa_len, sizeof(sa_len)); + if (error) + return (error); + + error = kern_getsockname(uap->fdes, &sa, &sa_len); + + if (error == 0) + error = compat_43_copyout_sockaddr(sa, uap->asa); + if (error == 0) { + error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); + } + if (sa) + FREE(sa, M_SONAME); + return (error); +} + +int +ogetpeername(struct ogetpeername_args *uap) +{ + struct sockaddr *sa = NULL; + int error, sa_len; + + error = copyin(uap->alen, &sa_len, sizeof(sa_len)); + if (error) + return (error); + + error = kern_getpeername(uap->fdes, &sa, &sa_len); + + if (error == 0) { + error = compat_43_copyout_sockaddr(sa, uap->asa); + } + if (error == 0) + error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); + if (sa) + FREE(sa, M_SONAME); + return (error); +} Index: sys/emulation/43bsd/43bsd_socket.h =================================================================== RCS file: sys/emulation/43bsd/43bsd_socket.h diff -N sys/emulation/43bsd/43bsd_socket.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sys/emulation/43bsd/43bsd_socket.h 10 Sep 2003 19:52:11 -0000 @@ -0,0 +1,46 @@ +/* + * 43BSD_SOCKET.H - 4.3BSD compatibility structures for the socket code + * + * Copyright (c) 1982, 1986, 1989, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly$ + * from: DragonFly sys/socket.h,v 1.3 + * + * These are the 4.3BSD compatibility structures from sys/socket.h. + * The structure omsghdr will migrate here after some changes are made + * to o{send,recv} and o{send,recv}msg. + */ + +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; Index: sys/emulation/svr4/svr4_ioctl.c =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/emulation/svr4/svr4_ioctl.c,v retrieving revision 1.10 diff -u -u -r1.10 svr4_ioctl.c --- sys/emulation/svr4/svr4_ioctl.c 27 Aug 2003 06:07:10 -0000 1.10 +++ sys/emulation/svr4/svr4_ioctl.c 10 Sep 2003 13:02:00 -0000 @@ -38,6 +38,8 @@ #include #include +#include + #include "svr4.h" #include "svr4_types.h" #include "svr4_util.h" Index: sys/emulation/svr4/svr4_sockio.c =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/emulation/svr4/svr4_sockio.c,v retrieving revision 1.5 diff -u -u -r1.5 svr4_sockio.c --- sys/emulation/svr4/svr4_sockio.c 27 Aug 2003 06:07:10 -0000 1.5 +++ sys/emulation/svr4/svr4_sockio.c 10 Sep 2003 13:02:00 -0000 @@ -39,6 +39,8 @@ #include #include +#include + #include "svr4.h" #include "svr4_util.h" #include "svr4_ioctl.h" Index: sys/emulation/svr4/svr4_sysvec.c =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/emulation/svr4/svr4_sysvec.c,v retrieving revision 1.6 diff -u -u -r1.6 svr4_sysvec.c --- sys/emulation/svr4/svr4_sysvec.c 7 Aug 2003 21:17:19 -0000 1.6 +++ sys/emulation/svr4/svr4_sysvec.c 10 Sep 2003 13:02:00 -0000 @@ -57,6 +57,8 @@ #include #include +#include + #include "svr4.h" #include "svr4_types.h" #include "svr4_syscall.h" Index: sys/kern/uipc_syscalls.c =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.13 diff -u -u -r1.13 uipc_syscalls.c --- sys/kern/uipc_syscalls.c 7 Sep 2003 20:36:11 -0000 1.13 +++ sys/kern/uipc_syscalls.c 10 Sep 2003 13:02:00 -0000 @@ -73,6 +73,10 @@ #include #include +#if defined(COMPAT_43) +#include +#endif /* COMPAT_43 */ + static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL) @@ -374,48 +378,6 @@ return (error); } -#ifdef COMPAT_OLDSOCK -int -oaccept(struct accept_args *uap) -{ - struct sockaddr *sa = NULL; - int sa_len; - int error; - - if (uap->name) { - error = copyin(uap->anamelen, &sa_len, sizeof(sa_len)); - if (error) - return (error); - - error = kern_accept(uap->s, &sa, &sa_len, &uap->sysmsg_result); - - if (error) { - /* - * return a namelen of zero for older code which - * might ignore the return value from accept. - */ - sa_len = 0; - copyout(&sa_len, uap->anamelen, sizeof(*uap->anamelen)); - } else { - /* - * Convert sa to the 4.3BSD sockaddr structure. - */ - ((struct osockaddr *)sa)->sa_family = sa->sa_family; - error = copyout(sa, uap->name, sa_len); - if (error == 0) { - error = copyout(&sa_len, uap->anamelen, - sizeof(*uap->anamelen)); - } - } - if (sa) - FREE(sa, M_SONAME); - } else { - error = kern_accept(uap->s, NULL, 0, &uap->sysmsg_result); - } - return (error); -} -#endif /* COMPAT_OLDSOCK */ - int kern_connect(int s, struct sockaddr *sa) { @@ -1250,35 +1212,6 @@ return (error); } -#ifdef COMPAT_OLDSOCK -int -ogetsockname(struct getsockname_args *uap) -{ - struct sockaddr *sa = NULL; - int error, sa_len; - - error = copyin(uap->alen, &sa_len, sizeof(sa_len)); - if (error) - return (error); - - error = kern_getsockname(uap->fdes, &sa, &sa_len); - - if (error == 0) { - /* - * Convert sa to the 4.3BSD sockaddr structure. - */ - ((struct osockaddr *)sa)->sa_family = sa->sa_family; - error = copyout(sa, uap->asa, sa_len); - } - if (error == 0) { - error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); - } - if (sa) - FREE(sa, M_SONAME); - return (error); -} -#endif /* COMPAT_OLDSOCK */ - /* * The second argument to kern_getpeername() is a handle to a struct sockaddr. * This allows kern_getpeername() to return a pointer to an allocated struct @@ -1346,34 +1279,6 @@ FREE(sa, M_SONAME); return (error); } - -#ifdef COMPAT_OLDSOCK -int -ogetpeername(struct ogetpeername_args *uap) -{ - struct sockaddr *sa = NULL; - int error, sa_len; - - error = copyin(uap->alen, &sa_len, sizeof(sa_len)); - if (error) - return (error); - - error = kern_getpeername(uap->fdes, &sa, &sa_len); - - if (error == 0) { - /* - * Convert sa to the 4.3BSD sockaddr structure. - */ - ((struct osockaddr *)sa)->sa_family = sa->sa_family; - error = copyout(sa, uap->asa, sa_len); - } - if (error == 0) - error = copyout(&sa_len, uap->alen, sizeof(*uap->alen)); - if (sa) - FREE(sa, M_SONAME); - return (error); -} -#endif /* COMPAT_OLDSOCK */ int sockargs(mp, buf, buflen, type) Index: sys/net/if.c =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/net/if.c,v retrieving revision 1.6 diff -u -u -r1.6 if.c --- sys/net/if.c 26 Aug 2003 20:49:47 -0000 1.6 +++ sys/net/if.c 10 Sep 2003 13:02:00 -0000 @@ -73,6 +73,10 @@ #endif #endif +#if defined(COMPAT_43) +#include +#endif /* COMPAT_43 */ + /* * System initialization */ Index: sys/sys/socket.h =================================================================== RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/sys/socket.h,v retrieving revision 1.3 diff -u -u -r1.3 socket.h --- sys/sys/socket.h 20 Aug 2003 07:31:21 -0000 1.3 +++ sys/sys/socket.h 10 Sep 2003 13:02:00 -0000 @@ -394,14 +394,6 @@ #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ /* - * 4.3 compat sockaddr, move to compat file later - */ -struct osockaddr { - u_short sa_family; /* address family */ - char sa_data[14]; /* up to 14 bytes of direct address */ -}; - -/* * 4.3-compat message header (move to compat file later). */ struct omsghdr {