Home | History | Annotate | Line # | Download | only in ultrix
ultrix_misc.c revision 1.22
      1  1.22  jonathan /*	$NetBSD: ultrix_misc.c,v 1.22 1996/04/07 16:38:03 jonathan Exp $	*/
      2   1.5       cgd 
      3   1.1     glass /*
      4   1.1     glass  * Copyright (c) 1992, 1993
      5   1.1     glass  *	The Regents of the University of California.  All rights reserved.
      6   1.1     glass  *
      7   1.1     glass  * This software was developed by the Computer Systems Engineering group
      8   1.1     glass  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
      9   1.1     glass  * contributed to Berkeley.
     10   1.1     glass  *
     11   1.1     glass  * All advertising materials mentioning features or use of this software
     12   1.1     glass  * must display the following acknowledgement:
     13   1.1     glass  *	This product includes software developed by the University of
     14   1.1     glass  *	California, Lawrence Berkeley Laboratory.
     15   1.1     glass  *
     16   1.1     glass  * Redistribution and use in source and binary forms, with or without
     17   1.1     glass  * modification, are permitted provided that the following conditions
     18   1.1     glass  * are met:
     19   1.1     glass  * 1. Redistributions of source code must retain the above copyright
     20   1.1     glass  *    notice, this list of conditions and the following disclaimer.
     21   1.1     glass  * 2. Redistributions in binary form must reproduce the above copyright
     22   1.1     glass  *    notice, this list of conditions and the following disclaimer in the
     23   1.1     glass  *    documentation and/or other materials provided with the distribution.
     24   1.1     glass  * 3. All advertising materials mentioning features or use of this software
     25   1.1     glass  *    must display the following acknowledgement:
     26   1.1     glass  *	This product includes software developed by the University of
     27   1.1     glass  *	California, Berkeley and its contributors.
     28   1.1     glass  * 4. Neither the name of the University nor the names of its contributors
     29   1.1     glass  *    may be used to endorse or promote products derived from this software
     30   1.1     glass  *    without specific prior written permission.
     31   1.1     glass  *
     32   1.1     glass  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     33   1.1     glass  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     34   1.1     glass  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     35   1.1     glass  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     36   1.1     glass  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37   1.1     glass  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38   1.1     glass  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39   1.1     glass  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     40   1.1     glass  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     41   1.1     glass  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     42   1.1     glass  * SUCH DAMAGE.
     43   1.1     glass  *
     44   1.5       cgd  *
     45   1.1     glass  *	@(#)sun_misc.c	8.1 (Berkeley) 6/18/93
     46   1.1     glass  *
     47   1.1     glass  * from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
     48   1.1     glass  */
     49   1.1     glass 
     50   1.1     glass /*
     51   1.1     glass  * SunOS compatibility module.
     52   1.1     glass  *
     53   1.1     glass  * SunOS system calls that are implemented differently in BSD are
     54   1.1     glass  * handled here.
     55   1.1     glass  */
     56   1.1     glass 
     57   1.1     glass #include <sys/param.h>
     58   1.1     glass #include <sys/systm.h>
     59   1.1     glass #include <sys/namei.h>
     60   1.3     glass #include <sys/dir.h>
     61   1.1     glass #include <sys/proc.h>
     62   1.1     glass #include <sys/file.h>
     63   1.1     glass #include <sys/filedesc.h>
     64  1.20  jonathan /*#include <sys/stat.h>*/
     65  1.20  jonathan /*#include <sys/ioctl.h>*/
     66   1.1     glass #include <sys/kernel.h>
     67   1.1     glass #include <sys/exec.h>
     68   1.1     glass #include <sys/malloc.h>
     69   1.1     glass #include <sys/mbuf.h>
     70   1.1     glass #include <sys/mman.h>
     71   1.1     glass #include <sys/mount.h>
     72   1.1     glass #include <sys/resource.h>
     73   1.1     glass #include <sys/resourcevar.h>
     74   1.1     glass #include <sys/signal.h>
     75   1.1     glass #include <sys/signalvar.h>
     76   1.1     glass #include <sys/socket.h>
     77   1.1     glass #include <sys/vnode.h>
     78   1.1     glass #include <sys/uio.h>
     79   1.1     glass #include <sys/wait.h>
     80   1.1     glass #include <sys/utsname.h>
     81   1.1     glass #include <sys/unistd.h>
     82  1.20  jonathan 
     83  1.16   mycroft #include <sys/syscallargs.h>
     84  1.16   mycroft 
     85  1.16   mycroft #include <compat/ultrix/ultrix_syscall.h>
     86  1.16   mycroft #include <compat/ultrix/ultrix_syscallargs.h>
     87   1.1     glass 
     88   1.1     glass #include <netinet/in.h>
     89   1.1     glass 
     90   1.1     glass #include <miscfs/specfs/specdev.h>
     91   1.1     glass 
     92   1.3     glass #include <nfs/rpcv2.h>
     93  1.21        pk #include <nfs/nfsproto.h>
     94   1.3     glass #include <nfs/nfs.h>
     95   1.3     glass 
     96   1.1     glass #include <vm/vm.h>
     97  1.11  christos 
     98  1.11  christos extern struct sysent ultrix_sysent[];
     99  1.11  christos extern char *ultrix_syscallnames[];
    100  1.22  jonathan 
    101  1.22  jonathan /*
    102  1.22  jonathan  * Select the appropriate setregs callback for the target architecture.
    103  1.22  jonathan  */
    104  1.22  jonathan #ifdef mips
    105  1.22  jonathan #define ULTRIX_EXEC_SETREGS cpu_exec_ecoff_setregs
    106  1.22  jonathan #endif /* mips */
    107  1.22  jonathan 
    108  1.22  jonathan #ifdef vax
    109  1.22  jonathan #define ULTRIX_EXEC_SETREGS setregs
    110  1.22  jonathan #endif /* mips */
    111  1.22  jonathan 
    112  1.22  jonathan 
    113  1.22  jonathan extern void ULTRIX_EXEC_SETREGS __P((struct proc *, struct exec_package *,
    114  1.11  christos 					u_long, register_t *));
    115  1.19  jonathan extern char sigcode[], esigcode[];
    116  1.19  jonathan 
    117  1.11  christos struct emul emul_ultrix = {
    118  1.11  christos 	"ultrix",
    119  1.11  christos 	NULL,
    120  1.11  christos 	sendsig,
    121  1.11  christos 	ULTRIX_SYS_syscall,
    122  1.11  christos 	ULTRIX_SYS_MAXSYSCALL,
    123  1.11  christos 	ultrix_sysent,
    124  1.11  christos 	ultrix_syscallnames,
    125  1.11  christos 	0,
    126  1.11  christos 	copyargs,
    127  1.22  jonathan 	ULTRIX_EXEC_SETREGS,
    128  1.19  jonathan 	sigcode,
    129  1.19  jonathan 	esigcode,
    130  1.11  christos };
    131   1.1     glass 
    132   1.6     glass #define GSI_PROG_ENV 1
    133   1.6     glass 
    134  1.16   mycroft ultrix_sys_getsysinfo(p, v, retval)
    135   1.6     glass 	struct proc *p;
    136  1.15   thorpej 	void *v;
    137  1.16   mycroft 	register_t *retval;
    138   1.6     glass {
    139  1.16   mycroft 	struct ultrix_sys_getsysinfo_args *uap = v;
    140   1.6     glass 	static short progenv = 0;
    141   1.6     glass 
    142  1.16   mycroft 	switch (SCARG(uap, op)) {
    143   1.6     glass 		/* operations implemented: */
    144   1.6     glass 	case GSI_PROG_ENV:
    145  1.16   mycroft 		if (SCARG(uap, nbytes) < sizeof(short))
    146   1.6     glass 			return EINVAL;
    147   1.6     glass 		*retval = 1;
    148  1.16   mycroft 		return (copyout(&progenv, SCARG(uap, buffer), sizeof(short)));
    149   1.6     glass 	default:
    150   1.6     glass 		*retval = 0; /* info unavail */
    151   1.6     glass 		return 0;
    152   1.6     glass 	}
    153   1.6     glass }
    154   1.6     glass 
    155  1.16   mycroft ultrix_sys_setsysinfo(p, v, retval)
    156   1.6     glass 	struct proc *p;
    157  1.15   thorpej 	void *v;
    158  1.16   mycroft 	register_t *retval;
    159   1.6     glass {
    160  1.16   mycroft 	struct ultrix_sys_setsysinfo_args *uap = v;
    161   1.6     glass 	*retval = 0;
    162   1.6     glass 	return 0;
    163   1.6     glass }
    164   1.6     glass 
    165  1.16   mycroft ultrix_sys_waitpid(p, v, retval)
    166   1.1     glass 	struct proc *p;
    167  1.15   thorpej 	void *v;
    168   1.7       cgd 	register_t *retval;
    169   1.1     glass {
    170  1.16   mycroft 	struct ultrix_sys_waitpid_args *uap = v;
    171  1.16   mycroft 	struct sys_wait4_args ua;
    172   1.1     glass 
    173  1.16   mycroft 	SCARG(&ua, pid) = SCARG(uap, pid);
    174  1.16   mycroft 	SCARG(&ua, status) = SCARG(uap, status);
    175  1.16   mycroft 	SCARG(&ua, options) = SCARG(uap, options);
    176  1.16   mycroft 	SCARG(&ua, rusage) = 0;
    177   1.1     glass 
    178  1.16   mycroft 	return (sys_wait4(p, &ua, retval));
    179   1.2     glass }
    180   1.2     glass 
    181  1.16   mycroft ultrix_sys_wait3(p, v, retval)
    182   1.2     glass 	struct proc *p;
    183  1.15   thorpej 	void *v;
    184   1.7       cgd 	register_t *retval;
    185   1.2     glass {
    186  1.16   mycroft 	struct ultrix_sys_wait3_args *uap = v;
    187  1.16   mycroft 	struct sys_wait4_args ua;
    188   1.2     glass 
    189  1.16   mycroft 	SCARG(&ua, pid) = -1;
    190  1.16   mycroft 	SCARG(&ua, status) = SCARG(uap, status);
    191  1.16   mycroft 	SCARG(&ua, options) = SCARG(uap, options);
    192  1.16   mycroft 	SCARG(&ua, rusage) = SCARG(uap, rusage);
    193   1.1     glass 
    194  1.16   mycroft 	return (sys_wait4(p, &ua, retval));
    195   1.1     glass }
    196   1.1     glass 
    197  1.20  jonathan /*
    198  1.20  jonathan  * Ultrix binaries pass in FD_MAX as the first arg to select().
    199  1.20  jonathan  * On Ultrix, that is 4096, which is more than the NetBSD sys_select()
    200  1.20  jonathan  * can handle.
    201  1.20  jonathan  */
    202  1.18  jonathan ultrix_sys_select(p, v, retval)
    203  1.18  jonathan 	struct proc *p;
    204  1.18  jonathan 	void *v;
    205  1.18  jonathan 	register_t *retval;
    206  1.18  jonathan {
    207  1.18  jonathan 	struct sys_select_args *uap = v;
    208  1.18  jonathan 	struct timeval atv, *tvp;
    209  1.18  jonathan 	int error;
    210  1.18  jonathan 
    211  1.18  jonathan 	/* Limit number of FDs selected on to the native maximum */
    212  1.18  jonathan 
    213  1.18  jonathan 	if (SCARG(uap, nd) > FD_SETSIZE)
    214  1.18  jonathan 		SCARG(uap, nd) = FD_SETSIZE;
    215  1.18  jonathan 
    216  1.18  jonathan 	/* Check for negative timeval */
    217  1.18  jonathan 	if (SCARG(uap, tv)) {
    218  1.18  jonathan 		error = copyin((caddr_t)SCARG(uap, tv), (caddr_t)&atv,
    219  1.18  jonathan 			       sizeof(atv));
    220  1.18  jonathan 		if (error)
    221  1.18  jonathan 			goto done;
    222  1.18  jonathan #ifdef DEBUG
    223  1.18  jonathan 		/* Ultrix clients sometimes give negative timeouts? */
    224  1.18  jonathan 		if (atv.tv_sec < 0 || atv.tv_usec < 0)
    225  1.18  jonathan 			printf("ultrix select( %d, %d)\n",
    226  1.18  jonathan 			       atv.tv_sec, atv.tv_usec);
    227  1.18  jonathan 		/*tvp = (timeval *)STACKGAPBASE;*/
    228  1.18  jonathan #endif
    229  1.18  jonathan 
    230  1.18  jonathan 	}
    231  1.18  jonathan 	error = sys_select(p, (void*) uap, retval);
    232  1.18  jonathan 	if (error == EINVAL)
    233  1.18  jonathan 		printf("ultrix select: bad args?\n");
    234  1.18  jonathan 
    235  1.18  jonathan done:
    236  1.18  jonathan 	return error;
    237   1.1     glass }
    238   1.1     glass 
    239  1.16   mycroft #if defined(NFSCLIENT)
    240  1.16   mycroft async_daemon(p, v, retval)
    241   1.1     glass 	struct proc *p;
    242  1.15   thorpej 	void *v;
    243   1.7       cgd 	register_t *retval;
    244   1.1     glass {
    245  1.16   mycroft 	struct sys_nfssvc_args ouap;
    246   1.1     glass 
    247  1.16   mycroft 	SCARG(&ouap, flag) = NFSSVC_BIOD;
    248  1.16   mycroft 	SCARG(&ouap, argp) = NULL;
    249   1.3     glass 
    250  1.16   mycroft 	return (sys_nfssvc(p, &ouap, retval));
    251   1.3     glass }
    252   1.3     glass #endif /* NFSCLIENT */
    253   1.3     glass 
    254   1.1     glass 
    255   1.1     glass #define	SUN__MAP_NEW	0x80000000	/* if not, old mmap & cannot handle */
    256   1.1     glass 
    257  1.20  jonathan int
    258  1.16   mycroft ultrix_sys_mmap(p, v, retval)
    259   1.1     glass 	register struct proc *p;
    260  1.15   thorpej 	void *v;
    261   1.7       cgd 	register_t *retval;
    262   1.1     glass {
    263  1.16   mycroft 	register struct ultrix_sys_mmap_args *uap = v;
    264  1.16   mycroft 	struct sys_mmap_args ouap;
    265   1.1     glass 	register struct filedesc *fdp;
    266   1.1     glass 	register struct file *fp;
    267   1.1     glass 	register struct vnode *vp;
    268   1.1     glass 
    269   1.1     glass 	/*
    270   1.1     glass 	 * Verify the arguments.
    271   1.1     glass 	 */
    272  1.16   mycroft 	if (SCARG(uap, prot) & ~(PROT_READ|PROT_WRITE|PROT_EXEC))
    273   1.1     glass 		return (EINVAL);			/* XXX still needed? */
    274   1.1     glass 
    275  1.16   mycroft 	if ((SCARG(uap, flags) & SUN__MAP_NEW) == 0)
    276   1.1     glass 		return (EINVAL);
    277   1.1     glass 
    278  1.16   mycroft 	SCARG(&ouap, flags) = SCARG(uap, flags) & ~SUN__MAP_NEW;
    279  1.16   mycroft 	SCARG(&ouap, addr) = SCARG(uap, addr);
    280  1.16   mycroft 
    281  1.16   mycroft 	if ((SCARG(&ouap, flags) & MAP_FIXED) == 0 &&
    282  1.16   mycroft 	    SCARG(&ouap, addr) != 0 &&
    283  1.16   mycroft 	    SCARG(&ouap, addr) < (caddr_t)round_page(p->p_vmspace->vm_daddr+MAXDSIZ))
    284  1.16   mycroft 		SCARG(&ouap, addr) = (caddr_t)round_page(p->p_vmspace->vm_daddr+MAXDSIZ);
    285  1.16   mycroft 
    286  1.16   mycroft 	SCARG(&ouap, len) = SCARG(uap, len);
    287  1.16   mycroft 	SCARG(&ouap, prot) = SCARG(uap, prot);
    288  1.16   mycroft 	SCARG(&ouap, fd) = SCARG(uap, fd);
    289  1.16   mycroft 	SCARG(&ouap, pos) = SCARG(uap, pos);
    290   1.1     glass 
    291   1.1     glass 	/*
    292   1.1     glass 	 * Special case: if fd refers to /dev/zero, map as MAP_ANON.  (XXX)
    293   1.1     glass 	 */
    294   1.1     glass 	fdp = p->p_fd;
    295  1.16   mycroft 	if ((unsigned)SCARG(&ouap, fd) < fdp->fd_nfiles &&		/*XXX*/
    296  1.16   mycroft 	    (fp = fdp->fd_ofiles[SCARG(&ouap, fd)]) != NULL &&		/*XXX*/
    297   1.1     glass 	    fp->f_type == DTYPE_VNODE &&				/*XXX*/
    298   1.1     glass 	    (vp = (struct vnode *)fp->f_data)->v_type == VCHR &&	/*XXX*/
    299   1.1     glass 	    iszerodev(vp->v_rdev)) {					/*XXX*/
    300  1.16   mycroft 		SCARG(&ouap, flags) |= MAP_ANON;
    301  1.16   mycroft 		SCARG(&ouap, fd) = -1;
    302   1.1     glass 	}
    303   1.1     glass 
    304  1.16   mycroft 	return (sys_mmap(p, &ouap, retval));
    305   1.1     glass }
    306   1.1     glass 
    307  1.16   mycroft ultrix_sys_setsockopt(p, v, retval)
    308   1.1     glass 	struct proc *p;
    309  1.15   thorpej 	void *v;
    310   1.7       cgd 	register_t *retval;
    311   1.1     glass {
    312  1.16   mycroft 	register struct ultrix_sys_setsockopt_args *uap = v;
    313   1.1     glass 	struct file *fp;
    314   1.1     glass 	struct mbuf *m = NULL;
    315   1.1     glass 	int error;
    316   1.1     glass 
    317  1.16   mycroft 	if (error = getsock(p->p_fd, SCARG(uap, s), &fp))
    318   1.1     glass 		return (error);
    319   1.1     glass #define	SO_DONTLINGER (~SO_LINGER)
    320  1.16   mycroft 	if (SCARG(uap, name) == SO_DONTLINGER) {
    321   1.1     glass 		m = m_get(M_WAIT, MT_SOOPTS);
    322   1.1     glass 		if (m == NULL)
    323   1.1     glass 			return (ENOBUFS);
    324   1.1     glass 		mtod(m, struct linger *)->l_onoff = 0;
    325   1.1     glass 		m->m_len = sizeof(struct linger);
    326  1.16   mycroft 		return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level),
    327   1.1     glass 		    SO_LINGER, m));
    328   1.1     glass 	}
    329  1.16   mycroft 	if (SCARG(uap, valsize) > MLEN)
    330   1.1     glass 		return (EINVAL);
    331  1.16   mycroft 	if (SCARG(uap, val)) {
    332   1.1     glass 		m = m_get(M_WAIT, MT_SOOPTS);
    333   1.1     glass 		if (m == NULL)
    334   1.1     glass 			return (ENOBUFS);
    335  1.16   mycroft 		if (error = copyin(SCARG(uap, val), mtod(m, caddr_t),
    336  1.16   mycroft 		    (u_int)SCARG(uap, valsize))) {
    337   1.1     glass 			(void) m_free(m);
    338   1.1     glass 			return (error);
    339   1.1     glass 		}
    340  1.16   mycroft 		m->m_len = SCARG(uap, valsize);
    341   1.1     glass 	}
    342  1.16   mycroft 	return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level),
    343  1.16   mycroft 	    SCARG(uap, name), m));
    344   1.1     glass }
    345   1.1     glass 
    346  1.16   mycroft struct ultrix_utsname {
    347   1.1     glass 	char    sysname[9];
    348   1.1     glass 	char    nodename[9];
    349   1.1     glass 	char    nodeext[65-9];
    350   1.1     glass 	char    release[9];
    351   1.1     glass 	char    version[9];
    352   1.1     glass 	char    machine[9];
    353   1.1     glass };
    354   1.1     glass 
    355  1.20  jonathan int
    356  1.16   mycroft ultrix_sys_uname(p, v, retval)
    357   1.1     glass 	struct proc *p;
    358  1.15   thorpej 	void *v;
    359   1.7       cgd 	register_t *retval;
    360   1.1     glass {
    361  1.16   mycroft 	struct ultrix_sys_uname_args *uap = v;
    362  1.16   mycroft 	struct ultrix_utsname sut;
    363   1.1     glass 	extern char ostype[], machine[], osrelease[];
    364   1.1     glass 
    365   1.1     glass 	bzero(&sut, sizeof(sut));
    366   1.1     glass 
    367   1.1     glass 	bcopy(ostype, sut.sysname, sizeof(sut.sysname) - 1);
    368   1.1     glass 	bcopy(hostname, sut.nodename, sizeof(sut.nodename));
    369   1.1     glass 	sut.nodename[sizeof(sut.nodename)-1] = '\0';
    370   1.1     glass 	bcopy(osrelease, sut.release, sizeof(sut.release) - 1);
    371   1.1     glass 	bcopy("1", sut.version, sizeof(sut.version) - 1);
    372   1.1     glass 	bcopy(machine, sut.machine, sizeof(sut.machine) - 1);
    373   1.1     glass 
    374  1.16   mycroft 	return copyout((caddr_t)&sut, (caddr_t)SCARG(uap, name),
    375  1.16   mycroft 	    sizeof(struct ultrix_utsname));
    376   1.1     glass }
    377   1.1     glass 
    378   1.1     glass int
    379  1.16   mycroft ultrix_sys_setpgrp(p, v, retval)
    380   1.1     glass 	struct proc *p;
    381  1.15   thorpej 	void *v;
    382   1.7       cgd 	register_t *retval;
    383   1.1     glass {
    384  1.16   mycroft 	struct ultrix_sys_setpgrp_args *uap = v;
    385  1.15   thorpej 
    386   1.1     glass 	/*
    387   1.1     glass 	 * difference to our setpgid call is to include backwards
    388   1.1     glass 	 * compatibility to pre-setsid() binaries. Do setsid()
    389   1.1     glass 	 * instead of setpgid() in those cases where the process
    390   1.1     glass 	 * tries to create a new session the old way.
    391   1.1     glass 	 */
    392  1.16   mycroft 	if (!SCARG(uap, pgid) &&
    393  1.16   mycroft 	    (!SCARG(uap, pid) || SCARG(uap, pid) == p->p_pid))
    394  1.16   mycroft 		return sys_setsid(p, uap, retval);
    395   1.1     glass 	else
    396  1.16   mycroft 		return sys_setpgid(p, uap, retval);
    397   1.1     glass }
    398   1.1     glass 
    399   1.1     glass #if defined (NFSSERVER)
    400  1.20  jonathan int
    401  1.16   mycroft ultrix_sys_nfssvc(p, v, retval)
    402   1.1     glass 	struct proc *p;
    403  1.15   thorpej 	void *v;
    404   1.7       cgd 	register_t *retval;
    405   1.1     glass {
    406  1.16   mycroft 	struct ultrix_sys_nfssvc_args *uap = v;
    407  1.16   mycroft 	struct emul *e = p->p_emul;
    408  1.16   mycroft 	struct sys_nfssvc_args outuap;
    409   1.1     glass 	struct sockaddr sa;
    410   1.1     glass 	int error;
    411   1.1     glass 
    412  1.16   mycroft #if 0
    413   1.1     glass 	bzero(&outuap, sizeof outuap);
    414  1.16   mycroft 	SCARG(&outuap, fd) = SCARG(uap, fd);
    415  1.16   mycroft 	SCARG(&outuap, mskval) = STACKGAPBASE;
    416  1.16   mycroft 	SCARG(&outuap, msklen) = sizeof sa;
    417  1.16   mycroft 	SCARG(&outuap, mtchval) = outuap.mskval + sizeof sa;
    418  1.16   mycroft 	SCARG(&outuap, mtchlen) = sizeof sa;
    419   1.1     glass 
    420   1.1     glass 	bzero(&sa, sizeof sa);
    421  1.16   mycroft 	if (error = copyout(&sa, SCARG(&outuap, mskval), SCARG(&outuap, msklen)))
    422   1.1     glass 		return (error);
    423  1.16   mycroft 	if (error = copyout(&sa, SCARG(&outuap, mtchval), SCARG(&outuap, mtchlen)))
    424   1.1     glass 		return (error);
    425   1.1     glass 
    426   1.1     glass 	return nfssvc(p, &outuap, retval);
    427  1.16   mycroft #else
    428  1.16   mycroft 	return (ENOSYS);
    429  1.16   mycroft #endif
    430   1.1     glass }
    431   1.1     glass #endif /* NFSSERVER */
    432   1.1     glass 
    433  1.16   mycroft struct ultrix_ustat {
    434   1.1     glass 	daddr_t	f_tfree;	/* total free */
    435   1.1     glass 	ino_t	f_tinode;	/* total inodes free */
    436   1.1     glass 	char	f_fname[6];	/* filsys name */
    437   1.1     glass 	char	f_fpack[6];	/* filsys pack name */
    438   1.1     glass };
    439  1.16   mycroft 
    440  1.20  jonathan int
    441  1.16   mycroft ultrix_sys_ustat(p, v, retval)
    442   1.1     glass 	struct proc *p;
    443  1.15   thorpej 	void *v;
    444   1.7       cgd 	register_t *retval;
    445   1.1     glass {
    446  1.16   mycroft 	struct ultrix_sys_ustat_args *uap = v;
    447  1.16   mycroft 	struct ultrix_ustat us;
    448   1.1     glass 	int error;
    449   1.1     glass 
    450   1.1     glass 	bzero(&us, sizeof us);
    451   1.1     glass 
    452   1.1     glass 	/*
    453   1.1     glass 	 * XXX: should set f_tfree and f_tinode at least
    454  1.16   mycroft 	 * How do we translate dev -> fstat? (and then to ultrix_ustat)
    455   1.1     glass 	 */
    456   1.1     glass 
    457  1.16   mycroft 	if (error = copyout(&us, SCARG(uap, buf), sizeof us))
    458   1.1     glass 		return (error);
    459   1.1     glass 	return 0;
    460   1.1     glass }
    461   1.1     glass 
    462  1.20  jonathan int
    463  1.16   mycroft ultrix_sys_quotactl(p, v, retval)
    464   1.1     glass 	struct proc *p;
    465  1.15   thorpej 	void *v;
    466   1.7       cgd 	register_t *retval;
    467   1.1     glass {
    468  1.16   mycroft 	struct ultrix_sys_quotactl_args *uap = v;
    469  1.15   thorpej 
    470   1.1     glass 	return EINVAL;
    471   1.1     glass }
    472   1.1     glass 
    473  1.20  jonathan int
    474  1.16   mycroft ultrix_sys_vhangup(p, v, retval)
    475   1.1     glass 	struct proc *p;
    476  1.16   mycroft 	void *v;
    477   1.7       cgd 	register_t *retval;
    478   1.1     glass {
    479  1.16   mycroft 
    480   1.1     glass 	return 0;
    481   1.1     glass }
    482   1.1     glass 
    483  1.20  jonathan int
    484  1.16   mycroft ultrix_sys_exportfs(p, v, retval)
    485   1.1     glass 	struct proc *p;
    486  1.15   thorpej 	void *v;
    487   1.7       cgd 	register_t *retval;
    488   1.1     glass {
    489  1.16   mycroft 	struct ultrix_sys_exportfs_args *uap = v;
    490  1.15   thorpej 
    491   1.1     glass 	/*
    492   1.1     glass 	 * XXX: should perhaps translate into a mount(2)
    493   1.1     glass 	 * with MOUNT_EXPORT?
    494   1.1     glass 	 */
    495   1.1     glass 	return 0;
    496   1.1     glass }
    497   1.1     glass 
    498  1.16   mycroft int
    499  1.19  jonathan ultrix_sys_sigpending(p, v, retval)
    500  1.19  jonathan 	struct proc *p;
    501  1.19  jonathan 	void *v;
    502  1.19  jonathan 	register_t *retval;
    503  1.19  jonathan {
    504  1.19  jonathan 	struct ultrix_sys_sigpending_args *uap = v;
    505  1.19  jonathan 	int mask = p->p_siglist & p->p_sigmask;
    506  1.19  jonathan 
    507  1.19  jonathan 	return (copyout((caddr_t)&mask, (caddr_t)SCARG(uap, mask), sizeof(int)));
    508  1.19  jonathan }
    509  1.19  jonathan 
    510  1.19  jonathan int
    511  1.16   mycroft ultrix_sys_sigcleanup(p, v, retval)
    512  1.13    mellon 	struct proc *p;
    513  1.15   thorpej 	void *v;
    514  1.13    mellon 	register_t *retval;
    515  1.13    mellon {
    516  1.16   mycroft 	struct ultrix_sys_sigcleanup_args *uap = v;
    517  1.15   thorpej 
    518  1.16   mycroft 	return sys_sigreturn(p, (struct sys_sigreturn_args *)uap, retval);
    519  1.19  jonathan }
    520  1.19  jonathan 
    521  1.19  jonathan int
    522  1.19  jonathan ultrix_sys_sigreturn(p, v, retval)
    523  1.19  jonathan 	struct proc *p;
    524  1.19  jonathan 	void *v;
    525  1.19  jonathan 	register_t *retval;
    526  1.19  jonathan {
    527  1.19  jonathan 	struct ultrix_sys_sigcleanup_args *uap = v;
    528  1.19  jonathan 
    529  1.19  jonathan #ifdef DEBUG
    530  1.19  jonathan 	printf("ultrix sigreturn\n");
    531  1.19  jonathan #endif
    532  1.19  jonathan 	return sys_sigreturn(p, (struct sys_sigreturn_args  *)uap, retval);
    533   1.1     glass }
    534