1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-06 09:17:25 +00:00

Simplify the pseudo-argument removal changes by not optimizing for

the !COMPAT_43 case - use a common function even when there is no
`old' function.  The diffs for this are large because of code motion
to restore the function order to what it was before the pseudo-argument
changes.

Include <sys/sysproto.h> to get correct args structs and prototypes.
The diffs for this are large because the declarations of the args structs
were moved to become comments in the function headers.  The comments may
actually match the automatically generated declarations right now.

Add prototypes.
This commit is contained in:
Bruce Evans 1995-10-23 15:42:12 +00:00
parent 357ab62b03
commit 5fdb832498
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11724
2 changed files with 208 additions and 255 deletions

View File

@ -36,11 +36,12 @@
* SUCH DAMAGE.
*
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
* $Id: kern_exit.c,v 1.15 1995/05/30 08:05:25 rgrimes Exp $
* $Id: kern_exit.c,v 1.17 1995/10/08 00:06:03 swallace Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/sysent.h>
#include <sys/ioctl.h>
#include <sys/proc.h>
@ -69,17 +70,18 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
static int wait1 __P((struct proc *, struct wait_args *, int [], int));
/*
* exit --
* Death of process.
*/
struct rexit_args {
int rval;
};
__dead void
exit(p, uap, retval)
struct proc *p;
struct rexit_args *uap;
struct rexit_args /* {
int rval;
} */ *uap;
int *retval;
{
@ -281,13 +283,6 @@ exit1(p, rv)
cpu_exit(p);
}
struct wait_args {
int pid;
int *status;
int options;
struct rusage *rusage;
};
#if defined(COMPAT_43) || defined(COMPAT_IBCS2)
#if defined(hp300) || defined(luna68k)
#include <machine/frame.h>
@ -296,16 +291,12 @@ struct wait_args {
#define GETPS(rp) (rp)[PS]
#endif
static int wait1(struct proc *, struct wait_args *, int [], int);
struct owait_args {
int dummy;
};
int
owait(p, uap, retval)
struct proc *p;
register struct owait_args *uap;
register struct owait_args /* {
int dummy;
} */ *uap;
int *retval;
{
struct wait_args w;
@ -326,6 +317,7 @@ owait(p, uap, retval)
w.status = NULL;
return (wait1(p, &w, retval, 1));
}
#endif /* defined(COMPAT_43) || defined(COMPAT_IBCS2) */
int
wait4(p, uap, retval)
@ -333,23 +325,21 @@ wait4(p, uap, retval)
struct wait_args *uap;
int *retval;
{
return (wait1(p, uap, retval, 0));
}
static int
wait1(q, uap, retval, compat)
register struct proc *q;
register struct wait_args *uap;
register struct wait_args /* {
int pid;
int *status;
int options;
struct rusage *rusage;
} */ *uap;
int retval[];
int compat;
#else
int
wait4(q, uap, retval)
register struct proc *q;
register struct wait_args *uap;
int retval[];
#endif
{
register int nfound;
register struct proc *p, *t;

View File

@ -31,11 +31,12 @@
* SUCH DAMAGE.
*
* @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
* $Id: uipc_syscalls.c,v 1.6 1995/05/30 08:06:24 rgrimes Exp $
* $Id: uipc_syscalls.c,v 1.8 1995/10/11 06:09:45 swallace Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/filedesc.h>
#include <sys/proc.h>
#include <sys/file.h>
@ -52,6 +53,18 @@
#include <sys/ktrace.h>
#endif
extern int sendit __P((struct proc *p, int s, struct msghdr *mp, int flags,
int *retsize));
extern int recvit __P((struct proc *p, int s, struct msghdr *mp,
caddr_t namelenp, int *retsize));
static int accept1 __P((struct proc *p, struct accept_args *uap, int *retval,
int compat));
static int getsockname1 __P((struct proc *p, struct getsockname_args *uap,
int *retval, int compat));
static int getpeername1 __P((struct proc *p, struct getpeername_args *uap,
int *retval, int compat));
/*
* System call interface to the socket abstraction.
*/
@ -61,15 +74,14 @@
extern struct fileops socketops;
struct socket_args {
int domain;
int type;
int protocol;
};
int
socket(p, uap, retval)
struct proc *p;
register struct socket_args *uap;
register struct socket_args /* {
int domain;
int type;
int protocol;
} */ *uap;
int *retval;
{
struct filedesc *fdp = p->p_fd;
@ -94,16 +106,15 @@ socket(p, uap, retval)
return (error);
}
struct bind_args {
int s;
caddr_t name;
int namelen;
};
/* ARGSUSED */
int
bind(p, uap, retval)
struct proc *p;
register struct bind_args *uap;
register struct bind_args /* {
int s;
caddr_t name;
int namelen;
} */ *uap;
int *retval;
{
struct file *fp;
@ -121,15 +132,14 @@ bind(p, uap, retval)
return (error);
}
struct listen_args {
int s;
int backlog;
};
/* ARGSUSED */
int
listen(p, uap, retval)
struct proc *p;
register struct listen_args *uap;
register struct listen_args /* {
int s;
int backlog;
} */ *uap;
int *retval;
{
struct file *fp;
@ -141,48 +151,16 @@ listen(p, uap, retval)
return (solisten((struct socket *)fp->f_data, uap->backlog));
}
struct accept_args {
int s;
caddr_t name;
int *anamelen;
};
#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
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;
register struct accept_args /* {
int s;
caddr_t name;
int *anamelen;
} */ *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;
@ -262,17 +240,37 @@ accept(p, uap, retval)
return (error);
}
int
accept(p, uap, retval)
struct proc *p;
struct accept_args *uap;
int *retval;
{
return (accept1(p, uap, retval, 0));
}
#ifdef COMPAT_OLDSOCK
int
oaccept(p, uap, retval)
struct proc *p;
struct accept_args *uap;
int *retval;
{
return (accept1(p, uap, retval, 1));
}
#endif /* COMPAT_OLDSOCK */
struct connect_args {
int s;
caddr_t name;
int namelen;
};
/* ARGSUSED */
int
connect(p, uap, retval)
struct proc *p;
register struct connect_args *uap;
register struct connect_args /* {
int s;
caddr_t name;
int namelen;
} */ *uap;
int *retval;
{
struct file *fp;
@ -316,16 +314,15 @@ connect(p, uap, retval)
return (error);
}
struct socketpair_args {
int domain;
int type;
int protocol;
int *rsv;
};
int
socketpair(p, uap, retval)
struct proc *p;
register struct socketpair_args *uap;
register struct socketpair_args /* {
int domain;
int type;
int protocol;
int *rsv;
} */ *uap;
int retval[];
{
register struct filedesc *fdp = p->p_fd;
@ -486,18 +483,17 @@ sendit(p, s, mp, flags, retsize)
return (error);
}
struct sendto_args {
int s;
caddr_t buf;
size_t len;
int flags;
caddr_t to;
int tolen;
};
int
sendto(p, uap, retval)
struct proc *p;
register struct sendto_args *uap;
register struct sendto_args /* {
int s;
caddr_t buf;
size_t len;
int flags;
caddr_t to;
int tolen;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -517,16 +513,15 @@ sendto(p, uap, retval)
}
#ifdef COMPAT_OLDSOCK
struct osend_args {
int s;
caddr_t buf;
int len;
int flags;
};
int
osend(p, uap, retval)
struct proc *p;
register struct osend_args *uap;
register struct osend_args /* {
int s;
caddr_t buf;
int len;
int flags;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -543,15 +538,14 @@ osend(p, uap, retval)
return (sendit(p, uap->s, &msg, uap->flags, retval));
}
struct osendmsg_args {
int s;
caddr_t msg;
int flags;
};
int
osendmsg(p, uap, retval)
struct proc *p;
register struct osendmsg_args *uap;
register struct osendmsg_args /* {
int s;
caddr_t msg;
int flags;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -583,15 +577,14 @@ osendmsg(p, uap, retval)
}
#endif
struct sendmsg_args {
int s;
caddr_t msg;
int flags;
};
int
sendmsg(p, uap, retval)
struct proc *p;
register struct sendmsg_args *uap;
register struct sendmsg_args /* {
int s;
caddr_t msg;
int flags;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -756,20 +749,17 @@ recvit(p, s, mp, namelenp, retsize)
return (error);
}
struct recvfrom_args {
int s;
caddr_t buf;
size_t len;
int flags;
caddr_t from;
int *fromlenaddr;
};
int
recvfrom(p, uap, retval)
struct proc *p;
register struct recvfrom_args *uap;
register struct recvfrom_args /* {
int s;
caddr_t buf;
size_t len;
int flags;
caddr_t from;
int *fromlenaddr;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -808,16 +798,15 @@ orecvfrom(p, uap, retval)
#ifdef COMPAT_OLDSOCK
struct orecv_args {
int s;
caddr_t buf;
int len;
int flags;
};
int
orecv(p, uap, retval)
struct proc *p;
register struct orecv_args *uap;
register struct orecv_args /* {
int s;
caddr_t buf;
int len;
int flags;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -839,15 +828,14 @@ orecv(p, uap, retval)
* overlays the new one, missing only the flags, and with the (old) access
* rights where the control fields are now.
*/
struct orecvmsg_args {
int s;
struct omsghdr *msg;
int flags;
};
int
orecvmsg(p, uap, retval)
struct proc *p;
register struct orecvmsg_args *uap;
register struct orecvmsg_args /* {
int s;
struct omsghdr *msg;
int flags;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -884,16 +872,14 @@ orecvmsg(p, uap, retval)
}
#endif
struct recvmsg_args {
int s;
struct msghdr *msg;
int flags;
};
int
recvmsg(p, uap, retval)
struct proc *p;
register struct recvmsg_args *uap;
register struct recvmsg_args /* {
int s;
struct msghdr *msg;
int flags;
} */ *uap;
int *retval;
{
struct msghdr msg;
@ -933,17 +919,14 @@ recvmsg(p, uap, retval)
return (error);
}
struct shutdown_args {
int s;
int how;
};
/* ARGSUSED */
int
shutdown(p, uap, retval)
struct proc *p;
register struct shutdown_args *uap;
register struct shutdown_args /* {
int s;
int how;
} */ *uap;
int *retval;
{
struct file *fp;
@ -955,18 +938,17 @@ shutdown(p, uap, retval)
return (soshutdown((struct socket *)fp->f_data, uap->how));
}
struct setsockopt_args {
int s;
int level;
int name;
caddr_t val;
int valsize;
};
/* ARGSUSED */
int
setsockopt(p, uap, retval)
struct proc *p;
register struct setsockopt_args *uap;
register struct setsockopt_args /* {
int s;
int level;
int name;
caddr_t val;
int valsize;
} */ *uap;
int *retval;
{
struct file *fp;
@ -993,18 +975,17 @@ setsockopt(p, uap, retval)
uap->name, m));
}
struct getsockopt_args {
int s;
int level;
int name;
caddr_t val;
int *avalsize;
};
/* ARGSUSED */
int
getsockopt(p, uap, retval)
struct proc *p;
register struct getsockopt_args *uap;
register struct getsockopt_args /* {
int s;
int level;
int name;
caddr_t val;
int *avalsize;
} */ *uap;
int *retval;
{
struct file *fp;
@ -1035,14 +1016,13 @@ getsockopt(p, uap, retval)
return (error);
}
struct pipe_args {
int dummy;
};
/* ARGSUSED */
int
pipe(p, uap, retval)
struct proc *p;
struct pipe_args *uap;
struct pipe_args /* {
int dummy;
} */ *uap;
int retval[];
{
register struct filedesc *fdp = p->p_fd;
@ -1092,48 +1072,17 @@ pipe(p, uap, retval)
/*
* Get socket name.
*/
struct getsockname_args {
int fdes;
caddr_t asa;
int *alen;
};
#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));
}
/* ARGSUSED */
static int
getsockname1(p, uap, retval, compat)
struct proc *p;
register struct getsockname_args *uap;
register struct getsockname_args /* {
int fdes;
caddr_t asa;
int *alen;
} */ *uap;
int *retval;
int compat;
#else /* COMPAT_OLDSOCK */
/* ARGSUSED */
int
getsockname(p, uap, retval)
struct proc *p;
register struct getsockname_args *uap;
int *retval;
#endif /* COMPAT_OLDSOCK */
{
struct file *fp;
register struct socket *so;
@ -1169,50 +1118,42 @@ getsockname(p, uap, retval)
return (error);
}
int
getsockname(p, uap, retval)
struct proc *p;
struct getsockname_args *uap;
int *retval;
{
return (getsockname1(p, uap, retval, 0));
}
#ifdef COMPAT_OLDSOCK
int
ogetsockname(p, uap, retval)
struct proc *p;
struct getsockname_args *uap;
int *retval;
{
return (getsockname1(p, uap, retval, 1));
}
#endif /* COMPAT_OLDSOCK */
/*
* 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
ogetpeername(p, uap, retval)
struct proc *p;
struct getpeername_args *uap;
int *retval;
{
return (getpeername1(p, uap, retval, 1));
}
int
getpeername(p, uap, retval)
struct proc *p;
struct getpeername_args *uap;
int *retval;
{
return (getpeername1(p, uap, retval, 0));
}
/* ARGSUSED */
static int
getpeername1(p, uap, retval, compat)
struct proc *p;
register struct getpeername_args *uap;
register struct getpeername_args /* {
int fdes;
caddr_t asa;
int *alen;
} */ *uap;
int *retval;
int compat;
#else /* COMPAT_OLDSOCK */
/* ARGSUSED */
int
getpeername(p, uap, retval)
struct proc *p;
register struct getpeername_args *uap;
int *retval;
#endif /* COMPAT_OLDSOCK */
{
struct file *fp;
register struct socket *so;
@ -1250,6 +1191,28 @@ getpeername(p, uap, retval)
return (error);
}
int
getpeername(p, uap, retval)
struct proc *p;
struct getpeername_args *uap;
int *retval;
{
return (getpeername1(p, uap, retval, 0));
}
#ifdef COMPAT_OLDSOCK
int
ogetpeername(p, uap, retval)
struct proc *p;
struct ogetpeername_args *uap;
int *retval;
{
/* XXX uap should have type `getpeername_args *' to begin with. */
return (getpeername1(p, (struct getpeername_args *)uap, retval, 1));
}
#endif /* COMPAT_OLDSOCK */
int
sockargs(mp, buf, buflen, type)