diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/common/Makefile | 13 | ||||
-rw-r--r-- | sys/compat/common/Makefile.inc | 35 | ||||
-rw-r--r-- | sys/compat/common/kern_info_09.c | 11 | ||||
-rw-r--r-- | sys/compat/common/kern_info_43.c | 13 | ||||
-rw-r--r-- | sys/compat/common/tty_43.c (renamed from sys/compat/common/compat_tty.c) | 313 | ||||
-rw-r--r-- | sys/compat/common/uipc_syscalls_43.c | 11 | ||||
-rw-r--r-- | sys/compat/common/vm_43.c | 139 |
7 files changed, 348 insertions, 187 deletions
diff --git a/sys/compat/common/Makefile b/sys/compat/common/Makefile index c8565ae9429..dc438e880ff 100644 --- a/sys/compat/common/Makefile +++ b/sys/compat/common/Makefile @@ -1,16 +1,16 @@ -# $NetBSD: Makefile,v 1.4 1995/10/20 00:34:15 cgd Exp $ +# $OpenBSD: Makefile,v 1.3 1996/02/26 23:26:48 niklas Exp $ +# $NetBSD: Makefile,v 1.7 1996/02/05 01:58:28 christos Exp $ LIB= compat NOPIC= -.PATH: ${COMPATREL}${COMPATDIR} +CPPFLAGS= ${COMPATCPPFLAGS:S@-I.@-I${COMPATREL}.@g} -CC= ${COMPATCC} -CFLAGS= ${COMPATCFLAGS:S@-I.@-I${COMPATREL}.@g} +.PATH: ${COMPATREL}${COMPATDIR} -SRCS= compat_tty.c compat_util.c kern_exit_43.c kern_info_09.c \ +SRCS= compat_util.c kern_exit_43.c kern_info_09.c \ kern_info_43.c kern_prot_43.c kern_resource_43.c kern_sig_43.c \ - uipc_syscalls_43.c vfs_syscalls_43.c + tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c # really, all machines were sizeof(int) != sizeof(long) .if (${MACHINE_ARCH} != "alpha") @@ -19,5 +19,4 @@ SRCS+= kern_ipc_10.c install: - .include <bsd.lib.mk> diff --git a/sys/compat/common/Makefile.inc b/sys/compat/common/Makefile.inc index db613f2cb81..4e5a5f9b4c4 100644 --- a/sys/compat/common/Makefile.inc +++ b/sys/compat/common/Makefile.inc @@ -1,37 +1,34 @@ -# $NetBSD: Makefile.inc,v 1.2 1995/06/26 03:27:15 christos Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1996/02/26 23:26:49 niklas Exp $ +# $NetBSD: Makefile.inc,v 1.3 1996/02/02 20:34:44 mycroft Exp $ # # NOTE: $S must correspond to the top of the 'sys' tree COMPATDIR= $S/compat/common -COMPATDST?= lib/compat -COMPATREL?= ../../ +COMPATDST?= lib/compat +COMPATREL?= ../../ COMPATLIB= ${COMPATDST}/libcompat.a COMPATLIB_PROF= ${COMPATDST}/libcompat_p.a +COMPATMAKE= \ + cd ${COMPATDST} && ${MAKE} -f ${COMPATREL}${COMPATDIR}/Makefile \ + CC="${CC}" CFLAGS="${CFLAGS}" \ + LD="${LD}" \ + COMPATCPPFLAGS="${CPPFLAGS}" \ + COMPATREL="${COMPATREL}" \ + COMPATDIR="${COMPATDIR}" + ${COMPATLIB}: .NOTMAIN __always_make_compatlib @echo making sure the compat library is up to date... - @(cd ${COMPATDST} && ${MAKE} -f ${COMPATREL}${COMPATDIR}/Makefile \ - COMPATCC="${CC}" \ - COMPATCFLAGS="${CFLAGS}" \ - COMPATREL="${COMPATREL}" \ - COMPATDIR="${COMPATDIR}" libcompat.a) + @${COMPATMAKE} libcompat.a ${COMPATLIB_PROF}: .NOTMAIN __always_make_compatlib @echo making sure the profiled compat library is up to date... - @(cd ${COMPATDST} && ${MAKE} -f ${COMPATREL}${COMPATDIR}/Makefile \ - COMPATCC="${CC}" \ - COMPATCFLAGS="${CFLAGS}" \ - COMPATREL="${COMPATREL}" \ - COMPATDIR="${COMPATDIR}" libcompat_p.a) + @${COMPATMAKE} libcompat_p.a clean:: .NOTMAIN __always_make_compatlib @echo cleaning the compat library objects - @(cd ${COMPATDST} && ${MAKE} -f ${COMPATREL}${COMPATDIR}/Makefile \ - COMPATCC="${CC}" \ - COMPATCFLAGS="${CFLAGS}" \ - COMPATREL="${COMPATREL}" \ - COMPATDIR="${COMPATDIR}" clean) + @${COMPATMAKE} clean __always_make_compatlib: .NOTMAIN - @([ -d ${COMPATDST} ] || mkdir -p ${COMPATDST}) + @mkdir -p ${COMPATDST} diff --git a/sys/compat/common/kern_info_09.c b/sys/compat/common/kern_info_09.c index 0d04cae2475..b9188999a44 100644 --- a/sys/compat/common/kern_info_09.c +++ b/sys/compat/common/kern_info_09.c @@ -1,4 +1,5 @@ -/* $NetBSD: kern_info_09.c,v 1.3 1995/10/07 06:26:23 mycroft Exp $ */ +/* $OpenBSD: kern_info_09.c,v 1.2 1996/02/26 23:26:51 niklas Exp $ */ +/* $NetBSD: kern_info_09.c,v 1.4 1996/02/04 02:02:14 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991, 1993 @@ -63,7 +64,7 @@ compat_09_sys_getdomainname(p, v, retval) name = KERN_DOMAINNAME; return (kern_sysctl(&name, 1, SCARG(uap, domainname), - &SCARG(uap, len), 0, 0)); + &SCARG(uap, len), 0, 0, p)); } @@ -81,11 +82,11 @@ compat_09_sys_setdomainname(p, v, retval) int name; int error; - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); name = KERN_DOMAINNAME; return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, domainname), - SCARG(uap, len))); + SCARG(uap, len), p)); } struct outsname { @@ -126,5 +127,5 @@ compat_09_sys_uname(p, v, retval) *dp = '\0'; strncpy(outsname.machine, MACHINE, sizeof(outsname.machine)); return (copyout((caddr_t)&outsname, (caddr_t)SCARG(uap, name), - sizeof(struct outsname))); + sizeof(struct outsname))); } diff --git a/sys/compat/common/kern_info_43.c b/sys/compat/common/kern_info_43.c index 1d1dd55314b..9e98382ccfe 100644 --- a/sys/compat/common/kern_info_43.c +++ b/sys/compat/common/kern_info_43.c @@ -1,6 +1,7 @@ -/* $Id: kern_info_43.c,v 1.3 1996/02/02 23:25:15 etheisen Exp $ */ +/* $Id: kern_info_43.c,v 1.4 1996/02/26 23:26:52 niklas Exp $ */ -/* $NetBSD: kern_info_43.c,v 1.3 1995/10/07 06:26:24 mycroft Exp $ */ +/* $OpenBSD: kern_info_43.c,v 1.4 1996/02/26 23:26:52 niklas Exp $ */ +/* $NetBSD: kern_info_43.c,v 1.4 1996/02/04 02:02:22 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991, 1993 @@ -99,7 +100,7 @@ compat_43_sys_gethostname(p, v, retval) name = KERN_HOSTNAME; return (kern_sysctl(&name, 1, SCARG(uap, hostname), &SCARG(uap, len), - 0, 0)); + 0, 0, p)); } #define KINFO_PROC (0<<8) @@ -314,7 +315,7 @@ compat_43_sys_sethostid(p, v, retval) } */ *uap = v; int error; - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); hostid = SCARG(uap, hostid); return (0); @@ -332,9 +333,9 @@ compat_43_sys_sethostname(p, v, retval) int name; int error; - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); name = KERN_HOSTNAME; return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname), - SCARG(uap, len))); + SCARG(uap, len), p)); } diff --git a/sys/compat/common/compat_tty.c b/sys/compat/common/tty_43.c index 485c21379f4..80069861d7b 100644 --- a/sys/compat/common/compat_tty.c +++ b/sys/compat/common/tty_43.c @@ -1,4 +1,5 @@ -/* $NetBSD: compat_tty.c,v 1.1 1995/06/24 20:16:01 christos Exp $ */ +/* $OpenBSD: tty_43.c,v 1.1 1996/02/26 23:26:53 niklas Exp $ */ +/* $NetBSD: tty_43.c,v 1.2 1996/02/10 00:12:44 christos Exp $ */ /*- * Copyright (c) 1982, 1986, 1991, 1993 @@ -35,7 +36,7 @@ * @(#)tty_compat.c 8.1 (Berkeley) 6/10/93 */ -/* +/* * mapping routines for old line discipline (yuck) */ #include <sys/param.h> @@ -74,11 +75,16 @@ static struct speedtab compatspeeds[] = { { 0, 0 }, { -1, -1 }, }; -static int compatspcodes[] = { +static int compatspcodes[] = { 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200 }; +/* Macros to clear/set/test flags. */ +#define SET(t, f) (t) |= (f) +#define CLR(t, f) (t) &= ~(f) +#define ISSET(t, f) ((t) & (f)) + /*ARGSUSED*/ ttcompat(tp, com, data, flag, p) register struct tty *tp; @@ -92,7 +98,7 @@ ttcompat(tp, com, data, flag, p) case TIOCGETP: { register struct sgttyb *sg = (struct sgttyb *)data; register u_char *cc = tp->t_cc; - register speed; + register int speed; speed = ttspeedtab(tp->t_ospeed, compatspeeds); sg->sg_ospeed = (speed == -1) ? MAX_SPEED : speed; @@ -127,7 +133,7 @@ ttcompat(tp, com, data, flag, p) term.c_cc[VKILL] = sg->sg_kill; tp->t_flags = (ttcompatgetflags(tp)&0xffff0000) | (sg->sg_flags&0xffff); ttcompatsetflags(tp, &term); - return (ttioctl(tp, com == TIOCSETP ? TIOCSETAF : TIOCSETA, + return (ttioctl(tp, com == TIOCSETP ? TIOCSETAF : TIOCSETA, (caddr_t)&term, flag, p)); } @@ -185,7 +191,7 @@ ttcompat(tp, com, data, flag, p) case TIOCLBIC: case TIOCLSET: { struct termios term; - long flags; + int flags; term = tp->t_termios; flags = ttcompatgetflags(tp); @@ -216,7 +222,7 @@ ttcompat(tp, com, data, flag, p) case OTIOCSETD: { int ldisczero = 0; - return (ttioctl(tp, TIOCSETD, + return (ttioctl(tp, TIOCSETD, *(int *)data == 2 ? (caddr_t)&ldisczero : data, flag, p)); } @@ -226,7 +232,7 @@ ttcompat(tp, com, data, flag, p) return (ttioctl(tp, TIOCCONS, data, flag, p)); case TIOCHPCL: - tp->t_cflag |= HUPCL; + SET(tp->t_cflag, HUPCL); break; case TIOCGSID: @@ -245,58 +251,65 @@ ttcompat(tp, com, data, flag, p) return (0); } +int ttcompatgetflags(tp) register struct tty *tp; { - register long iflag = tp->t_iflag; - register long lflag = tp->t_lflag; - register long oflag = tp->t_oflag; - register long cflag = tp->t_cflag; - register flags = 0; - - if (iflag & IXOFF) - flags |= TANDEM; - if (iflag & ICRNL || oflag & ONLCR) - flags |= CRMOD; - if (cflag & PARENB) { - if (iflag & INPCK) { - if (cflag & PARODD) - flags |= ODDP; + register tcflag_t iflag = tp->t_iflag; + register tcflag_t lflag = tp->t_lflag; + register tcflag_t oflag = tp->t_oflag; + register tcflag_t cflag = tp->t_cflag; + register int flags = 0; + + if (ISSET(iflag, IXOFF)) + SET(flags, TANDEM); + if (ISSET(iflag, ICRNL) || ISSET(oflag, ONLCR)) + SET(flags, CRMOD); + if (ISSET(cflag, PARENB)) { + if (ISSET(iflag, INPCK)) { + if (ISSET(cflag, PARODD)) + SET(flags, ODDP); else - flags |= EVENP; + SET(flags, EVENP); } else - flags |= EVENP | ODDP; - } else { - if ((tp->t_flags & LITOUT) && !(oflag & OPOST)) - flags |= LITOUT; - if (tp->t_flags & PASS8) - flags |= PASS8; + SET(flags, ANYP); } - - if ((lflag & ICANON) == 0) { + + if (!ISSET(lflag, ICANON)) { /* fudge */ - if (iflag&IXON || lflag&ISIG || lflag&IEXTEN || cflag&PARENB) - flags |= CBREAK; + if (ISSET(iflag, IXON) || ISSET(lflag, ISIG|IEXTEN) || + ISSET(cflag, PARENB)) + SET(flags, CBREAK); else - flags |= RAW; + SET(flags, RAW); + } + + if (ISSET(flags, RAW)) + SET(flags, ISSET(tp->t_flags, LITOUT|PASS8)); + else if (ISSET(cflag, CSIZE) == CS8) { + if (!ISSET(oflag, OPOST)) + SET(flags, LITOUT); + if (!ISSET(iflag, ISTRIP)) + SET(flags, PASS8); } - if (cflag & MDMBUF) - flags |= MDMBUF; - if ((cflag & HUPCL) == 0) - flags |= NOHANG; - if (oflag & OXTABS) - flags |= XTABS; - if (lflag & ECHOE) - flags |= CRTERA|CRTBS; - if (lflag & ECHOKE) - flags |= CRTKIL|CRTBS; - if (lflag & ECHOPRT) - flags |= PRTERA; - if (lflag & ECHOCTL) - flags |= CTLECH; - if ((iflag & IXANY) == 0) - flags |= DECCTQ; - flags |= lflag & (ECHO|TOSTOP|FLUSHO|PENDIN|NOFLSH); + + if (ISSET(cflag, MDMBUF)) + SET(flags, MDMBUF); + if (!ISSET(cflag, HUPCL)) + SET(flags, NOHANG); + if (ISSET(oflag, OXTABS)) + SET(flags, XTABS); + if (ISSET(lflag, ECHOE)) + SET(flags, CRTERA|CRTBS); + if (ISSET(lflag, ECHOKE)) + SET(flags, CRTKIL|CRTBS); + if (ISSET(lflag, ECHOPRT)) + SET(flags, PRTERA); + if (ISSET(lflag, ECHOCTL)) + SET(flags, CTLECH); + if (!ISSET(iflag, IXANY)) + SET(flags, DECCTQ); + SET(flags, ISSET(lflag, ECHO|TOSTOP|FLUSHO|PENDIN|NOFLSH)); if (ttydebug) printf("getflags: %x\n", flags); return (flags); @@ -306,75 +319,81 @@ ttcompatsetflags(tp, t) register struct tty *tp; register struct termios *t; { - register flags = tp->t_flags; - register long iflag = t->c_iflag; - register long oflag = t->c_oflag; - register long lflag = t->c_lflag; - register long cflag = t->c_cflag; - - if (flags & TANDEM) - iflag |= IXOFF; + register int flags = tp->t_flags; + register tcflag_t iflag = t->c_iflag; + register tcflag_t oflag = t->c_oflag; + register tcflag_t lflag = t->c_lflag; + register tcflag_t cflag = t->c_cflag; + + if (ISSET(flags, TANDEM)) + SET(iflag, IXOFF); else - iflag &= ~IXOFF; - if (flags & ECHO) - lflag |= ECHO; + CLR(iflag, IXOFF); + if (ISSET(flags, ECHO)) + SET(lflag, ECHO); else - lflag &= ~ECHO; - if (flags & CRMOD) { - iflag |= ICRNL; - oflag |= ONLCR; + CLR(lflag, ECHO); + if (ISSET(flags, CRMOD)) { + SET(iflag, ICRNL); + SET(oflag, ONLCR); } else { - iflag &= ~ICRNL; - oflag &= ~ONLCR; + CLR(iflag, ICRNL); + CLR(oflag, ONLCR); } - if (flags & XTABS) - oflag |= OXTABS; + if (ISSET(flags, XTABS)) + SET(oflag, OXTABS); else - oflag &= ~OXTABS; + CLR(oflag, OXTABS); - if (flags & RAW) { + if (ISSET(flags, RAW)) { iflag &= IXOFF; - lflag &= ~(ISIG|ICANON|IEXTEN); + CLR(lflag, ISIG|ICANON|IEXTEN); + CLR(cflag, PARENB); } else { - iflag |= BRKINT|IXON|IMAXBEL; - lflag |= ISIG|IEXTEN; - if (flags & CBREAK) - lflag &= ~ICANON; + SET(iflag, BRKINT|IXON|IMAXBEL); + SET(lflag, ISIG|IEXTEN); + if (ISSET(flags, CBREAK)) + CLR(lflag, ICANON); else - lflag |= ICANON; - } - - switch (flags & ANYP) { - case EVENP: - iflag |= INPCK; - cflag &= ~PARODD; - break; - case ODDP: - iflag |= INPCK; - cflag |= PARODD; - break; - default: - iflag &= ~INPCK; - break; + SET(lflag, ICANON); + switch (ISSET(flags, ANYP)) { + case 0: + CLR(cflag, PARENB); + break; + case ANYP: + SET(cflag, PARENB); + CLR(iflag, INPCK); + break; + case EVENP: + SET(cflag, PARENB); + SET(iflag, INPCK); + CLR(cflag, PARODD); + break; + case ODDP: + SET(cflag, PARENB); + SET(iflag, INPCK); + SET(cflag, PARODD); + break; + } } - if (flags & (RAW|LITOUT|PASS8)) { - cflag &= ~(CSIZE|PARENB); - cflag |= CS8; - if ((flags & (RAW|PASS8)) == 0) - iflag |= ISTRIP; + if (ISSET(flags, RAW|LITOUT|PASS8)) { + CLR(cflag, CSIZE); + SET(cflag, CS8); + if (!ISSET(flags, RAW|PASS8)) + SET(iflag, ISTRIP); else - iflag &= ~ISTRIP; - if ((flags & (RAW|LITOUT)) == 0) - oflag |= OPOST; + CLR(iflag, ISTRIP); + if (!ISSET(flags, RAW|LITOUT)) + SET(oflag, OPOST); else - oflag &= ~OPOST; + CLR(oflag, OPOST); } else { - cflag &= ~CSIZE; - cflag |= CS7|PARENB; - iflag |= ISTRIP; - oflag |= OPOST; + CLR(cflag, CSIZE); + SET(cflag, CS7); + SET(iflag, ISTRIP); + SET(oflag, OPOST); } t->c_iflag = iflag; @@ -387,61 +406,61 @@ ttcompatsetlflags(tp, t) register struct tty *tp; register struct termios *t; { - register flags = tp->t_flags; - register long iflag = t->c_iflag; - register long oflag = t->c_oflag; - register long lflag = t->c_lflag; - register long cflag = t->c_cflag; + register int flags = tp->t_flags; + register tcflag_t iflag = t->c_iflag; + register tcflag_t oflag = t->c_oflag; + register tcflag_t lflag = t->c_lflag; + register tcflag_t cflag = t->c_cflag; /* Nothing we can do with CRTBS. */ - if (flags & PRTERA) - lflag |= ECHOPRT; + if (ISSET(flags, PRTERA)) + SET(lflag, ECHOPRT); else - lflag &= ~ECHOPRT; - if (flags & CRTERA) - lflag |= ECHOE; + CLR(lflag, ECHOPRT); + if (ISSET(flags, CRTERA)) + SET(lflag, ECHOE); else - lflag &= ~ECHOE; + CLR(lflag, ECHOE); /* Nothing we can do with TILDE. */ - if (flags & MDMBUF) - cflag |= MDMBUF; + if (ISSET(flags, MDMBUF)) + SET(cflag, MDMBUF); else - cflag &= ~MDMBUF; - if (flags & NOHANG) - cflag &= ~HUPCL; + CLR(cflag, MDMBUF); + if (ISSET(flags, NOHANG)) + CLR(cflag, HUPCL); else - cflag |= HUPCL; - if (flags & CRTKIL) - lflag |= ECHOKE; + SET(cflag, HUPCL); + if (ISSET(flags, CRTKIL)) + SET(lflag, ECHOKE); else - lflag &= ~ECHOKE; - if (flags & CTLECH) - lflag |= ECHOCTL; + CLR(lflag, ECHOKE); + if (ISSET(flags, CTLECH)) + SET(lflag, ECHOCTL); else - lflag &= ~ECHOCTL; - if ((flags & DECCTQ) == 0) - iflag |= IXANY; + CLR(lflag, ECHOCTL); + if (!ISSET(flags, DECCTQ)) + SET(iflag, IXANY); else - iflag &= ~IXANY; - lflag &= ~(TOSTOP|FLUSHO|PENDIN|NOFLSH); - lflag |= flags&(TOSTOP|FLUSHO|PENDIN|NOFLSH); - - if (flags & (RAW|LITOUT|PASS8)) { - cflag &= ~(CSIZE|PARENB); - cflag |= CS8; - if ((flags & (RAW|PASS8)) == 0) - iflag |= ISTRIP; + CLR(iflag, IXANY); + CLR(lflag, TOSTOP|FLUSHO|PENDIN|NOFLSH); + SET(lflag, ISSET(flags, TOSTOP|FLUSHO|PENDIN|NOFLSH)); + + if (ISSET(flags, RAW|LITOUT|PASS8)) { + CLR(cflag, CSIZE); + SET(cflag, CS8); + if (!ISSET(flags, RAW|PASS8)) + SET(iflag, ISTRIP); else - iflag &= ~ISTRIP; - if ((flags & (RAW|LITOUT)) == 0) - oflag |= OPOST; + CLR(iflag, ISTRIP); + if (!ISSET(flags, RAW|LITOUT)) + SET(oflag, OPOST); else - oflag &= ~OPOST; + CLR(oflag, OPOST); } else { - cflag &= ~CSIZE; - cflag |= CS7|PARENB; - iflag |= ISTRIP; - oflag |= OPOST; + CLR(cflag, CSIZE); + SET(cflag, CS7); + SET(iflag, ISTRIP); + SET(oflag, OPOST); } t->c_iflag = iflag; diff --git a/sys/compat/common/uipc_syscalls_43.c b/sys/compat/common/uipc_syscalls_43.c index 941253de46d..e9eaaefe5b1 100644 --- a/sys/compat/common/uipc_syscalls_43.c +++ b/sys/compat/common/uipc_syscalls_43.c @@ -1,4 +1,5 @@ -/* $NetBSD: uipc_syscalls_43.c,v 1.3 1995/10/07 06:26:30 mycroft Exp $ */ +/* $OpenBSD: uipc_syscalls_43.c,v 1.2 1996/02/26 23:26:54 niklas Exp $ */ +/* $NetBSD: uipc_syscalls_43.c,v 1.4 1996/02/10 00:12:46 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1990, 1993 @@ -54,8 +55,6 @@ #include <sys/mount.h> #include <sys/syscallargs.h> -#define MSG_COMPAT 0x8000 /* XXX */ - int compat_43_sys_accept(p, v, retval) struct proc *p; @@ -173,6 +172,7 @@ compat_43_sys_recv(p, v, retval) } +#ifdef MSG_COMPAT int compat_43_sys_recvfrom(p, v, retval) struct proc *p; @@ -191,8 +191,10 @@ compat_43_sys_recvfrom(p, v, retval) SCARG(uap, flags) |= MSG_COMPAT; return (sys_recvfrom(p, uap, retval)); } +#endif +#ifdef MSG_COMPAT /* * Old recvmsg. This code takes advantage of the fact that the old msghdr * overlays the new one, missing only the flags, and with the (old) access @@ -240,6 +242,7 @@ done: FREE(iov, M_IOV); return (error); } +#endif int compat_43_sys_send(p, v, retval) @@ -267,6 +270,7 @@ compat_43_sys_send(p, v, retval) return (sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval)); } +#ifdef MSG_COMPAT int compat_43_sys_sendmsg(p, v, retval) struct proc *p; @@ -304,3 +308,4 @@ done: FREE(iov, M_IOV); return (error); } +#endif diff --git a/sys/compat/common/vm_43.c b/sys/compat/common/vm_43.c new file mode 100644 index 00000000000..11429d8ae59 --- /dev/null +++ b/sys/compat/common/vm_43.c @@ -0,0 +1,139 @@ +/* $OpenBSD: vm_43.c,v 1.1 1996/02/26 23:26:55 niklas Exp $ */ +/* $NetBSD: vm_43.c,v 1.1 1996/02/05 01:58:29 christos Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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. + * + * from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$ + * + * @(#)vm_mmap.c 8.5 (Berkeley) 5/19/94 + */ + +/* + * Mapped file (mmap) interface to VM + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/filedesc.h> +#include <sys/resourcevar.h> +#include <sys/proc.h> +#include <sys/vnode.h> +#include <sys/file.h> +#include <sys/mman.h> +#include <sys/conf.h> + +#include <sys/mount.h> +#include <sys/syscallargs.h> + +#include <miscfs/specfs/specdev.h> + +#include <vm/vm.h> +#include <vm/vm_pager.h> +#include <vm/vm_prot.h> + +/* ARGSUSED */ +int +compat_43_sys_getpagesize(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + + *retval = PAGE_SIZE; + return (0); +} + +int +compat_43_sys_mmap(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_43_sys_mmap_args /* { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + syscallarg(int) prot; + syscallarg(int) flags; + syscallarg(int) fd; + syscallarg(long) pos; + } */ *uap = v; + struct sys_mmap_args /* { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + syscallarg(int) prot; + syscallarg(int) flags; + syscallarg(int) fd; + syscallarg(long) pad; + syscallarg(off_t) pos; + } */ nargs; + static const char cvtbsdprot[8] = { + 0, + PROT_EXEC, + PROT_WRITE, + PROT_EXEC|PROT_WRITE, + PROT_READ, + PROT_EXEC|PROT_READ, + PROT_WRITE|PROT_READ, + PROT_EXEC|PROT_WRITE|PROT_READ, + }; +#define OMAP_ANON 0x0002 +#define OMAP_COPY 0x0020 +#define OMAP_SHARED 0x0010 +#define OMAP_FIXED 0x0100 +#define OMAP_INHERIT 0x0800 + + SCARG(&nargs, addr) = SCARG(uap, addr); + SCARG(&nargs, len) = SCARG(uap, len); + SCARG(&nargs, prot) = cvtbsdprot[SCARG(uap, prot)&0x7]; + SCARG(&nargs, flags) = 0; + if (SCARG(uap, flags) & OMAP_ANON) + SCARG(&nargs, flags) |= MAP_ANON; + if (SCARG(uap, flags) & OMAP_COPY) + SCARG(&nargs, flags) |= MAP_COPY; + if (SCARG(uap, flags) & OMAP_SHARED) + SCARG(&nargs, flags) |= MAP_SHARED; + else + SCARG(&nargs, flags) |= MAP_PRIVATE; + if (SCARG(uap, flags) & OMAP_FIXED) + SCARG(&nargs, flags) |= MAP_FIXED; + if (SCARG(uap, flags) & OMAP_INHERIT) + SCARG(&nargs, flags) |= MAP_INHERIT; + SCARG(&nargs, fd) = SCARG(uap, fd); + SCARG(&nargs, pos) = SCARG(uap, pos); + return (sys_mmap(p, &nargs, retval)); +} |