Home | History | Annotate | Line # | Download | only in alpha
linux_osf1.c revision 1.3
      1  1.3   thorpej /*	$NetBSD: linux_osf1.c,v 1.3 2019/04/06 03:06:28 thorpej Exp $	*/
      2  1.1      maxv 
      3  1.1      maxv /*
      4  1.1      maxv  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
      5  1.1      maxv  *
      6  1.1      maxv  * Redistribution and use in source and binary forms, with or without
      7  1.1      maxv  * modification, are permitted provided that the following conditions
      8  1.1      maxv  * are met:
      9  1.1      maxv  * 1. Redistributions of source code must retain the above copyright
     10  1.1      maxv  *    notice, this list of conditions and the following disclaimer.
     11  1.1      maxv  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1      maxv  *    notice, this list of conditions and the following disclaimer in the
     13  1.1      maxv  *    documentation and/or other materials provided with the distribution.
     14  1.1      maxv  * 3. All advertising materials mentioning features or use of this software
     15  1.1      maxv  *    must display the following acknowledgement:
     16  1.1      maxv  *      This product includes software developed by Christopher G. Demetriou
     17  1.1      maxv  *	for the NetBSD Project.
     18  1.1      maxv  * 4. The name of the author may not be used to endorse or promote products
     19  1.1      maxv  *    derived from this software without specific prior written permission
     20  1.1      maxv  *
     21  1.1      maxv  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1      maxv  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1      maxv  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1      maxv  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.1      maxv  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.1      maxv  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1      maxv  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1      maxv  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1      maxv  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.1      maxv  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1      maxv  */
     32  1.1      maxv 
     33  1.1      maxv #include <sys/cdefs.h>
     34  1.3   thorpej __KERNEL_RCSID(0, "$NetBSD: linux_osf1.c,v 1.3 2019/04/06 03:06:28 thorpej Exp $");
     35  1.1      maxv 
     36  1.1      maxv #include <sys/param.h>
     37  1.1      maxv #include <sys/systm.h>
     38  1.1      maxv #include <sys/namei.h>
     39  1.1      maxv #include <sys/proc.h>
     40  1.1      maxv #include <sys/file.h>
     41  1.1      maxv #include <sys/filedesc.h>
     42  1.1      maxv #include <sys/kernel.h>
     43  1.1      maxv #include <sys/mount.h>
     44  1.1      maxv #include <sys/vnode.h>
     45  1.1      maxv #include <sys/wait.h>
     46  1.1      maxv #include <sys/select.h>
     47  1.1      maxv #include <sys/syscallargs.h>
     48  1.1      maxv #include <sys/vfs_syscalls.h>
     49  1.1      maxv 
     50  1.1      maxv #include <machine/alpha.h>
     51  1.1      maxv #include <machine/cpuconf.h>
     52  1.1      maxv #include <machine/rpb.h>
     53  1.1      maxv #include <machine/fpu.h>
     54  1.1      maxv 
     55  1.1      maxv #include <compat/common/compat_util.h>
     56  1.1      maxv #include <compat/linux/common/linux_types.h>
     57  1.1      maxv #include <compat/linux/common/linux_signal.h>
     58  1.1      maxv #include <compat/linux/arch/alpha/linux_signal.h>
     59  1.1      maxv #include <compat/linux/arch/alpha/linux_osf1.h>
     60  1.1      maxv #include <compat/linux/linux_syscallargs.h>
     61  1.1      maxv 
     62  1.1      maxv #include <net/if.h>
     63  1.1      maxv #include <netinet/in.h>
     64  1.1      maxv 
     65  1.1      maxv #include <nfs/rpcv2.h>
     66  1.1      maxv #include <nfs/nfsproto.h>
     67  1.1      maxv #include <nfs/nfs.h>
     68  1.1      maxv #include <nfs/nfsmount.h>
     69  1.1      maxv 
     70  1.1      maxv #include <ufs/ufs/quota.h>
     71  1.1      maxv #include <ufs/ufs/ufsmount.h>
     72  1.1      maxv 
     73  1.1      maxv #include <machine/vmparam.h>
     74  1.1      maxv 
     75  1.1      maxv const struct emul_flags_xtab osf1_wait_options_xtab[] = {
     76  1.1      maxv     {	OSF1_WNOHANG,		OSF1_WNOHANG,		WNOHANG		},
     77  1.1      maxv     {	OSF1_WUNTRACED,		OSF1_WUNTRACED,		WUNTRACED	},
     78  1.1      maxv     {	0								}
     79  1.1      maxv };
     80  1.1      maxv 
     81  1.1      maxv const struct emul_flags_xtab osf1_nfs_mount_flags_xtab[] = {
     82  1.1      maxv     {	OSF1_NFSMNT_SOFT,	OSF1_NFSMNT_SOFT,	NFSMNT_SOFT,	},
     83  1.1      maxv     {	OSF1_NFSMNT_WSIZE,	OSF1_NFSMNT_WSIZE,	NFSMNT_WSIZE,	},
     84  1.1      maxv     {	OSF1_NFSMNT_RSIZE,	OSF1_NFSMNT_RSIZE,	NFSMNT_RSIZE,	},
     85  1.1      maxv     {	OSF1_NFSMNT_TIMEO,	OSF1_NFSMNT_TIMEO,	NFSMNT_TIMEO,	},
     86  1.1      maxv     {	OSF1_NFSMNT_RETRANS,	OSF1_NFSMNT_RETRANS,	NFSMNT_RETRANS,	},
     87  1.1      maxv #if 0 /* no equivalent; needs special handling, see below */
     88  1.1      maxv     {	OSF1_NFSMNT_HOSTNAME,	OSF1_NFSMNT_HOSTNAME,	???,		},
     89  1.1      maxv #endif
     90  1.1      maxv     {	OSF1_NFSMNT_INT,	OSF1_NFSMNT_INT,	NFSMNT_INT,	},
     91  1.1      maxv     {	OSF1_NFSMNT_NOCONN,	OSF1_NFSMNT_NOCONN,	NFSMNT_NOCONN,	},
     92  1.1      maxv #if 0 /* no equivalents */
     93  1.1      maxv     {	OSF1_NFSMNT_NOAC,	OSF1_NFSMNT_NOAC,	???,		},
     94  1.1      maxv     {	OSF1_NFSMNT_ACREGMIN,	OSF1_NFSMNT_ACREGMIN,	???,		},
     95  1.1      maxv     {	OSF1_NFSMNT_ACREGMAX,	OSF1_NFSMNT_ACREGMAX,	???,		},
     96  1.1      maxv     {	OSF1_NFSMNT_ACDIRMIN,	OSF1_NFSMNT_ACDIRMIN,	???,		},
     97  1.1      maxv     {	OSF1_NFSMNT_ACDIRMAX,	OSF1_NFSMNT_ACDIRMAX,	???,		},
     98  1.1      maxv     {	OSF1_NFSMNT_NOCTO,	OSF1_NFSMNT_NOCTO,	???,		},
     99  1.1      maxv     {	OSF1_NFSMNT_POSIX,	OSF1_NFSMNT_POSIX,	???,		},
    100  1.1      maxv     {	OSF1_NFSMNT_AUTO,	OSF1_NFSMNT_AUTO,	???,		},
    101  1.1      maxv     {	OSF1_NFSMNT_SEC,	OSF1_NFSMNT_SEC,	???,		},
    102  1.1      maxv     {	OSF1_NFSMNT_TCP,	OSF1_NFSMNT_TCP,	???,		},
    103  1.1      maxv     {	OSF1_NFSMNT_PROPLIST,	OSF1_NFSMNT_PROPLIST,	???,		},
    104  1.1      maxv #endif
    105  1.1      maxv     {	0								}
    106  1.1      maxv };
    107  1.1      maxv 
    108  1.1      maxv static void
    109  1.1      maxv osf1_cvt_rusage_from_native(const struct rusage *ru, struct osf1_rusage *oru)
    110  1.1      maxv {
    111  1.1      maxv 
    112  1.1      maxv 	oru->ru_utime.tv_sec = ru->ru_utime.tv_sec;
    113  1.1      maxv 	oru->ru_utime.tv_usec = ru->ru_utime.tv_usec;
    114  1.1      maxv 
    115  1.1      maxv 	oru->ru_stime.tv_sec = ru->ru_stime.tv_sec;
    116  1.1      maxv 	oru->ru_stime.tv_usec = ru->ru_stime.tv_usec;
    117  1.1      maxv 
    118  1.1      maxv 	oru->ru_maxrss = ru->ru_maxrss;
    119  1.1      maxv 	oru->ru_ixrss = ru->ru_ixrss;
    120  1.1      maxv 	oru->ru_idrss = ru->ru_idrss;
    121  1.1      maxv 	oru->ru_isrss = ru->ru_isrss;
    122  1.1      maxv 	oru->ru_minflt = ru->ru_minflt;
    123  1.1      maxv 	oru->ru_majflt = ru->ru_majflt;
    124  1.1      maxv 	oru->ru_nswap = ru->ru_nswap;
    125  1.1      maxv 	oru->ru_inblock = ru->ru_inblock;
    126  1.1      maxv 	oru->ru_oublock = ru->ru_oublock;
    127  1.1      maxv 	oru->ru_msgsnd = ru->ru_msgsnd;
    128  1.1      maxv 	oru->ru_msgrcv = ru->ru_msgrcv;
    129  1.1      maxv 	oru->ru_nsignals = ru->ru_nsignals;
    130  1.1      maxv 	oru->ru_nvcsw = ru->ru_nvcsw;
    131  1.1      maxv 	oru->ru_nivcsw = ru->ru_nivcsw;
    132  1.1      maxv }
    133  1.1      maxv 
    134  1.1      maxv static void
    135  1.1      maxv osf1_cvt_statfs_from_native(const struct statvfs *bsfs, struct osf1_statfs *osfs)
    136  1.1      maxv {
    137  1.1      maxv 
    138  1.1      maxv 	memset(osfs, 0, sizeof (struct osf1_statfs));
    139  1.1      maxv 	if (!strncmp(MOUNT_FFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
    140  1.1      maxv 		osfs->f_type = OSF1_MOUNT_UFS;
    141  1.1      maxv 	else if (!strncmp(MOUNT_NFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
    142  1.1      maxv 		osfs->f_type = OSF1_MOUNT_NFS;
    143  1.1      maxv 	else if (!strncmp(MOUNT_MFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
    144  1.1      maxv 		osfs->f_type = OSF1_MOUNT_MFS;
    145  1.1      maxv 	else
    146  1.1      maxv 		/* uh oh...  XXX = PC, CDFS, PROCFS, etc. */
    147  1.1      maxv 		osfs->f_type = OSF1_MOUNT_ADDON;
    148  1.1      maxv 	osfs->f_flags = bsfs->f_flag;		/* XXX translate */
    149  1.1      maxv 	osfs->f_fsize = bsfs->f_frsize;
    150  1.1      maxv 	osfs->f_bsize = bsfs->f_bsize;
    151  1.1      maxv 	osfs->f_blocks = bsfs->f_blocks;
    152  1.1      maxv 	osfs->f_bfree = bsfs->f_bfree;
    153  1.1      maxv 	osfs->f_bavail = bsfs->f_bavail;
    154  1.1      maxv 	osfs->f_files = bsfs->f_files;
    155  1.1      maxv 	osfs->f_ffree = bsfs->f_ffree;
    156  1.1      maxv 	memcpy(&osfs->f_fsid, &bsfs->f_fsidx, sizeof osfs->f_fsid);
    157  1.1      maxv 	/* osfs->f_spare zeroed above */
    158  1.1      maxv 	memcpy(osfs->f_mntonname, bsfs->f_mntonname, sizeof osfs->f_mntonname);
    159  1.1      maxv 	memcpy(osfs->f_mntfromname, bsfs->f_mntfromname,
    160  1.1      maxv 	    sizeof osfs->f_mntfromname);
    161  1.1      maxv 	/* XXX osfs->f_xxx should be filled in... */
    162  1.1      maxv }
    163  1.1      maxv 
    164  1.1      maxv /* --------------------------------------------------------------------- */
    165  1.1      maxv 
    166  1.1      maxv int
    167  1.1      maxv linux_sys_osf1_wait4(struct lwp *l, const struct linux_sys_osf1_wait4_args *uap, register_t *retval)
    168  1.1      maxv {
    169  1.1      maxv 	struct osf1_rusage osf1_rusage;
    170  1.1      maxv 	struct rusage netbsd_rusage;
    171  1.1      maxv 	unsigned long leftovers;
    172  1.1      maxv 	int error, status;
    173  1.1      maxv 	int options = SCARG(uap, options);
    174  1.1      maxv 	int pid = SCARG(uap, pid);
    175  1.1      maxv 
    176  1.1      maxv 	/* translate options */
    177  1.1      maxv 	options = emul_flags_translate(osf1_wait_options_xtab,
    178  1.1      maxv 	    options, &leftovers);
    179  1.1      maxv 	if (leftovers != 0)
    180  1.1      maxv 		return (EINVAL);
    181  1.1      maxv 
    182  1.1      maxv 	error = do_sys_wait(&pid, &status, options,
    183  1.1      maxv 	    SCARG(uap, rusage) != NULL ? &netbsd_rusage : NULL);
    184  1.1      maxv 
    185  1.1      maxv 	retval[0] = pid;
    186  1.1      maxv 	if (pid == 0)
    187  1.1      maxv 		return error;
    188  1.1      maxv 
    189  1.1      maxv 	if (SCARG(uap, rusage)) {
    190  1.1      maxv 		osf1_cvt_rusage_from_native(&netbsd_rusage, &osf1_rusage);
    191  1.1      maxv 		error = copyout(&osf1_rusage, SCARG(uap, rusage),
    192  1.1      maxv 		    sizeof osf1_rusage);
    193  1.1      maxv 	}
    194  1.1      maxv 
    195  1.1      maxv 	if (error == 0 && SCARG(uap, status))
    196  1.1      maxv 		error = copyout(&status, SCARG(uap, status), sizeof(status));
    197  1.1      maxv 
    198  1.1      maxv 	return error;
    199  1.1      maxv }
    200  1.1      maxv 
    201  1.1      maxv #define	OSF1_MNT_WAIT		0x1
    202  1.1      maxv #define	OSF1_MNT_NOWAIT		0x2
    203  1.1      maxv 
    204  1.1      maxv #define	OSF1_MNT_FORCE		0x1
    205  1.1      maxv #define	OSF1_MNT_NOFORCE	0x2
    206  1.1      maxv 
    207  1.1      maxv /* acceptable flags for various calls */
    208  1.1      maxv #define	OSF1_GETFSSTAT_FLAGS	(OSF1_MNT_WAIT|OSF1_MNT_NOWAIT)
    209  1.1      maxv #define	OSF1_MOUNT_FLAGS	0xffffffff			/* XXX */
    210  1.1      maxv #define	OSF1_UNMOUNT_FLAGS	(OSF1_MNT_FORCE|OSF1_MNT_NOFORCE)
    211  1.1      maxv 
    212  1.1      maxv static int
    213  1.1      maxv osf1_mount_mfs(struct lwp *l, const struct linux_sys_osf1_mount_args *uap)
    214  1.1      maxv {
    215  1.1      maxv 	struct osf1_mfs_args osf_ma;
    216  1.1      maxv 	struct mfs_args bsd_ma;
    217  1.1      maxv 	int error;
    218  1.1      maxv 	register_t dummy;
    219  1.1      maxv 
    220  1.1      maxv 	if ((error = copyin(SCARG(uap, data), &osf_ma, sizeof osf_ma)))
    221  1.1      maxv 		return error;
    222  1.1      maxv 
    223  1.1      maxv 	memset(&bsd_ma, 0, sizeof bsd_ma);
    224  1.1      maxv 	bsd_ma.fspec = osf_ma.name;
    225  1.1      maxv 	/* XXX export args */
    226  1.1      maxv 	bsd_ma.base = osf_ma.base;
    227  1.1      maxv 	bsd_ma.size = osf_ma.size;
    228  1.1      maxv 
    229  1.1      maxv 	return do_sys_mount(l, "mfs", UIO_SYSSPACE, SCARG(uap, path),
    230  1.1      maxv 	    SCARG(uap, flags), &bsd_ma, UIO_SYSSPACE, sizeof bsd_ma, &dummy);
    231  1.1      maxv }
    232  1.1      maxv 
    233  1.1      maxv static int
    234  1.1      maxv osf1_mount_nfs(struct lwp *l, const struct linux_sys_osf1_mount_args *uap)
    235  1.1      maxv {
    236  1.1      maxv 	struct osf1_nfs_args osf_na;
    237  1.1      maxv 	struct nfs_args bsd_na;
    238  1.1      maxv 	int error;
    239  1.1      maxv 	unsigned long leftovers;
    240  1.1      maxv 	register_t dummy;
    241  1.1      maxv 
    242  1.1      maxv 	if ((error = copyin(SCARG(uap, data), &osf_na, sizeof osf_na)))
    243  1.1      maxv 		return error;
    244  1.1      maxv 
    245  1.1      maxv 	memset(&bsd_na, 0, sizeof bsd_na);
    246  1.1      maxv 	bsd_na.addr = (struct sockaddr *)osf_na.addr;
    247  1.1      maxv 	bsd_na.addrlen = sizeof (struct sockaddr_in);
    248  1.1      maxv 	bsd_na.fh = osf_na.fh;
    249  1.1      maxv 
    250  1.1      maxv         /* translate flags */
    251  1.1      maxv         bsd_na.flags = emul_flags_translate(osf1_nfs_mount_flags_xtab,
    252  1.1      maxv             osf_na.flags, &leftovers);
    253  1.1      maxv 	if (leftovers & OSF1_NFSMNT_HOSTNAME) {
    254  1.1      maxv 		leftovers &= ~OSF1_NFSMNT_HOSTNAME;
    255  1.1      maxv 		bsd_na.hostname = osf_na.hostname;
    256  1.1      maxv 	} else {
    257  1.1      maxv 		/* XXX FILL IN HOST NAME WITH IPADDR? */
    258  1.1      maxv 	}
    259  1.1      maxv 	if (leftovers & OSF1_NFSMNT_TCP) {
    260  1.1      maxv 		leftovers &= ~OSF1_NFSMNT_TCP;
    261  1.1      maxv 		bsd_na.sotype = SOCK_DGRAM;
    262  1.1      maxv 		bsd_na.proto = 0;
    263  1.1      maxv 	} else {
    264  1.1      maxv 		bsd_na.sotype = SOCK_STREAM;
    265  1.1      maxv 		bsd_na.proto = 0;
    266  1.1      maxv 	}
    267  1.1      maxv         if (leftovers != 0)
    268  1.1      maxv                 return (EINVAL);
    269  1.1      maxv 
    270  1.1      maxv 	/* copy structure elements based on flags */
    271  1.1      maxv 	if (bsd_na.flags & NFSMNT_WSIZE)
    272  1.1      maxv 		bsd_na.wsize = osf_na.wsize;
    273  1.1      maxv 	if (bsd_na.flags & NFSMNT_RSIZE)
    274  1.1      maxv 		bsd_na.rsize = osf_na.rsize;
    275  1.1      maxv 	if (bsd_na.flags & NFSMNT_TIMEO)
    276  1.1      maxv 		bsd_na.timeo = osf_na.timeo;
    277  1.1      maxv 	if (bsd_na.flags & NFSMNT_RETRANS)
    278  1.1      maxv 		bsd_na.retrans = osf_na.retrans;
    279  1.1      maxv 
    280  1.1      maxv 	return do_sys_mount(l, "nfs", UIO_SYSSPACE, SCARG(uap, path),
    281  1.1      maxv 	    SCARG(uap, flags), &bsd_na, UIO_SYSSPACE, sizeof bsd_na, &dummy);
    282  1.1      maxv }
    283  1.1      maxv 
    284  1.1      maxv int
    285  1.1      maxv linux_sys_osf1_mount(struct lwp *l, const struct linux_sys_osf1_mount_args *uap, register_t *retval)
    286  1.1      maxv {
    287  1.1      maxv 
    288  1.1      maxv 	if (SCARG(uap, flags) & ~OSF1_MOUNT_FLAGS)
    289  1.1      maxv 		return (EINVAL);
    290  1.1      maxv 
    291  1.1      maxv 	/* XXX - xlate flags */
    292  1.1      maxv 
    293  1.1      maxv 	switch (SCARG(uap, type)) {
    294  1.1      maxv 	case OSF1_MOUNT_NFS:
    295  1.1      maxv 		return osf1_mount_nfs(l, uap);
    296  1.1      maxv 		break;
    297  1.1      maxv 
    298  1.1      maxv 	case OSF1_MOUNT_MFS:
    299  1.1      maxv 		return osf1_mount_mfs(l, uap);
    300  1.1      maxv 
    301  1.1      maxv 	default:
    302  1.1      maxv 		return (EINVAL);
    303  1.1      maxv 	}
    304  1.1      maxv }
    305  1.1      maxv 
    306  1.1      maxv int
    307  1.1      maxv linux_sys_osf1_set_program_attributes(struct lwp *l, const struct linux_sys_osf1_set_program_attributes_args *uap, register_t *retval)
    308  1.1      maxv {
    309  1.1      maxv 	struct proc *p = l->l_proc;
    310  1.1      maxv 	segsz_t tsize, dsize;
    311  1.1      maxv 
    312  1.1      maxv 	tsize = btoc(SCARG(uap, tsize));
    313  1.1      maxv 	dsize = btoc(SCARG(uap, dsize));
    314  1.1      maxv 
    315  1.1      maxv 	if (dsize > p->p_rlimit[RLIMIT_DATA].rlim_cur)
    316  1.1      maxv 		return (ENOMEM);
    317  1.1      maxv 	if (tsize > MAXTSIZ)
    318  1.1      maxv 		return (ENOMEM);
    319  1.1      maxv 
    320  1.1      maxv 	/* XXXSMP unlocked */
    321  1.1      maxv 	p->p_vmspace->vm_taddr = SCARG(uap, taddr);
    322  1.1      maxv 	p->p_vmspace->vm_tsize = tsize;
    323  1.1      maxv 	p->p_vmspace->vm_daddr = SCARG(uap, daddr);
    324  1.1      maxv 	p->p_vmspace->vm_dsize = dsize;
    325  1.1      maxv 
    326  1.1      maxv 	return (0);
    327  1.1      maxv }
    328  1.1      maxv 
    329  1.1      maxv int
    330  1.1      maxv linux_sys_osf1_setitimer(struct lwp *l, const struct linux_sys_osf1_setitimer_args *uap, register_t *retval)
    331  1.1      maxv {
    332  1.1      maxv 	struct osf1_itimerval o_itv, o_oitv;
    333  1.1      maxv 	struct itimerval b_itv, b_oitv;
    334  1.1      maxv 	int which;
    335  1.1      maxv 	int error;
    336  1.1      maxv 
    337  1.1      maxv 	switch (SCARG(uap, which)) {
    338  1.1      maxv 	case OSF1_ITIMER_REAL:
    339  1.1      maxv 		which = ITIMER_REAL;
    340  1.1      maxv 		break;
    341  1.1      maxv 
    342  1.1      maxv 	case OSF1_ITIMER_VIRTUAL:
    343  1.1      maxv 		which = ITIMER_VIRTUAL;
    344  1.1      maxv 		break;
    345  1.1      maxv 
    346  1.1      maxv 	case OSF1_ITIMER_PROF:
    347  1.1      maxv 		which = ITIMER_PROF;
    348  1.1      maxv 		break;
    349  1.1      maxv 
    350  1.1      maxv 	default:
    351  1.1      maxv 		return (EINVAL);
    352  1.1      maxv 	}
    353  1.1      maxv 
    354  1.1      maxv 	/* get the OSF/1 itimerval argument */
    355  1.1      maxv 	error = copyin(SCARG(uap, itv), &o_itv, sizeof o_itv);
    356  1.1      maxv 	if (error != 0)
    357  1.1      maxv 		return error;
    358  1.1      maxv 
    359  1.1      maxv 	/* fill in and the NetBSD timeval */
    360  1.1      maxv 	memset(&b_itv, 0, sizeof b_itv);
    361  1.1      maxv 	b_itv.it_interval.tv_sec = o_itv.it_interval.tv_sec;
    362  1.1      maxv 	b_itv.it_interval.tv_usec = o_itv.it_interval.tv_usec;
    363  1.1      maxv 	b_itv.it_value.tv_sec = o_itv.it_value.tv_sec;
    364  1.1      maxv 	b_itv.it_value.tv_usec = o_itv.it_value.tv_usec;
    365  1.1      maxv 
    366  1.1      maxv 	if (SCARG(uap, oitv) != NULL) {
    367  1.1      maxv 		dogetitimer(l->l_proc, which, &b_oitv);
    368  1.1      maxv 		if (error)
    369  1.1      maxv 			return error;
    370  1.1      maxv 	}
    371  1.1      maxv 
    372  1.1      maxv 	error = dosetitimer(l->l_proc, which, &b_itv);
    373  1.1      maxv 
    374  1.1      maxv 	if (error == 0 || SCARG(uap, oitv) == NULL)
    375  1.1      maxv 		return error;
    376  1.1      maxv 
    377  1.1      maxv 	/* fill in and copy out the old timeval */
    378  1.1      maxv 	memset(&o_oitv, 0, sizeof o_oitv);
    379  1.1      maxv 	o_oitv.it_interval.tv_sec = b_oitv.it_interval.tv_sec;
    380  1.1      maxv 	o_oitv.it_interval.tv_usec = b_oitv.it_interval.tv_usec;
    381  1.1      maxv 	o_oitv.it_value.tv_sec = b_oitv.it_value.tv_sec;
    382  1.1      maxv 	o_oitv.it_value.tv_usec = b_oitv.it_value.tv_usec;
    383  1.1      maxv 
    384  1.1      maxv 	return copyout(&o_oitv, SCARG(uap, oitv), sizeof o_oitv);
    385  1.1      maxv }
    386  1.1      maxv 
    387  1.1      maxv int
    388  1.1      maxv linux_sys_osf1_select(struct lwp *l, const struct linux_sys_osf1_select_args *uap,
    389  1.1      maxv     register_t *retval)
    390  1.1      maxv {
    391  1.1      maxv 	struct osf1_timeval otv;
    392  1.1      maxv 	struct timespec ats, *ts = NULL;
    393  1.1      maxv 	int error;
    394  1.1      maxv 
    395  1.1      maxv 	if (SCARG(uap, tv)) {
    396  1.1      maxv 		/* get the OSF/1 timeval argument */
    397  1.1      maxv 		error = copyin(SCARG(uap, tv), &otv, sizeof otv);
    398  1.1      maxv 		if (error != 0)
    399  1.1      maxv 			return error;
    400  1.1      maxv 
    401  1.1      maxv 		ats.tv_sec = otv.tv_sec;
    402  1.1      maxv 		ats.tv_nsec = otv.tv_usec * 1000;
    403  1.1      maxv 		ts = &ats;
    404  1.1      maxv 	}
    405  1.1      maxv 
    406  1.1      maxv 	return selcommon(retval, SCARG(uap, nd), SCARG(uap, in),
    407  1.1      maxv 	    SCARG(uap, ou), SCARG(uap, ex), ts, NULL);
    408  1.1      maxv }
    409  1.1      maxv 
    410  1.1      maxv int
    411  1.1      maxv linux_sys_osf1_gettimeofday(struct lwp *l, const struct linux_sys_osf1_gettimeofday_args *uap, register_t *retval)
    412  1.1      maxv {
    413  1.1      maxv 	struct osf1_timeval otv;
    414  1.1      maxv 	struct osf1_timezone otz;
    415  1.1      maxv 	struct timeval tv;
    416  1.1      maxv 	int error;
    417  1.1      maxv 
    418  1.1      maxv 	microtime(&tv);
    419  1.1      maxv 	memset(&otv, 0, sizeof otv);
    420  1.1      maxv 	otv.tv_sec = tv.tv_sec;
    421  1.1      maxv 	otv.tv_usec = tv.tv_usec;
    422  1.2  christos 	error = copyout(&otv, SCARG(uap, tv), sizeof otv);
    423  1.1      maxv 
    424  1.1      maxv 	if (error == 0 && SCARG(uap, tzp) != NULL) {
    425  1.1      maxv 		memset(&otz, 0, sizeof otz);
    426  1.1      maxv 		error = copyout(&otz, SCARG(uap, tzp), sizeof otz);
    427  1.1      maxv 	}
    428  1.1      maxv 	return (error);
    429  1.1      maxv }
    430  1.1      maxv 
    431  1.1      maxv int
    432  1.1      maxv linux_sys_osf1_getrusage(struct lwp *l, const struct linux_sys_osf1_getrusage_args *uap, register_t *retval)
    433  1.1      maxv {
    434  1.1      maxv 	int error, who;
    435  1.1      maxv 	struct osf1_rusage osf1_rusage;
    436  1.1      maxv 	struct rusage ru;
    437  1.1      maxv 	struct proc *p = l->l_proc;
    438  1.1      maxv 
    439  1.1      maxv 
    440  1.1      maxv 	switch (SCARG(uap, who)) {
    441  1.1      maxv 	case OSF1_RUSAGE_SELF:
    442  1.1      maxv 		who = RUSAGE_SELF;
    443  1.1      maxv 		break;
    444  1.1      maxv 
    445  1.1      maxv 	case OSF1_RUSAGE_CHILDREN:
    446  1.1      maxv 		who = RUSAGE_CHILDREN;
    447  1.1      maxv 		break;
    448  1.1      maxv 
    449  1.1      maxv 	case OSF1_RUSAGE_THREAD:		/* XXX not supported */
    450  1.1      maxv 	default:
    451  1.1      maxv 		return EINVAL;
    452  1.1      maxv 	}
    453  1.1      maxv 
    454  1.1      maxv 	error = getrusage1(p, who, &ru);
    455  1.1      maxv 	if (error != 0)
    456  1.1      maxv 		return error;
    457  1.1      maxv 
    458  1.1      maxv 	osf1_cvt_rusage_from_native(&ru, &osf1_rusage);
    459  1.1      maxv 
    460  1.1      maxv 	return copyout(&osf1_rusage, SCARG(uap, rusage), sizeof osf1_rusage);
    461  1.1      maxv }
    462  1.1      maxv 
    463  1.1      maxv int
    464  1.1      maxv linux_sys_osf1_settimeofday(struct lwp *l, const struct linux_sys_osf1_settimeofday_args *uap, register_t *retval)
    465  1.1      maxv {
    466  1.1      maxv 	struct osf1_timeval otv;
    467  1.1      maxv 	struct timeval tv, *tvp;
    468  1.1      maxv 	int error = 0;
    469  1.1      maxv 
    470  1.1      maxv 	if (SCARG(uap, tv) == NULL)
    471  1.1      maxv 		tvp = NULL;
    472  1.1      maxv 	else {
    473  1.1      maxv 		/* get the OSF/1 timeval argument */
    474  1.1      maxv 		error = copyin(SCARG(uap, tv), &otv, sizeof otv);
    475  1.1      maxv 		if (error != 0)
    476  1.1      maxv 			return error;
    477  1.1      maxv 
    478  1.1      maxv 		tv.tv_sec = otv.tv_sec;
    479  1.1      maxv 		tv.tv_usec = otv.tv_usec;
    480  1.1      maxv 		tvp = &tv;
    481  1.1      maxv 	}
    482  1.1      maxv 
    483  1.1      maxv 	/* NetBSD ignores the timezone field */
    484  1.1      maxv 
    485  1.1      maxv 	return settimeofday1(tvp, false, (const void *)SCARG(uap, tzp), l, true);
    486  1.1      maxv }
    487  1.1      maxv 
    488  1.1      maxv int
    489  1.1      maxv linux_sys_osf1_utimes(struct lwp *l, const struct linux_sys_osf1_utimes_args *uap, register_t *retval)
    490  1.1      maxv {
    491  1.1      maxv 	struct osf1_timeval otv;
    492  1.1      maxv 	struct timeval tv[2], *tvp;
    493  1.1      maxv 	int error;
    494  1.1      maxv 
    495  1.1      maxv 	if (SCARG(uap, tptr) == NULL)
    496  1.1      maxv 		tvp = NULL;
    497  1.1      maxv 	else {
    498  1.1      maxv 		/* get the OSF/1 timeval argument */
    499  1.1      maxv 		error = copyin(SCARG(uap, tptr), &otv, sizeof otv);
    500  1.1      maxv 		if (error != 0)
    501  1.1      maxv 			return error;
    502  1.1      maxv 
    503  1.1      maxv 		/* fill in and copy out the NetBSD timeval */
    504  1.1      maxv 		tv[0].tv_sec = otv.tv_sec;
    505  1.1      maxv 		tv[0].tv_usec = otv.tv_usec;
    506  1.1      maxv 		/* Set access and modified to the same time */
    507  1.1      maxv 		tv[1].tv_sec = otv.tv_sec;
    508  1.1      maxv 		tv[1].tv_usec = otv.tv_usec;
    509  1.1      maxv 		tvp = tv;
    510  1.1      maxv 	}
    511  1.1      maxv 
    512  1.1      maxv 	return do_sys_utimes(l, NULL, SCARG(uap, path), FOLLOW,
    513  1.1      maxv 			    tvp, UIO_SYSSPACE);
    514  1.1      maxv }
    515  1.1      maxv 
    516  1.1      maxv int
    517  1.1      maxv linux_sys_osf1_statfs(struct lwp *l, const struct linux_sys_osf1_statfs_args *uap, register_t *retval)
    518  1.1      maxv {
    519  1.1      maxv 	struct mount *mp;
    520  1.1      maxv 	struct statvfs *sp;
    521  1.1      maxv 	struct osf1_statfs osfs;
    522  1.1      maxv 	int error;
    523  1.1      maxv 	struct vnode *vp;
    524  1.1      maxv 
    525  1.1      maxv 	error = namei_simple_user(SCARG(uap, path),
    526  1.1      maxv 				NSM_FOLLOW_TRYEMULROOT, &vp);
    527  1.1      maxv 	if (error != 0)
    528  1.1      maxv 		return (error);
    529  1.1      maxv 	mp = vp->v_mount;
    530  1.1      maxv 	sp = &mp->mnt_stat;
    531  1.1      maxv 	vrele(vp);
    532  1.1      maxv 	if ((error = VFS_STATVFS(mp, sp)))
    533  1.1      maxv 		return (error);
    534  1.1      maxv 	sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
    535  1.1      maxv 	osf1_cvt_statfs_from_native(sp, &osfs);
    536  1.1      maxv 	return copyout(&osfs, SCARG(uap, buf), uimin(sizeof osfs,
    537  1.1      maxv 	    SCARG(uap, len)));
    538  1.1      maxv }
    539  1.1      maxv 
    540  1.1      maxv int
    541  1.1      maxv linux_sys_osf1_fstatfs(struct lwp *l, const struct linux_sys_osf1_fstatfs_args *uap, register_t *retval)
    542  1.1      maxv {
    543  1.1      maxv 	file_t *fp;
    544  1.1      maxv 	struct mount *mp;
    545  1.1      maxv 	struct statvfs *sp;
    546  1.1      maxv 	struct osf1_statfs osfs;
    547  1.1      maxv 	int error;
    548  1.1      maxv 
    549  1.1      maxv 	/* fd_getvnode() will use the descriptor for us */
    550  1.1      maxv 	if ((error = fd_getvnode(SCARG(uap, fd), &fp)))
    551  1.1      maxv 		return (error);
    552  1.1      maxv 	mp = fp->f_vnode->v_mount;
    553  1.1      maxv 	sp = &mp->mnt_stat;
    554  1.1      maxv 	if ((error = VFS_STATVFS(mp, sp)))
    555  1.1      maxv 		goto out;
    556  1.1      maxv 	sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
    557  1.1      maxv 	osf1_cvt_statfs_from_native(sp, &osfs);
    558  1.1      maxv 	error = copyout(&osfs, SCARG(uap, buf), uimin(sizeof osfs,
    559  1.1      maxv 	    SCARG(uap, len)));
    560  1.1      maxv  out:
    561  1.1      maxv  	fd_putfile(SCARG(uap, fd));
    562  1.1      maxv 	return (error);
    563  1.1      maxv }
    564  1.1      maxv 
    565  1.1      maxv int
    566  1.1      maxv linux_sys_osf1_sysinfo(struct lwp *l, const struct linux_sys_osf1_sysinfo_args *uap, register_t *retval)
    567  1.1      maxv {
    568  1.1      maxv 	const char *string;
    569  1.1      maxv 	size_t slen;
    570  1.1      maxv 	int error;
    571  1.1      maxv 
    572  1.1      maxv 	error = 0;
    573  1.1      maxv 	switch (SCARG(uap, cmd)) {
    574  1.1      maxv 	case OSF1_SI_SYSNAME:
    575  1.1      maxv 		string = ostype;
    576  1.1      maxv 		break;
    577  1.1      maxv 
    578  1.1      maxv 	case OSF1_SI_HOSTNAME:
    579  1.1      maxv 		string = hostname;
    580  1.1      maxv 		break;
    581  1.1      maxv 
    582  1.1      maxv 	case OSF1_SI_RELEASE:
    583  1.1      maxv 		string = osrelease;
    584  1.1      maxv 		break;
    585  1.1      maxv 
    586  1.1      maxv 	case OSF1_SI_VERSION:
    587  1.1      maxv 		goto should_handle;
    588  1.1      maxv 
    589  1.1      maxv 	case OSF1_SI_MACHINE:
    590  1.1      maxv 		string = MACHINE;
    591  1.1      maxv 		break;
    592  1.1      maxv 
    593  1.1      maxv 	case OSF1_SI_ARCHITECTURE:
    594  1.1      maxv 		string = MACHINE_ARCH;
    595  1.1      maxv 		break;
    596  1.1      maxv 
    597  1.1      maxv 	case OSF1_SI_HW_SERIAL:
    598  1.1      maxv 		string = "666";			/* OSF/1 emulation?  YES! */
    599  1.1      maxv 		break;
    600  1.1      maxv 
    601  1.1      maxv 	case OSF1_SI_HW_PROVIDER:
    602  1.1      maxv 		string = "unknown";
    603  1.1      maxv 		break;
    604  1.1      maxv 
    605  1.1      maxv 	case OSF1_SI_SRPC_DOMAIN:
    606  1.1      maxv 		goto dont_care;
    607  1.1      maxv 
    608  1.1      maxv 	case OSF1_SI_SET_HOSTNAME:
    609  1.1      maxv 		goto should_handle;
    610  1.1      maxv 
    611  1.1      maxv 	case OSF1_SI_SET_SYSNAME:
    612  1.1      maxv 		goto should_handle;
    613  1.1      maxv 
    614  1.1      maxv 	case OSF1_SI_SET_SRPC_DOMAIN:
    615  1.1      maxv 		goto dont_care;
    616  1.1      maxv 
    617  1.1      maxv 	default:
    618  1.1      maxv should_handle:
    619  1.1      maxv 		printf("osf1_sys_sysinfo(%d, %p, 0x%lx)\n", SCARG(uap, cmd),
    620  1.1      maxv 		    SCARG(uap, buf), SCARG(uap,len));
    621  1.1      maxv dont_care:
    622  1.1      maxv 		return (EINVAL);
    623  1.1      maxv 	};
    624  1.1      maxv 
    625  1.1      maxv 	slen = strlen(string) + 1;
    626  1.1      maxv 	if (SCARG(uap, buf)) {
    627  1.1      maxv 		error = copyout(string, SCARG(uap, buf),
    628  1.1      maxv 				uimin(slen, SCARG(uap, len)));
    629  1.1      maxv 		if (!error && (SCARG(uap, len) > 0) && (SCARG(uap, len) < slen))
    630  1.3   thorpej 			error = ustore_char(SCARG(uap, buf)
    631  1.3   thorpej 					    + SCARG(uap, len) - 1, 0);
    632  1.1      maxv 	}
    633  1.1      maxv 	if (!error)
    634  1.1      maxv 		retval[0] = slen;
    635  1.1      maxv 
    636  1.1      maxv 	return (error);
    637  1.1      maxv }
    638  1.1      maxv 
    639  1.1      maxv int
    640  1.1      maxv linux_sys_osf1_usleep_thread(struct lwp *l, const struct linux_sys_osf1_usleep_thread_args *uap, register_t *retval)
    641  1.1      maxv {
    642  1.1      maxv 	struct osf1_timeval otv, endotv;
    643  1.1      maxv 	struct timeval tv, ntv, endtv;
    644  1.1      maxv 	u_long ticks;
    645  1.1      maxv 	int error;
    646  1.1      maxv 
    647  1.1      maxv 	if ((error = copyin(SCARG(uap, sleep), &otv, sizeof otv)))
    648  1.1      maxv 		return (error);
    649  1.1      maxv 	tv.tv_sec = otv.tv_sec;
    650  1.1      maxv 	tv.tv_usec = otv.tv_usec;
    651  1.1      maxv 
    652  1.1      maxv 	ticks = howmany((u_long)tv.tv_sec * 1000000 + tv.tv_usec, tick);
    653  1.1      maxv 	if (ticks == 0)
    654  1.1      maxv 		ticks = 1;
    655  1.1      maxv 
    656  1.1      maxv 	getmicrotime(&tv);
    657  1.1      maxv 
    658  1.1      maxv 	tsleep(l, PUSER|PCATCH, "uslpthrd", ticks);	/* XXX */
    659  1.1      maxv 
    660  1.1      maxv 	if (SCARG(uap, slept) != NULL) {
    661  1.1      maxv 		getmicrotime(&ntv);
    662  1.1      maxv 		timersub(&ntv, &tv, &endtv);
    663  1.1      maxv 		if (endtv.tv_sec < 0 || endtv.tv_usec < 0)
    664  1.1      maxv 			endtv.tv_sec = endtv.tv_usec = 0;
    665  1.1      maxv 
    666  1.1      maxv 		endotv.tv_sec = endtv.tv_sec;
    667  1.1      maxv 		endotv.tv_usec = endtv.tv_usec;
    668  1.1      maxv 		error = copyout(&endotv, SCARG(uap, slept), sizeof endotv);
    669  1.1      maxv 	}
    670  1.1      maxv 	return (error);
    671  1.1      maxv }
    672  1.1      maxv 
    673  1.1      maxv int
    674  1.1      maxv linux_sys_osf1_getsysinfo(struct lwp *l, const struct linux_sys_osf1_getsysinfo_args *uap, register_t *retval)
    675  1.1      maxv {
    676  1.1      maxv 	extern int ncpus;
    677  1.1      maxv 	int error;
    678  1.1      maxv 	int unit;
    679  1.1      maxv 	long percpu;
    680  1.1      maxv 	long proctype;
    681  1.1      maxv 	u_int64_t fpflags;
    682  1.1      maxv 	struct osf1_cpu_info cpuinfo;
    683  1.1      maxv 	const void *data;
    684  1.1      maxv 	size_t datalen;
    685  1.1      maxv 
    686  1.1      maxv 	error = 0;
    687  1.1      maxv 
    688  1.1      maxv 	switch(SCARG(uap, op))
    689  1.1      maxv 	{
    690  1.1      maxv 	case OSF_GET_MAX_UPROCS:
    691  1.1      maxv 		data = &maxproc;
    692  1.1      maxv 		datalen = sizeof(maxproc);
    693  1.1      maxv 		break;
    694  1.1      maxv 	case OSF_GET_PHYSMEM:
    695  1.1      maxv 		data = &physmem;
    696  1.1      maxv 		datalen = sizeof(physmem);
    697  1.1      maxv 		break;
    698  1.1      maxv 	case OSF_GET_MAX_CPU:
    699  1.1      maxv 	case OSF_GET_CPUS_IN_BOX:
    700  1.1      maxv 		data = &ncpus;
    701  1.1      maxv 		datalen = sizeof(ncpus);
    702  1.1      maxv 		break;
    703  1.1      maxv 	case OSF_GET_IEEE_FP_CONTROL:
    704  1.1      maxv 		if (((fpflags = alpha_read_fp_c(l)) & IEEE_INHERIT) != 0) {
    705  1.1      maxv 			fpflags |= 1ULL << 63;
    706  1.1      maxv 			fpflags &= ~IEEE_INHERIT;
    707  1.1      maxv 		}
    708  1.1      maxv 		data = &fpflags;
    709  1.1      maxv 		datalen = sizeof(fpflags);
    710  1.1      maxv 		break;
    711  1.1      maxv 	case OSF_GET_CPU_INFO:
    712  1.1      maxv 		memset(&cpuinfo, 0, sizeof(cpuinfo));
    713  1.1      maxv #ifdef __alpha__
    714  1.1      maxv 		unit = alpha_pal_whami();
    715  1.1      maxv #else
    716  1.1      maxv 		unit = 0; /* XXX */
    717  1.1      maxv #endif
    718  1.1      maxv 		cpuinfo.current_cpu = unit;
    719  1.1      maxv 		cpuinfo.cpus_in_box = ncpus;
    720  1.1      maxv 		cpuinfo.cpu_type = LOCATE_PCS(hwrpb, unit)->pcs_proc_type;
    721  1.1      maxv 		cpuinfo.ncpus = ncpus;
    722  1.1      maxv 		cpuinfo.cpus_present = ncpus;
    723  1.1      maxv 		cpuinfo.cpus_running = ncpus;
    724  1.1      maxv 		cpuinfo.cpu_binding = 1;
    725  1.1      maxv 		cpuinfo.cpu_ex_binding = 0;
    726  1.1      maxv 		cpuinfo.mhz = hwrpb->rpb_cc_freq / 1000000;
    727  1.1      maxv 		data = &cpuinfo;
    728  1.1      maxv 		datalen = sizeof(cpuinfo);
    729  1.1      maxv 		break;
    730  1.1      maxv 	case OSF_GET_PROC_TYPE:
    731  1.1      maxv #ifdef __alpha__
    732  1.1      maxv 		unit = alpha_pal_whami();
    733  1.1      maxv 		proctype = LOCATE_PCS(hwrpb, unit)->pcs_proc_type;
    734  1.1      maxv #else
    735  1.1      maxv 		proctype = 0;	/* XXX */
    736  1.1      maxv #endif
    737  1.1      maxv 		data = &proctype;
    738  1.1      maxv 		datalen = sizeof(percpu);
    739  1.1      maxv 		break;
    740  1.1      maxv 	case OSF_GET_HWRPB: /* note -- osf/1 doesn't have rpb_tbhint[8] */
    741  1.1      maxv 		data = hwrpb;
    742  1.1      maxv 		datalen = hwrpb->rpb_size;
    743  1.1      maxv 		break;
    744  1.1      maxv 	case OSF_GET_PLATFORM_NAME:
    745  1.1      maxv 		data = platform.model;
    746  1.1      maxv 		datalen = strlen(platform.model) + 1;
    747  1.1      maxv 		break;
    748  1.1      maxv 	default:
    749  1.1      maxv 		printf("osf1_getsysinfo called with unknown op=%ld\n",
    750  1.1      maxv 		       SCARG(uap, op));
    751  1.1      maxv 		/* return EINVAL; */
    752  1.1      maxv 		return 0;
    753  1.1      maxv 	}
    754  1.1      maxv 
    755  1.1      maxv 	if (SCARG(uap, nbytes) < datalen)
    756  1.1      maxv 		return (EINVAL);
    757  1.1      maxv 	error = copyout(data, SCARG(uap, buffer), datalen);
    758  1.1      maxv 	if (!error)
    759  1.1      maxv 		retval[0] = 1;
    760  1.1      maxv 	return (error);
    761  1.1      maxv }
    762  1.1      maxv 
    763  1.1      maxv int
    764  1.1      maxv linux_sys_osf1_setsysinfo(struct lwp *l, const struct linux_sys_osf1_setsysinfo_args *uap, register_t *retval)
    765  1.1      maxv {
    766  1.1      maxv 	u_int64_t temp;
    767  1.1      maxv 	int error;
    768  1.1      maxv 
    769  1.1      maxv 	error = 0;
    770  1.1      maxv 
    771  1.1      maxv 	switch(SCARG(uap, op)) {
    772  1.1      maxv 	case OSF_SET_IEEE_FP_CONTROL:
    773  1.1      maxv 
    774  1.1      maxv 		if ((error = copyin(SCARG(uap, buffer), &temp, sizeof(temp))))
    775  1.1      maxv 			break;
    776  1.1      maxv 		if (temp >> 63 != 0)
    777  1.1      maxv 			temp |= IEEE_INHERIT;
    778  1.1      maxv 		alpha_write_fp_c(l, temp);
    779  1.1      maxv 		break;
    780  1.1      maxv 	default:
    781  1.1      maxv 		uprintf("osf1_setsysinfo called with op=%ld\n", SCARG(uap, op));
    782  1.1      maxv 		//error = EINVAL;
    783  1.1      maxv 	}
    784  1.1      maxv 	retval[0] = 0;
    785  1.1      maxv 	return (error);
    786  1.1      maxv }
    787