diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 22:33:19 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 22:33:19 +0000 |
commit | 67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (patch) | |
tree | 967b89f6e07398a22bd8c76d30179b648776542d /sys/compat/ultrix | |
parent | ba95d3c1d69cdb251d15a12ebf70f50b0ea2019b (diff) |
partial sync with netbsd 960418, more to come
Diffstat (limited to 'sys/compat/ultrix')
-rw-r--r-- | sys/compat/ultrix/ultrix_fs.c | 44 | ||||
-rw-r--r-- | sys/compat/ultrix/ultrix_ioctl.c | 44 | ||||
-rw-r--r-- | sys/compat/ultrix/ultrix_misc.c | 96 | ||||
-rw-r--r-- | sys/compat/ultrix/ultrix_pathname.c | 11 |
4 files changed, 138 insertions, 57 deletions
diff --git a/sys/compat/ultrix/ultrix_fs.c b/sys/compat/ultrix/ultrix_fs.c index 7dd43d413c6..69f49c8d803 100644 --- a/sys/compat/ultrix/ultrix_fs.c +++ b/sys/compat/ultrix/ultrix_fs.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ultrix_fs.c,v 1.2 1996/04/18 21:21:49 niklas Exp $ */ -/* $NetBSD: ultrix_fs.c,v 1.3 1996/02/19 15:41:39 pk Exp $ */ +/* $OpenBSD: ultrix_fs.c,v 1.3 1996/04/21 22:18:45 deraadt Exp $ */ +/* $NetBSD: ultrix_fs.c,v 1.4 1996/04/07 17:23:06 jonathan Exp $ */ /* * Copyright (c) 1995 @@ -167,10 +167,13 @@ make_ultrix_mntent(sp, tem) tem->ufsd_fstype = ULTRIX_FSTYPE_ULTRIX; tem->ufsd_gtot = sp->f_files; /* total "gnodes" */ - tem->ufsd_gfree = sp->f_ffree; /* free "gnodes"/ + tem->ufsd_gfree = sp->f_ffree; /* free "gnodes" */ tem->ufsd_btot = sp->f_blocks; /* total 1k blocks */ - /*tem->ufsd_bfree = sp->f_bfree; /* free 1k blocks */ - /*tem->ufsd_bfree = sp->f_bavail; /* free 1k blocks */ +#ifdef needsmorethought /* XXX */ + /* tem->ufsd_bfree = sp->f_bfree; */ /* free 1k blocks */ + /* tem->ufsd_bfree = sp->f_bavail; */ /* free 1k blocks */ +#endif + tem->ufsd_bfreen = sp->f_bavail; /* blocks available to users */ tem->ufsd_pgthresh = 0; /* not relevant */ tem->ufsd_uid = 0; /* XXX kept where ?*/ @@ -220,7 +223,8 @@ ultrix_sys_getmnt(p, v, retval) * provided. */ MALLOC(path, char *, MAXPATHLEN, M_TEMP, M_WAITOK); - if (error = copyinstr(SCARG(uap, path), path, MAXPATHLEN, NULL)) + if ((error = copyinstr(SCARG(uap, path), path, + MAXPATHLEN, NULL)) != 0) goto bad; maxcount = 1; } else { @@ -229,9 +233,8 @@ ultrix_sys_getmnt(p, v, retval) * Find out how many mount list entries to skip, and skip * them. */ - if (error = - copyin((caddr_t)SCARG(uap, start), &start, - sizeof(*SCARG(uap, start)))) + if ((error = copyin((caddr_t)SCARG(uap, start), &start, + sizeof(*SCARG(uap, start)))) != 0) goto bad; for (skip = start, mp = mountlist.cqh_first; mp != (void*)&mountlist && skip-- > 0; mp = nmp) @@ -259,8 +262,8 @@ ultrix_sys_getmnt(p, v, retval) if (path == NULL || strcmp(path, sp->f_mntonname) == 0) { make_ultrix_mntent(sp, &tem); - if (error = - copyout((caddr_t)&tem, sfsp, sizeof(tem))) + if ((error = copyout((caddr_t)&tem, sfsp, + sizeof(tem))) != 0) goto bad; sfsp++; count++; @@ -357,7 +360,8 @@ ultrix_sys_mount(p, v, retval) /* Copy string-ified version of mount type back out to user space */ SCARG(&nuap, type) = (char *)usp; - if (error = copyout(fstype, SCARG(&nuap, type), strlen(fstype)+1)) { + if ((error = copyout(fstype, SCARG(&nuap, type), + strlen(fstype)+1)) != 0) { return (error); } usp += strlen(fstype)+1; @@ -370,13 +374,13 @@ ultrix_sys_mount(p, v, retval) if (otype == ULTRIX_FSTYPE_ULTRIX) { /* attempt to mount a native, rather than 4.2bsd, ffs */ struct ufs_args ua; - struct nameidata nd; ua.fspec = SCARG(uap, special); bzero(&ua.export, sizeof(ua.export)); SCARG(&nuap, data) = usp; - if (error = copyout(&ua, SCARG(&nuap, data), sizeof ua)) { + if ((error = copyout(&ua, SCARG(&nuap, data), + sizeof ua)) !=0) { return(error); } /* @@ -385,8 +389,8 @@ ultrix_sys_mount(p, v, retval) * and if so, set MNT_UPDATE so we can mount / read-write. */ fsname[0] = 0; - if (error = copyinstr((caddr_t)SCARG(&nuap, path), fsname, - sizeof fsname, (u_int*)0)) + if ((error = copyinstr((caddr_t)SCARG(&nuap, path), fsname, + sizeof fsname, (u_int*)0)) != 0) return(error); if (strcmp(fsname, "/") == 0) { SCARG(&nuap, flags) |= MNT_UPDATE; @@ -401,7 +405,7 @@ ultrix_sys_mount(p, v, retval) bzero(&osa, sizeof(osa)); bzero(&una, sizeof(una)); - if (error = copyin(SCARG(uap, data), &una, sizeof una)) { + if ((error = copyin(SCARG(uap, data), &una, sizeof una)) !=0) { return (error); } /* @@ -409,7 +413,7 @@ ultrix_sys_mount(p, v, retval) * address of the server passes, so do backwards * compatibility on 4.3style sockaddrs here. */ - if (error = copyin(una.addr, &osa, sizeof osa)) { + if ((error = copyin(una.addr, &osa, sizeof osa)) != 0) { printf("ultrix_mount: nfs copyin osa\n"); return (error); } @@ -433,9 +437,9 @@ ultrix_sys_mount(p, v, retval) na.timeo = una.timeo; na.retrans = una.retrans; na.hostname = una.hostname; - if (error = copyout(sap, na.addr, sizeof (*sap) )) + if ((error = copyout(sap, na.addr, sizeof (*sap) )) != 0) return (error); - if (error = copyout(&na, SCARG(&nuap, data), sizeof na)) + if ((error = copyout(&na, SCARG(&nuap, data), sizeof na)) != 0) return (error); } return (sys_mount(p, &nuap, retval)); diff --git a/sys/compat/ultrix/ultrix_ioctl.c b/sys/compat/ultrix/ultrix_ioctl.c index b6a884b3aa4..29cae666642 100644 --- a/sys/compat/ultrix/ultrix_ioctl.c +++ b/sys/compat/ultrix/ultrix_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ultrix_ioctl.c,v 1.2 1996/01/04 19:03:32 jonathan Exp $ */ +/* $NetBSD: ultrix_ioctl.c,v 1.3 1996/04/07 17:23:08 jonathan Exp $ */ /* from : NetBSD: sunos_ioctl.c,v 1.21 1995/10/07 06:27:31 mycroft Exp */ /* @@ -586,7 +586,7 @@ ultrix_sys_ioctl(p, v, retval) #else result= (*ctl)(fp, ULTRIX_TCSETA - SCARG(uap, com) + TIOCSETA, (caddr_t)&bts, p); - printf("ultrix TCSETA %x returns %d\n", + printf("ultrix TCSETA %lx returns %d\n", ULTRIX_TCSETA - SCARG(uap, com), result); return result; #endif @@ -599,7 +599,6 @@ ultrix_sys_ioctl(p, v, retval) { struct termios bts; struct ultrix_termios sts; - int result; if ((error = copyin (SCARG(uap, data), (caddr_t)&sts, sizeof (sts))) != 0) @@ -614,14 +613,16 @@ ultrix_sys_ioctl(p, v, retval) case _IOW('t', 32, int): { /* TIOCTCNTL */ int error, on; - if (error = copyin (SCARG(uap, data), (caddr_t)&on, sizeof (on))) + error = copyin (SCARG(uap, data), (caddr_t)&on, sizeof (on)); + if (error != 0) return error; return (*ctl)(fp, TIOCUCNTL, (caddr_t)&on, p); } case _IOW('t', 33, int): { /* TIOCSIGNAL */ int error, sig; - if (error = copyin (SCARG(uap, data), (caddr_t)&sig, sizeof (sig))) + error = copyin (SCARG(uap, data), (caddr_t)&sig, sizeof (sig)); + if (error != 0) return error; return (*ctl)(fp, TIOCSIG, (caddr_t)&sig, p); } @@ -629,17 +630,37 @@ ultrix_sys_ioctl(p, v, retval) /* * Socket ioctl translations. */ +#define IN_TYPE(a, type_t) { \ + type_t localbuf; \ + if ((error = copyin (SCARG(uap, data), \ + (caddr_t)&localbuf, sizeof (type_t))) != 0) \ + return error; \ + return (*ctl)(fp, a, (caddr_t)&localbuf, p); \ +} + +#define INOUT_TYPE(a, type_t) { \ + type_t localbuf; \ + if ((error = copyin (SCARG(uap, data), (caddr_t)&localbuf, \ + sizeof (type_t))) != 0) \ + return error; \ + if ((error = (*ctl)(fp, a, (caddr_t)&localbuf, p)) != 0) \ + return error; \ + return copyout ((caddr_t)&localbuf, SCARG(uap, data), sizeof (type_t)); \ +} + + #define IFREQ_IN(a) { \ struct ifreq ifreq; \ - if (error = copyin (SCARG(uap, data), (caddr_t)&ifreq, sizeof (ifreq))) \ + if ((error = copyin (SCARG(uap, data), (caddr_t)&ifreq, sizeof (ifreq))) != 0) \ return error; \ return (*ctl)(fp, a, (caddr_t)&ifreq, p); \ } + #define IFREQ_INOUT(a) { \ struct ifreq ifreq; \ - if (error = copyin (SCARG(uap, data), (caddr_t)&ifreq, sizeof (ifreq))) \ + if ((error = copyin (SCARG(uap, data), (caddr_t)&ifreq, sizeof (ifreq))) != 0) \ return error; \ - if (error = (*ctl)(fp, a, (caddr_t)&ifreq, p)) \ + if ((error = (*ctl)(fp, a, (caddr_t)&ifreq, p)) != 0) \ return error; \ return copyout ((caddr_t)&ifreq, SCARG(uap, data), sizeof (ifreq)); \ } @@ -724,10 +745,11 @@ ultrix_sys_ioctl(p, v, retval) * 1. our sockaddr's are variable length, not always sizeof(sockaddr) * 2. this returns a name per protocol, ie. it returns two "lo0"'s */ - if (error = copyin (SCARG(uap, data), (caddr_t)&ifconf, - sizeof (ifconf))) + if ((error = copyin (SCARG(uap, data), (caddr_t)&ifconf, + sizeof (ifconf))) != 0) return error; - if (error = (*ctl)(fp, OSIOCGIFCONF, (caddr_t)&ifconf, p)) + if ((error = (*ctl)(fp, OSIOCGIFCONF, + * (caddr_t)&ifconf, p)) !=0 ) return error; return copyout ((caddr_t)&ifconf, SCARG(uap, data), sizeof (ifconf)); diff --git a/sys/compat/ultrix/ultrix_misc.c b/sys/compat/ultrix/ultrix_misc.c index 212453ec3ab..314bef3d360 100644 --- a/sys/compat/ultrix/ultrix_misc.c +++ b/sys/compat/ultrix/ultrix_misc.c @@ -1,5 +1,33 @@ -/* $OpenBSD: ultrix_misc.c,v 1.6 1996/04/18 21:21:50 niklas Exp $ */ -/* $NetBSD: ultrix_misc.c,v 1.21 1996/02/19 15:41:38 pk Exp $ */ +/* $OpenBSD: ultrix_misc.c,v 1.7 1996/04/21 22:18:48 deraadt Exp $ */ +/* $NetBSD: ultrix_misc.c,v 1.23 1996/04/07 17:23:04 jonathan Exp $ */ + +/* + * Copyright (c) 1995 + * Jonathan Stone (hereinafter referred to as the author) + * + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ /* * Copyright (c) 1992, 1993 @@ -96,9 +124,25 @@ #include <vm/vm.h> +#include <sys/conf.h> /* iszerodev() */ +#include <sys/socketvar.h> /* sosetopt() */ + extern struct sysent ultrix_sysent[]; extern char *ultrix_syscallnames[]; -extern void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, + +/* + * Select the appropriate setregs callback for the target architecture. + */ +#ifdef mips +#define ULTRIX_EXEC_SETREGS cpu_exec_ecoff_setregs +#endif /* mips */ + +#ifdef vax +#define ULTRIX_EXEC_SETREGS setregs +#endif /* mips */ + + +extern void ULTRIX_EXEC_SETREGS __P((struct proc *, struct exec_package *, u_long, register_t *)); extern char sigcode[], esigcode[]; @@ -112,13 +156,14 @@ struct emul emul_ultrix = { ultrix_syscallnames, 0, copyargs, - cpu_exec_ecoff_setregs, + ULTRIX_EXEC_SETREGS, sigcode, esigcode, }; #define GSI_PROG_ENV 1 +int ultrix_sys_getsysinfo(p, v, retval) struct proc *p; void *v; @@ -140,16 +185,22 @@ ultrix_sys_getsysinfo(p, v, retval) } } +int ultrix_sys_setsysinfo(p, v, retval) struct proc *p; void *v; register_t *retval; { + +#ifdef notyet struct ultrix_sys_setsysinfo_args *uap = v; +#endif + *retval = 0; return 0; } +int ultrix_sys_waitpid(p, v, retval) struct proc *p; void *v; @@ -166,6 +217,7 @@ ultrix_sys_waitpid(p, v, retval) return (sys_wait4(p, &ua, retval)); } +int ultrix_sys_wait3(p, v, retval) struct proc *p; void *v; @@ -184,16 +236,19 @@ ultrix_sys_wait3(p, v, retval) /* * Ultrix binaries pass in FD_MAX as the first arg to select(). - * On Ultrix, that is 4096, which is more than the NetBSD sys_select() + * On Ultrix, FD_MAX is 4096, which is more than the NetBSD sys_select() * can handle. + * Since we can't have more than the (native) FD_MAX descriptors open, + * limit nfds to at most FD_MAX. */ +int ultrix_sys_select(p, v, retval) struct proc *p; void *v; register_t *retval; { struct sys_select_args *uap = v; - struct timeval atv, *tvp; + struct timeval atv; int error; /* Limit number of FDs selected on to the native maximum */ @@ -210,7 +265,7 @@ ultrix_sys_select(p, v, retval) #ifdef DEBUG /* Ultrix clients sometimes give negative timeouts? */ if (atv.tv_sec < 0 || atv.tv_usec < 0) - printf("ultrix select( %d, %d)\n", + printf("ultrix select( %ld, %ld): negative timeout\n", atv.tv_sec, atv.tv_usec); /*tvp = (timeval *)STACKGAPBASE;*/ #endif @@ -225,6 +280,7 @@ done: } #if defined(NFSCLIENT) +int async_daemon(p, v, retval) struct proc *p; void *v; @@ -239,15 +295,6 @@ async_daemon(p, v, retval) } #endif /* NFSCLIENT */ -#if 0 -/* XXX: Temporary until sys/dir.h, include/dirent.h and sys/dirent.h are fixed */ -struct dirent { - u_long d_fileno; /* file number of entry */ - u_short d_reclen; /* length of this record */ - u_short d_namlen; /* length of string in d_name */ - char d_name[255 + 1]; /* name must be no longer than this */ -}; -#endif #define SUN__MAP_NEW 0x80000000 /* if not, old mmap & cannot handle */ @@ -301,6 +348,7 @@ ultrix_sys_mmap(p, v, retval) return (sys_mmap(p, &ouap, retval)); } +int ultrix_sys_setsockopt(p, v, retval) struct proc *p; void *v; @@ -311,7 +359,7 @@ ultrix_sys_setsockopt(p, v, retval) struct mbuf *m = NULL; int error; - if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) + if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); #define SO_DONTLINGER (~SO_LINGER) if (SCARG(uap, name) == SO_DONTLINGER) { @@ -329,8 +377,8 @@ ultrix_sys_setsockopt(p, v, retval) m = m_get(M_WAIT, MT_SOOPTS); if (m == NULL) return (ENOBUFS); - if (error = copyin(SCARG(uap, val), mtod(m, caddr_t), - (u_int)SCARG(uap, valsize))) { + if ((error = copyin(SCARG(uap, val), mtod(m, caddr_t), + (u_int)SCARG(uap, valsize))) != 0) { (void) m_free(m); return (error); } @@ -400,13 +448,14 @@ ultrix_sys_nfssvc(p, v, retval) void *v; register_t *retval; { + +#if 0 /* XXX */ struct ultrix_sys_nfssvc_args *uap = v; struct emul *e = p->p_emul; struct sys_nfssvc_args outuap; struct sockaddr sa; int error; -#if 0 bzero(&outuap, sizeof outuap); SCARG(&outuap, fd) = SCARG(uap, fd); SCARG(&outuap, mskval) = STACKGAPBASE; @@ -451,7 +500,7 @@ ultrix_sys_ustat(p, v, retval) * How do we translate dev -> fstat? (and then to ultrix_ustat) */ - if (error = copyout(&us, SCARG(uap, buf), sizeof us)) + if ((error = copyout(&us, SCARG(uap, buf), sizeof us)) != 0) return (error); return 0; } @@ -462,7 +511,10 @@ ultrix_sys_quotactl(p, v, retval) void *v; register_t *retval; { + +#ifdef notyet struct ultrix_sys_quotactl_args *uap = v; +#endif return EINVAL; } @@ -483,7 +535,9 @@ ultrix_sys_exportfs(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct ultrix_sys_exportfs_args *uap = v; +#endif /* * XXX: should perhaps translate into a mount(2) diff --git a/sys/compat/ultrix/ultrix_pathname.c b/sys/compat/ultrix/ultrix_pathname.c index 2175ac438ac..faa63931320 100644 --- a/sys/compat/ultrix/ultrix_pathname.c +++ b/sys/compat/ultrix/ultrix_pathname.c @@ -1,4 +1,4 @@ -/* $NetBSD: ultrix_pathname.c,v 1.1 1996/01/07 13:38:52 jonathan Exp $ */ +/* $NetBSD: ultrix_pathname.c,v 1.2 1996/04/07 17:23:07 jonathan Exp $ */ /* * Copyright (c) 1992, 1993 @@ -248,12 +248,13 @@ ultrix_sys_statfs(p, v, retval) ULTRIX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); - if (error = namei(&nd)) + if ((error = namei(&nd)) != 0) return (error); + mp = nd.ni_vp->v_mount; sp = &mp->mnt_stat; vrele(nd.ni_vp); - if (error = VFS_STATFS(mp, sp, p)) + if ((error = VFS_STATFS(mp, sp, p)) != 0) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; return ultrixstatfs(sp, (caddr_t)SCARG(uap, buf)); @@ -276,11 +277,11 @@ ultrix_sys_fstatfs(p, v, retval) register struct statfs *sp; int error; - if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) + if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); mp = ((struct vnode *)fp->f_data)->v_mount; sp = &mp->mnt_stat; - if (error = VFS_STATFS(mp, sp, p)) + if ((error = VFS_STATFS(mp, sp, p)) != 0) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; return ultrixstatfs(sp, (caddr_t)SCARG(uap, buf)); |