diff options
author | Steven Wallace <swallace@FreeBSD.org> | 1995-10-07 23:47:26 +0000 |
---|---|---|
committer | Steven Wallace <swallace@FreeBSD.org> | 1995-10-07 23:47:26 +0000 |
commit | 93c9414e4914e37143c6156830ca3e116ee673d7 (patch) | |
tree | a38519e60d7b71e3add675bd06d7001857b69f2d /sys/kern/uipc_syscalls.c | |
parent | 27df7c0af8a0298eb0c8a75b4912a2eb34989d9f (diff) | |
download | src-93c9414e4914e37143c6156830ca3e116ee673d7.tar.gz src-93c9414e4914e37143c6156830ca3e116ee673d7.zip |
Remove compat_43 psuedo-argument hack, and replace with a better hack.
Instead of using a fake "compat" argument, pass a real compat int to function
if COMPAT_43 is defined. Functions involved: wait4, accept, recvfrom,
getsockname.
With the compat psuedo-argument, this introduces an argument structure
that can have two possible sizes depending on compat options.
This makes life difficult for lkm modules like ibcs2, which would
have to guess what size used in kernel when compiled. Also,
the prototype generator for these structures cannot generate proper sizes.
Now there is only one fixed structure and makes everybody happy.
I recommend these changes be introduced to 2.1 so that ibcs2, linux
lkm's generated for 2.2 can still run on a 2.1 kernel.
Notes
Notes:
svn path=/head/; revision=11328
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 205 |
1 files changed, 104 insertions, 101 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 7c0864e5170d..10f376d3b20d 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94 - * $Id: uipc_syscalls.c,v 1.5 1995/03/16 18:12:46 bde Exp $ + * $Id: uipc_syscalls.c,v 1.6 1995/05/30 08:06:24 rgrimes Exp $ */ #include <sys/param.h> @@ -145,20 +145,44 @@ struct accept_args { int s; caddr_t name; int *anamelen; -#ifdef COMPAT_OLDSOCK - int compat_43; /* pseudo */ -#endif }; -#ifndef COMPAT_OLDSOCK -# define accept1 accept -#endif /* COMPAT_OLDSOCK*/ + +#ifdef COMPAT_OLDSOCK +static int accept1(struct proc *, struct accept_args *, int [], int); + +int +oaccept(p, uap, retval) + struct proc *p; + struct accept_args *uap; + int *retval; +{ + return (accept1(p, uap, retval, 1)); +} + int -accept1(p, uap, retval) +accept(p, uap, retval) + struct proc *p; + struct accept_args *uap; + int *retval; +{ + return (accept1(p, uap, retval, 0)); +} + +static int +accept1(p, uap, retval, compat) + struct proc *p; + register struct accept_args *uap; + int *retval; + int compat; +#else /* COMPAT_OLDSOCK */ +int +accept(p, uap, retval) struct proc *p; register struct accept_args *uap; int *retval; +#endif /* COMPAT_OLDSOCK*/ { struct file *fp; struct mbuf *nam; @@ -220,7 +244,7 @@ accept1(p, uap, retval) (void) soaccept(so, nam); if (uap->name) { #ifdef COMPAT_OLDSOCK - if (uap->compat_43) + if (compat) mtod(nam, struct osockaddr *)->sa_family = mtod(nam, struct sockaddr *)->sa_family; #endif @@ -238,29 +262,6 @@ accept1(p, uap, retval) return (error); } -#ifdef COMPAT_OLDSOCK -int -accept(p, uap, retval) - struct proc *p; - struct accept_args *uap; - int *retval; -{ - - uap->compat_43 = 0; - return (accept1(p, uap, retval)); -} - -int -oaccept(p, uap, retval) - struct proc *p; - struct accept_args *uap; - int *retval; -{ - - uap->compat_43 = 1; - return (accept1(p, uap, retval)); -} -#endif /* COMPAT_OLDSOCK */ struct connect_args { int s; @@ -623,15 +624,6 @@ done: return (error); } -struct recvfrom_args { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t from; - int *fromlenaddr; -}; - int recvit(p, s, mp, namelenp, retsize) register struct proc *p; @@ -764,9 +756,14 @@ out: return (error); } -struct shutdown_args { + +struct recvfrom_args { int s; - int how; + caddr_t buf; + size_t len; + int flags; + caddr_t from; + int *fromlenaddr; }; int @@ -887,6 +884,7 @@ done: } #endif + struct recvmsg_args { int s; struct msghdr *msg; @@ -934,6 +932,13 @@ done: FREE(iov, M_IOV); return (error); } + + +struct shutdown_args { + int s; + int how; +}; + /* ARGSUSED */ int shutdown(p, uap, retval) @@ -1087,25 +1092,48 @@ free1: /* * Get socket name. */ + struct getsockname_args { int fdes; caddr_t asa; int *alen; -#ifdef COMPAT_OLDSOCK - int compat_43; /* pseudo */ -#endif }; -#ifndef COMPAT_OLDSOCK -#define getsockname1 getsockname -#endif +#ifdef COMPAT_OLDSOCK +static int getsockname1(struct proc *, struct getsockname_args *, int [], int); +int +ogetsockname(p, uap, retval) + struct proc *p; + struct getsockname_args *uap; + int *retval; +{ + return (getsockname1(p, uap, retval, 1)); +} + +int +getsockname(p, uap, retval) + struct proc *p; + struct getsockname_args *uap; + int *retval; +{ + return (getsockname1(p, uap, retval, 0)); +} + +static int +getsockname1(p, uap, retval, compat) + struct proc *p; + register struct getsockname_args *uap; + int *retval; + int compat; +#else /* COMPAT_OLDSOCK */ /* ARGSUSED */ int getsockname1(p, uap, retval) struct proc *p; register struct getsockname_args *uap; int *retval; +#endif /* COMPAT_OLDSOCK */ { struct file *fp; register struct socket *so; @@ -1128,7 +1156,7 @@ getsockname1(p, uap, retval) if (len > m->m_len) len = m->m_len; #ifdef COMPAT_OLDSOCK - if (uap->compat_43) + if (compat) mtod(m, struct osockaddr *)->sa_family = mtod(m, struct sockaddr *)->sa_family; #endif @@ -1141,53 +1169,50 @@ bad: return (error); } +/* + * Get name of peer for connected socket. + */ +struct getpeername_args { + int fdes; + caddr_t asa; + int *alen; +}; + #ifdef COMPAT_OLDSOCK +static int getpeername1(struct proc *, struct getpeername_args *, int [], int); + int -getsockname(p, uap, retval) +ogetpeername(p, uap, retval) struct proc *p; - struct getsockname_args *uap; + struct getpeername_args *uap; int *retval; { - - uap->compat_43 = 0; - return (getsockname1(p, uap, retval)); + return (getpeername1(p, uap, retval, 1)); } int -ogetsockname(p, uap, retval) +getpeername(p, uap, retval) struct proc *p; - struct getsockname_args *uap; + struct getpeername_args *uap; int *retval; { - - uap->compat_43 = 1; - return (getsockname1(p, uap, retval)); + return (getpeername1(p, uap, retval, 0)); } -#endif /* COMPAT_OLDSOCK */ - -/* - * Get name of peer for connected socket. - */ -struct getpeername_args { - int fdes; - caddr_t asa; - int *alen; -#ifdef COMPAT_OLDSOCK - int compat_43; /* pseudo */ -#endif -}; - - -#ifndef COMPAT_OLDSOCK -#define getpeername1 getpeername -#endif +static int +getpeername1(p, uap, retval, compat) + struct proc *p; + register struct getpeername_args *uap; + int *retval; + int compat; +#else /* COMPAT_OLDSOCK */ /* ARGSUSED */ int getpeername1(p, uap, retval) struct proc *p; register struct getpeername_args *uap; int *retval; +#endif /* COMPAT_OLDSOCK */ { struct file *fp; register struct socket *so; @@ -1212,7 +1237,7 @@ getpeername1(p, uap, retval) if (len > m->m_len) len = m->m_len; #ifdef COMPAT_OLDSOCK - if (uap->compat_43) + if (compat) mtod(m, struct osockaddr *)->sa_family = mtod(m, struct sockaddr *)->sa_family; #endif @@ -1225,30 +1250,8 @@ bad: return (error); } -#ifdef COMPAT_OLDSOCK -int -getpeername(p, uap, retval) - struct proc *p; - struct getpeername_args *uap; - int *retval; -{ - - uap->compat_43 = 0; - return (getpeername1(p, uap, retval)); -} int -ogetpeername(p, uap, retval) - struct proc *p; - struct getpeername_args *uap; - int *retval; -{ - - uap->compat_43 = 1; - return (getpeername1(p, uap, retval)); -} -#endif /* COMPAT_OLDSOCK */ -int sockargs(mp, buf, buflen, type) struct mbuf **mp; caddr_t buf; |