Home | History | Annotate | Line # | Download | only in alpha
linux_osf1.c revision 1.3.6.1
      1  1.3.6.1    martin /*	$NetBSD: linux_osf1.c,v 1.3.6.1 2022/08/03 11:11:33 martin 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.6.1    martin __KERNEL_RCSID(0, "$NetBSD: linux_osf1.c,v 1.3.6.1 2022/08/03 11:11:33 martin 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.3.6.1    martin 	memset(oru, 0, sizeof(*oru));
    113  1.3.6.1    martin 
    114      1.1      maxv 	oru->ru_utime.tv_sec = ru->ru_utime.tv_sec;
    115      1.1      maxv 	oru->ru_utime.tv_usec = ru->ru_utime.tv_usec;
    116      1.1      maxv 
    117      1.1      maxv 	oru->ru_stime.tv_sec = ru->ru_stime.tv_sec;
    118      1.1      maxv 	oru->ru_stime.tv_usec = ru->ru_stime.tv_usec;
    119      1.1      maxv 
    120      1.1      maxv 	oru->ru_maxrss = ru->ru_maxrss;
    121      1.1      maxv 	oru->ru_ixrss = ru->ru_ixrss;
    122      1.1      maxv 	oru->ru_idrss = ru->ru_idrss;
    123      1.1      maxv 	oru->ru_isrss = ru->ru_isrss;
    124      1.1      maxv 	oru->ru_minflt = ru->ru_minflt;
    125      1.1      maxv 	oru->ru_majflt = ru->ru_majflt;
    126      1.1      maxv 	oru->ru_nswap = ru->ru_nswap;
    127      1.1      maxv 	oru->ru_inblock = ru->ru_inblock;
    128      1.1      maxv 	oru->ru_oublock = ru->ru_oublock;
    129      1.1      maxv 	oru->ru_msgsnd = ru->ru_msgsnd;
    130      1.1      maxv 	oru->ru_msgrcv = ru->ru_msgrcv;
    131      1.1      maxv 	oru->ru_nsignals = ru->ru_nsignals;
    132      1.1      maxv 	oru->ru_nvcsw = ru->ru_nvcsw;
    133      1.1      maxv 	oru->ru_nivcsw = ru->ru_nivcsw;
    134      1.1      maxv }
    135      1.1      maxv 
    136      1.1      maxv static void
    137      1.1      maxv osf1_cvt_statfs_from_native(const struct statvfs *bsfs, struct osf1_statfs *osfs)
    138      1.1      maxv {
    139      1.1      maxv 
    140  1.3.6.1    martin 	memset(osfs, 0, sizeof(*osfs));
    141      1.1      maxv 	if (!strncmp(MOUNT_FFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
    142      1.1      maxv 		osfs->f_type = OSF1_MOUNT_UFS;
    143      1.1      maxv 	else if (!strncmp(MOUNT_NFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
    144      1.1      maxv 		osfs->f_type = OSF1_MOUNT_NFS;
    145      1.1      maxv 	else if (!strncmp(MOUNT_MFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
    146      1.1      maxv 		osfs->f_type = OSF1_MOUNT_MFS;
    147      1.1      maxv 	else
    148      1.1      maxv 		/* uh oh...  XXX = PC, CDFS, PROCFS, etc. */
    149      1.1      maxv 		osfs->f_type = OSF1_MOUNT_ADDON;
    150      1.1      maxv 	osfs->f_flags = bsfs->f_flag;		/* XXX translate */
    151      1.1      maxv 	osfs->f_fsize = bsfs->f_frsize;
    152      1.1      maxv 	osfs->f_bsize = bsfs->f_bsize;
    153      1.1      maxv 	osfs->f_blocks = bsfs->f_blocks;
    154      1.1      maxv 	osfs->f_bfree = bsfs->f_bfree;
    155      1.1      maxv 	osfs->f_bavail = bsfs->f_bavail;
    156      1.1      maxv 	osfs->f_files = bsfs->f_files;
    157      1.1      maxv 	osfs->f_ffree = bsfs->f_ffree;
    158      1.1      maxv 	memcpy(&osfs->f_fsid, &bsfs->f_fsidx, sizeof osfs->f_fsid);
    159      1.1      maxv 	/* osfs->f_spare zeroed above */
    160      1.1      maxv 	memcpy(osfs->f_mntonname, bsfs->f_mntonname, sizeof osfs->f_mntonname);
    161      1.1      maxv 	memcpy(osfs->f_mntfromname, bsfs->f_mntfromname,
    162      1.1      maxv 	    sizeof osfs->f_mntfromname);
    163      1.1      maxv 	/* XXX osfs->f_xxx should be filled in... */
    164      1.1      maxv }
    165      1.1      maxv 
    166      1.1      maxv /* --------------------------------------------------------------------- */
    167      1.1      maxv 
    168      1.1      maxv int
    169      1.1      maxv linux_sys_osf1_wait4(struct lwp *l, const struct linux_sys_osf1_wait4_args *uap, register_t *retval)
    170      1.1      maxv {
    171      1.1      maxv 	struct osf1_rusage osf1_rusage;
    172      1.1      maxv 	struct rusage netbsd_rusage;
    173      1.1      maxv 	unsigned long leftovers;
    174      1.1      maxv 	int error, status;
    175      1.1      maxv 	int options = SCARG(uap, options);
    176      1.1      maxv 	int pid = SCARG(uap, pid);
    177      1.1      maxv 
    178      1.1      maxv 	/* translate options */
    179      1.1      maxv 	options = emul_flags_translate(osf1_wait_options_xtab,
    180      1.1      maxv 	    options, &leftovers);
    181      1.1      maxv 	if (leftovers != 0)
    182      1.1      maxv 		return (EINVAL);
    183      1.1      maxv 
    184      1.1      maxv 	error = do_sys_wait(&pid, &status, options,
    185      1.1      maxv 	    SCARG(uap, rusage) != NULL ? &netbsd_rusage : NULL);
    186      1.1      maxv 
    187      1.1      maxv 	retval[0] = pid;
    188      1.1      maxv 	if (pid == 0)
    189      1.1      maxv 		return error;
    190      1.1      maxv 
    191      1.1      maxv 	if (SCARG(uap, rusage)) {
    192      1.1      maxv 		osf1_cvt_rusage_from_native(&netbsd_rusage, &osf1_rusage);
    193      1.1      maxv 		error = copyout(&osf1_rusage, SCARG(uap, rusage),
    194      1.1      maxv 		    sizeof osf1_rusage);
    195      1.1      maxv 	}
    196      1.1      maxv 
    197      1.1      maxv 	if (error == 0 && SCARG(uap, status))
    198      1.1      maxv 		error = copyout(&status, SCARG(uap, status), sizeof(status));
    199      1.1      maxv 
    200      1.1      maxv 	return error;
    201      1.1      maxv }
    202      1.1      maxv 
    203      1.1      maxv #define	OSF1_MNT_WAIT		0x1
    204      1.1      maxv #define	OSF1_MNT_NOWAIT		0x2
    205      1.1      maxv 
    206      1.1      maxv #define	OSF1_MNT_FORCE		0x1
    207      1.1      maxv #define	OSF1_MNT_NOFORCE	0x2
    208      1.1      maxv 
    209      1.1      maxv /* acceptable flags for various calls */
    210      1.1      maxv #define	OSF1_GETFSSTAT_FLAGS	(OSF1_MNT_WAIT|OSF1_MNT_NOWAIT)
    211      1.1      maxv #define	OSF1_MOUNT_FLAGS	0xffffffff			/* XXX */
    212      1.1      maxv #define	OSF1_UNMOUNT_FLAGS	(OSF1_MNT_FORCE|OSF1_MNT_NOFORCE)
    213      1.1      maxv 
    214      1.1      maxv static int
    215      1.1      maxv osf1_mount_mfs(struct lwp *l, const struct linux_sys_osf1_mount_args *uap)
    216      1.1      maxv {
    217      1.1      maxv 	struct osf1_mfs_args osf_ma;
    218      1.1      maxv 	struct mfs_args bsd_ma;
    219      1.1      maxv 	int error;
    220      1.1      maxv 	register_t dummy;
    221      1.1      maxv 
    222      1.1      maxv 	if ((error = copyin(SCARG(uap, data), &osf_ma, sizeof osf_ma)))
    223      1.1      maxv 		return error;
    224      1.1      maxv 
    225      1.1      maxv 	memset(&bsd_ma, 0, sizeof bsd_ma);
    226      1.1      maxv 	bsd_ma.fspec = osf_ma.name;
    227      1.1      maxv 	/* XXX export args */
    228      1.1      maxv 	bsd_ma.base = osf_ma.base;
    229      1.1      maxv 	bsd_ma.size = osf_ma.size;
    230      1.1      maxv 
    231      1.1      maxv 	return do_sys_mount(l, "mfs", UIO_SYSSPACE, SCARG(uap, path),
    232      1.1      maxv 	    SCARG(uap, flags), &bsd_ma, UIO_SYSSPACE, sizeof bsd_ma, &dummy);
    233      1.1      maxv }
    234      1.1      maxv 
    235      1.1      maxv static int
    236      1.1      maxv osf1_mount_nfs(struct lwp *l, const struct linux_sys_osf1_mount_args *uap)
    237      1.1      maxv {
    238      1.1      maxv 	struct osf1_nfs_args osf_na;
    239      1.1      maxv 	struct nfs_args bsd_na;
    240      1.1      maxv 	int error;
    241      1.1      maxv 	unsigned long leftovers;
    242      1.1      maxv 	register_t dummy;
    243      1.1      maxv 
    244      1.1      maxv 	if ((error = copyin(SCARG(uap, data), &osf_na, sizeof osf_na)))
    245      1.1      maxv 		return error;
    246      1.1      maxv 
    247      1.1      maxv 	memset(&bsd_na, 0, sizeof bsd_na);
    248      1.1      maxv 	bsd_na.addr = (struct sockaddr *)osf_na.addr;
    249      1.1      maxv 	bsd_na.addrlen = sizeof (struct sockaddr_in);
    250      1.1      maxv 	bsd_na.fh = osf_na.fh;
    251      1.1      maxv 
    252      1.1      maxv         /* translate flags */
    253      1.1      maxv         bsd_na.flags = emul_flags_translate(osf1_nfs_mount_flags_xtab,
    254      1.1      maxv             osf_na.flags, &leftovers);
    255      1.1      maxv 	if (leftovers & OSF1_NFSMNT_HOSTNAME) {
    256      1.1      maxv 		leftovers &= ~OSF1_NFSMNT_HOSTNAME;
    257      1.1      maxv 		bsd_na.hostname = osf_na.hostname;
    258      1.1      maxv 	} else {
    259      1.1      maxv 		/* XXX FILL IN HOST NAME WITH IPADDR? */
    260      1.1      maxv 	}
    261      1.1      maxv 	if (leftovers & OSF1_NFSMNT_TCP) {
    262      1.1      maxv 		leftovers &= ~OSF1_NFSMNT_TCP;
    263      1.1      maxv 		bsd_na.sotype = SOCK_DGRAM;
    264      1.1      maxv 		bsd_na.proto = 0;
    265      1.1      maxv 	} else {
    266      1.1      maxv 		bsd_na.sotype = SOCK_STREAM;
    267      1.1      maxv 		bsd_na.proto = 0;
    268      1.1      maxv 	}
    269      1.1      maxv         if (leftovers != 0)
    270      1.1      maxv                 return (EINVAL);
    271      1.1      maxv 
    272      1.1      maxv 	/* copy structure elements based on flags */
    273      1.1      maxv 	if (bsd_na.flags & NFSMNT_WSIZE)
    274      1.1      maxv 		bsd_na.wsize = osf_na.wsize;
    275      1.1      maxv 	if (bsd_na.flags & NFSMNT_RSIZE)
    276      1.1      maxv 		bsd_na.rsize = osf_na.rsize;
    277      1.1      maxv 	if (bsd_na.flags & NFSMNT_TIMEO)
    278      1.1      maxv 		bsd_na.timeo = osf_na.timeo;
    279      1.1      maxv 	if (bsd_na.flags & NFSMNT_RETRANS)
    280      1.1      maxv 		bsd_na.retrans = osf_na.retrans;
    281      1.1      maxv 
    282      1.1      maxv 	return do_sys_mount(l, "nfs", UIO_SYSSPACE, SCARG(uap, path),
    283      1.1      maxv 	    SCARG(uap, flags), &bsd_na, UIO_SYSSPACE, sizeof bsd_na, &dummy);
    284      1.1      maxv }
    285      1.1      maxv 
    286      1.1      maxv int
    287      1.1      maxv linux_sys_osf1_mount(struct lwp *l, const struct linux_sys_osf1_mount_args *uap, register_t *retval)
    288      1.1      maxv {
    289      1.1      maxv 
    290      1.1      maxv 	if (SCARG(uap, flags) & ~OSF1_MOUNT_FLAGS)
    291      1.1      maxv 		return (EINVAL);
    292      1.1      maxv 
    293      1.1      maxv 	/* XXX - xlate flags */
    294      1.1      maxv 
    295      1.1      maxv 	switch (SCARG(uap, type)) {
    296      1.1      maxv 	case OSF1_MOUNT_NFS:
    297      1.1      maxv 		return osf1_mount_nfs(l, uap);
    298      1.1      maxv 		break;
    299      1.1      maxv 
    300      1.1      maxv 	case OSF1_MOUNT_MFS:
    301      1.1      maxv 		return osf1_mount_mfs(l, uap);
    302      1.1      maxv 
    303      1.1      maxv 	default:
    304      1.1      maxv 		return (EINVAL);
    305      1.1      maxv 	}
    306      1.1      maxv }
    307      1.1      maxv 
    308      1.1      maxv int
    309      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)
    310      1.1      maxv {
    311      1.1      maxv 	struct proc *p = l->l_proc;
    312      1.1      maxv 	segsz_t tsize, dsize;
    313      1.1      maxv 
    314      1.1      maxv 	tsize = btoc(SCARG(uap, tsize));
    315      1.1      maxv 	dsize = btoc(SCARG(uap, dsize));
    316      1.1      maxv 
    317      1.1      maxv 	if (dsize > p->p_rlimit[RLIMIT_DATA].rlim_cur)
    318      1.1      maxv 		return (ENOMEM);
    319      1.1      maxv 	if (tsize > MAXTSIZ)
    320      1.1      maxv 		return (ENOMEM);
    321      1.1      maxv 
    322      1.1      maxv 	/* XXXSMP unlocked */
    323      1.1      maxv 	p->p_vmspace->vm_taddr = SCARG(uap, taddr);
    324      1.1      maxv 	p->p_vmspace->vm_tsize = tsize;
    325      1.1      maxv 	p->p_vmspace->vm_daddr = SCARG(uap, daddr);
    326      1.1      maxv 	p->p_vmspace->vm_dsize = dsize;
    327      1.1      maxv 
    328      1.1      maxv 	return (0);
    329      1.1      maxv }
    330      1.1      maxv 
    331      1.1      maxv int
    332      1.1      maxv linux_sys_osf1_setitimer(struct lwp *l, const struct linux_sys_osf1_setitimer_args *uap, register_t *retval)
    333      1.1      maxv {
    334      1.1      maxv 	struct osf1_itimerval o_itv, o_oitv;
    335      1.1      maxv 	struct itimerval b_itv, b_oitv;
    336      1.1      maxv 	int which;
    337      1.1      maxv 	int error;
    338      1.1      maxv 
    339      1.1      maxv 	switch (SCARG(uap, which)) {
    340      1.1      maxv 	case OSF1_ITIMER_REAL:
    341      1.1      maxv 		which = ITIMER_REAL;
    342      1.1      maxv 		break;
    343      1.1      maxv 
    344      1.1      maxv 	case OSF1_ITIMER_VIRTUAL:
    345      1.1      maxv 		which = ITIMER_VIRTUAL;
    346      1.1      maxv 		break;
    347      1.1      maxv 
    348      1.1      maxv 	case OSF1_ITIMER_PROF:
    349      1.1      maxv 		which = ITIMER_PROF;
    350      1.1      maxv 		break;
    351      1.1      maxv 
    352      1.1      maxv 	default:
    353      1.1      maxv 		return (EINVAL);
    354      1.1      maxv 	}
    355      1.1      maxv 
    356      1.1      maxv 	/* get the OSF/1 itimerval argument */
    357      1.1      maxv 	error = copyin(SCARG(uap, itv), &o_itv, sizeof o_itv);
    358      1.1      maxv 	if (error != 0)
    359      1.1      maxv 		return error;
    360      1.1      maxv 
    361      1.1      maxv 	/* fill in and the NetBSD timeval */
    362      1.1      maxv 	memset(&b_itv, 0, sizeof b_itv);
    363      1.1      maxv 	b_itv.it_interval.tv_sec = o_itv.it_interval.tv_sec;
    364      1.1      maxv 	b_itv.it_interval.tv_usec = o_itv.it_interval.tv_usec;
    365      1.1      maxv 	b_itv.it_value.tv_sec = o_itv.it_value.tv_sec;
    366      1.1      maxv 	b_itv.it_value.tv_usec = o_itv.it_value.tv_usec;
    367      1.1      maxv 
    368      1.1      maxv 	if (SCARG(uap, oitv) != NULL) {
    369      1.1      maxv 		dogetitimer(l->l_proc, which, &b_oitv);
    370      1.1      maxv 		if (error)
    371      1.1      maxv 			return error;
    372      1.1      maxv 	}
    373      1.1      maxv 
    374      1.1      maxv 	error = dosetitimer(l->l_proc, which, &b_itv);
    375      1.1      maxv 
    376      1.1      maxv 	if (error == 0 || SCARG(uap, oitv) == NULL)
    377      1.1      maxv 		return error;
    378      1.1      maxv 
    379      1.1      maxv 	/* fill in and copy out the old timeval */
    380      1.1      maxv 	memset(&o_oitv, 0, sizeof o_oitv);
    381      1.1      maxv 	o_oitv.it_interval.tv_sec = b_oitv.it_interval.tv_sec;
    382      1.1      maxv 	o_oitv.it_interval.tv_usec = b_oitv.it_interval.tv_usec;
    383      1.1      maxv 	o_oitv.it_value.tv_sec = b_oitv.it_value.tv_sec;
    384      1.1      maxv 	o_oitv.it_value.tv_usec = b_oitv.it_value.tv_usec;
    385      1.1      maxv 
    386      1.1      maxv 	return copyout(&o_oitv, SCARG(uap, oitv), sizeof o_oitv);
    387      1.1      maxv }
    388      1.1      maxv 
    389      1.1      maxv int
    390      1.1      maxv linux_sys_osf1_select(struct lwp *l, const struct linux_sys_osf1_select_args *uap,
    391      1.1      maxv     register_t *retval)
    392      1.1      maxv {
    393      1.1      maxv 	struct osf1_timeval otv;
    394      1.1      maxv 	struct timespec ats, *ts = NULL;
    395      1.1      maxv 	int error;
    396      1.1      maxv 
    397      1.1      maxv 	if (SCARG(uap, tv)) {
    398      1.1      maxv 		/* get the OSF/1 timeval argument */
    399      1.1      maxv 		error = copyin(SCARG(uap, tv), &otv, sizeof otv);
    400      1.1      maxv 		if (error != 0)
    401      1.1      maxv 			return error;
    402      1.1      maxv 
    403      1.1      maxv 		ats.tv_sec = otv.tv_sec;
    404      1.1      maxv 		ats.tv_nsec = otv.tv_usec * 1000;
    405      1.1      maxv 		ts = &ats;
    406      1.1      maxv 	}
    407      1.1      maxv 
    408      1.1      maxv 	return selcommon(retval, SCARG(uap, nd), SCARG(uap, in),
    409      1.1      maxv 	    SCARG(uap, ou), SCARG(uap, ex), ts, NULL);
    410      1.1      maxv }
    411      1.1      maxv 
    412      1.1      maxv int
    413      1.1      maxv linux_sys_osf1_gettimeofday(struct lwp *l, const struct linux_sys_osf1_gettimeofday_args *uap, register_t *retval)
    414      1.1      maxv {
    415      1.1      maxv 	struct osf1_timeval otv;
    416      1.1      maxv 	struct osf1_timezone otz;
    417      1.1      maxv 	struct timeval tv;
    418      1.1      maxv 	int error;
    419      1.1      maxv 
    420      1.1      maxv 	microtime(&tv);
    421      1.1      maxv 	memset(&otv, 0, sizeof otv);
    422      1.1      maxv 	otv.tv_sec = tv.tv_sec;
    423      1.1      maxv 	otv.tv_usec = tv.tv_usec;
    424      1.2  christos 	error = copyout(&otv, SCARG(uap, tv), sizeof otv);
    425      1.1      maxv 
    426      1.1      maxv 	if (error == 0 && SCARG(uap, tzp) != NULL) {
    427      1.1      maxv 		memset(&otz, 0, sizeof otz);
    428      1.1      maxv 		error = copyout(&otz, SCARG(uap, tzp), sizeof otz);
    429      1.1      maxv 	}
    430      1.1      maxv 	return (error);
    431      1.1      maxv }
    432      1.1      maxv 
    433      1.1      maxv int
    434      1.1      maxv linux_sys_osf1_getrusage(struct lwp *l, const struct linux_sys_osf1_getrusage_args *uap, register_t *retval)
    435      1.1      maxv {
    436      1.1      maxv 	int error, who;
    437      1.1      maxv 	struct osf1_rusage osf1_rusage;
    438      1.1      maxv 	struct rusage ru;
    439      1.1      maxv 	struct proc *p = l->l_proc;
    440      1.1      maxv 
    441      1.1      maxv 
    442      1.1      maxv 	switch (SCARG(uap, who)) {
    443      1.1      maxv 	case OSF1_RUSAGE_SELF:
    444      1.1      maxv 		who = RUSAGE_SELF;
    445      1.1      maxv 		break;
    446      1.1      maxv 
    447      1.1      maxv 	case OSF1_RUSAGE_CHILDREN:
    448      1.1      maxv 		who = RUSAGE_CHILDREN;
    449      1.1      maxv 		break;
    450      1.1      maxv 
    451      1.1      maxv 	case OSF1_RUSAGE_THREAD:		/* XXX not supported */
    452      1.1      maxv 	default:
    453      1.1      maxv 		return EINVAL;
    454      1.1      maxv 	}
    455      1.1      maxv 
    456      1.1      maxv 	error = getrusage1(p, who, &ru);
    457      1.1      maxv 	if (error != 0)
    458      1.1      maxv 		return error;
    459      1.1      maxv 
    460      1.1      maxv 	osf1_cvt_rusage_from_native(&ru, &osf1_rusage);
    461      1.1      maxv 
    462      1.1      maxv 	return copyout(&osf1_rusage, SCARG(uap, rusage), sizeof osf1_rusage);
    463      1.1      maxv }
    464      1.1      maxv 
    465      1.1      maxv int
    466      1.1      maxv linux_sys_osf1_settimeofday(struct lwp *l, const struct linux_sys_osf1_settimeofday_args *uap, register_t *retval)
    467      1.1      maxv {
    468      1.1      maxv 	struct osf1_timeval otv;
    469      1.1      maxv 	struct timeval tv, *tvp;
    470      1.1      maxv 	int error = 0;
    471      1.1      maxv 
    472      1.1      maxv 	if (SCARG(uap, tv) == NULL)
    473      1.1      maxv 		tvp = NULL;
    474      1.1      maxv 	else {
    475      1.1      maxv 		/* get the OSF/1 timeval argument */
    476      1.1      maxv 		error = copyin(SCARG(uap, tv), &otv, sizeof otv);
    477      1.1      maxv 		if (error != 0)
    478      1.1      maxv 			return error;
    479      1.1      maxv 
    480      1.1      maxv 		tv.tv_sec = otv.tv_sec;
    481      1.1      maxv 		tv.tv_usec = otv.tv_usec;
    482      1.1      maxv 		tvp = &tv;
    483      1.1      maxv 	}
    484      1.1      maxv 
    485      1.1      maxv 	/* NetBSD ignores the timezone field */
    486      1.1      maxv 
    487      1.1      maxv 	return settimeofday1(tvp, false, (const void *)SCARG(uap, tzp), l, true);
    488      1.1      maxv }
    489      1.1      maxv 
    490      1.1      maxv int
    491      1.1      maxv linux_sys_osf1_utimes(struct lwp *l, const struct linux_sys_osf1_utimes_args *uap, register_t *retval)
    492      1.1      maxv {
    493      1.1      maxv 	struct osf1_timeval otv;
    494      1.1      maxv 	struct timeval tv[2], *tvp;
    495      1.1      maxv 	int error;
    496      1.1      maxv 
    497      1.1      maxv 	if (SCARG(uap, tptr) == NULL)
    498      1.1      maxv 		tvp = NULL;
    499      1.1      maxv 	else {
    500      1.1      maxv 		/* get the OSF/1 timeval argument */
    501      1.1      maxv 		error = copyin(SCARG(uap, tptr), &otv, sizeof otv);
    502      1.1      maxv 		if (error != 0)
    503      1.1      maxv 			return error;
    504      1.1      maxv 
    505      1.1      maxv 		/* fill in and copy out the NetBSD timeval */
    506      1.1      maxv 		tv[0].tv_sec = otv.tv_sec;
    507      1.1      maxv 		tv[0].tv_usec = otv.tv_usec;
    508      1.1      maxv 		/* Set access and modified to the same time */
    509      1.1      maxv 		tv[1].tv_sec = otv.tv_sec;
    510      1.1      maxv 		tv[1].tv_usec = otv.tv_usec;
    511      1.1      maxv 		tvp = tv;
    512      1.1      maxv 	}
    513      1.1      maxv 
    514      1.1      maxv 	return do_sys_utimes(l, NULL, SCARG(uap, path), FOLLOW,
    515      1.1      maxv 			    tvp, UIO_SYSSPACE);
    516      1.1      maxv }
    517      1.1      maxv 
    518      1.1      maxv int
    519      1.1      maxv linux_sys_osf1_statfs(struct lwp *l, const struct linux_sys_osf1_statfs_args *uap, register_t *retval)
    520      1.1      maxv {
    521      1.1      maxv 	struct mount *mp;
    522      1.1      maxv 	struct statvfs *sp;
    523      1.1      maxv 	struct osf1_statfs osfs;
    524      1.1      maxv 	int error;
    525      1.1      maxv 	struct vnode *vp;
    526      1.1      maxv 
    527      1.1      maxv 	error = namei_simple_user(SCARG(uap, path),
    528      1.1      maxv 				NSM_FOLLOW_TRYEMULROOT, &vp);
    529      1.1      maxv 	if (error != 0)
    530      1.1      maxv 		return (error);
    531      1.1      maxv 	mp = vp->v_mount;
    532      1.1      maxv 	sp = &mp->mnt_stat;
    533      1.1      maxv 	vrele(vp);
    534      1.1      maxv 	if ((error = VFS_STATVFS(mp, sp)))
    535      1.1      maxv 		return (error);
    536      1.1      maxv 	sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
    537      1.1      maxv 	osf1_cvt_statfs_from_native(sp, &osfs);
    538      1.1      maxv 	return copyout(&osfs, SCARG(uap, buf), uimin(sizeof osfs,
    539      1.1      maxv 	    SCARG(uap, len)));
    540      1.1      maxv }
    541      1.1      maxv 
    542      1.1      maxv int
    543      1.1      maxv linux_sys_osf1_fstatfs(struct lwp *l, const struct linux_sys_osf1_fstatfs_args *uap, register_t *retval)
    544      1.1      maxv {
    545      1.1      maxv 	file_t *fp;
    546      1.1      maxv 	struct mount *mp;
    547      1.1      maxv 	struct statvfs *sp;
    548      1.1      maxv 	struct osf1_statfs osfs;
    549      1.1      maxv 	int error;
    550      1.1      maxv 
    551      1.1      maxv 	/* fd_getvnode() will use the descriptor for us */
    552      1.1      maxv 	if ((error = fd_getvnode(SCARG(uap, fd), &fp)))
    553      1.1      maxv 		return (error);
    554      1.1      maxv 	mp = fp->f_vnode->v_mount;
    555      1.1      maxv 	sp = &mp->mnt_stat;
    556      1.1      maxv 	if ((error = VFS_STATVFS(mp, sp)))
    557      1.1      maxv 		goto out;
    558      1.1      maxv 	sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
    559      1.1      maxv 	osf1_cvt_statfs_from_native(sp, &osfs);
    560      1.1      maxv 	error = copyout(&osfs, SCARG(uap, buf), uimin(sizeof osfs,
    561      1.1      maxv 	    SCARG(uap, len)));
    562      1.1      maxv  out:
    563      1.1      maxv  	fd_putfile(SCARG(uap, fd));
    564      1.1      maxv 	return (error);
    565      1.1      maxv }
    566      1.1      maxv 
    567      1.1      maxv int
    568      1.1      maxv linux_sys_osf1_sysinfo(struct lwp *l, const struct linux_sys_osf1_sysinfo_args *uap, register_t *retval)
    569      1.1      maxv {
    570      1.1      maxv 	const char *string;
    571      1.1      maxv 	size_t slen;
    572      1.1      maxv 	int error;
    573      1.1      maxv 
    574      1.1      maxv 	error = 0;
    575      1.1      maxv 	switch (SCARG(uap, cmd)) {
    576      1.1      maxv 	case OSF1_SI_SYSNAME:
    577      1.1      maxv 		string = ostype;
    578      1.1      maxv 		break;
    579      1.1      maxv 
    580      1.1      maxv 	case OSF1_SI_HOSTNAME:
    581      1.1      maxv 		string = hostname;
    582      1.1      maxv 		break;
    583      1.1      maxv 
    584      1.1      maxv 	case OSF1_SI_RELEASE:
    585      1.1      maxv 		string = osrelease;
    586      1.1      maxv 		break;
    587      1.1      maxv 
    588      1.1      maxv 	case OSF1_SI_VERSION:
    589      1.1      maxv 		goto should_handle;
    590      1.1      maxv 
    591      1.1      maxv 	case OSF1_SI_MACHINE:
    592      1.1      maxv 		string = MACHINE;
    593      1.1      maxv 		break;
    594      1.1      maxv 
    595      1.1      maxv 	case OSF1_SI_ARCHITECTURE:
    596      1.1      maxv 		string = MACHINE_ARCH;
    597      1.1      maxv 		break;
    598      1.1      maxv 
    599      1.1      maxv 	case OSF1_SI_HW_SERIAL:
    600      1.1      maxv 		string = "666";			/* OSF/1 emulation?  YES! */
    601      1.1      maxv 		break;
    602      1.1      maxv 
    603      1.1      maxv 	case OSF1_SI_HW_PROVIDER:
    604      1.1      maxv 		string = "unknown";
    605      1.1      maxv 		break;
    606      1.1      maxv 
    607      1.1      maxv 	case OSF1_SI_SRPC_DOMAIN:
    608      1.1      maxv 		goto dont_care;
    609      1.1      maxv 
    610      1.1      maxv 	case OSF1_SI_SET_HOSTNAME:
    611      1.1      maxv 		goto should_handle;
    612      1.1      maxv 
    613      1.1      maxv 	case OSF1_SI_SET_SYSNAME:
    614      1.1      maxv 		goto should_handle;
    615      1.1      maxv 
    616      1.1      maxv 	case OSF1_SI_SET_SRPC_DOMAIN:
    617      1.1      maxv 		goto dont_care;
    618      1.1      maxv 
    619      1.1      maxv 	default:
    620      1.1      maxv should_handle:
    621      1.1      maxv 		printf("osf1_sys_sysinfo(%d, %p, 0x%lx)\n", SCARG(uap, cmd),
    622      1.1      maxv 		    SCARG(uap, buf), SCARG(uap,len));
    623      1.1      maxv dont_care:
    624      1.1      maxv 		return (EINVAL);
    625      1.1      maxv 	};
    626      1.1      maxv 
    627      1.1      maxv 	slen = strlen(string) + 1;
    628      1.1      maxv 	if (SCARG(uap, buf)) {
    629      1.1      maxv 		error = copyout(string, SCARG(uap, buf),
    630      1.1      maxv 				uimin(slen, SCARG(uap, len)));
    631      1.1      maxv 		if (!error && (SCARG(uap, len) > 0) && (SCARG(uap, len) < slen))
    632      1.3   thorpej 			error = ustore_char(SCARG(uap, buf)
    633      1.3   thorpej 					    + SCARG(uap, len) - 1, 0);
    634      1.1      maxv 	}
    635      1.1      maxv 	if (!error)
    636      1.1      maxv 		retval[0] = slen;
    637      1.1      maxv 
    638      1.1      maxv 	return (error);
    639      1.1      maxv }
    640      1.1      maxv 
    641      1.1      maxv int
    642      1.1      maxv linux_sys_osf1_usleep_thread(struct lwp *l, const struct linux_sys_osf1_usleep_thread_args *uap, register_t *retval)
    643      1.1      maxv {
    644      1.1      maxv 	struct osf1_timeval otv, endotv;
    645      1.1      maxv 	struct timeval tv, ntv, endtv;
    646      1.1      maxv 	u_long ticks;
    647      1.1      maxv 	int error;
    648      1.1      maxv 
    649      1.1      maxv 	if ((error = copyin(SCARG(uap, sleep), &otv, sizeof otv)))
    650      1.1      maxv 		return (error);
    651      1.1      maxv 	tv.tv_sec = otv.tv_sec;
    652      1.1      maxv 	tv.tv_usec = otv.tv_usec;
    653      1.1      maxv 
    654      1.1      maxv 	ticks = howmany((u_long)tv.tv_sec * 1000000 + tv.tv_usec, tick);
    655      1.1      maxv 	if (ticks == 0)
    656      1.1      maxv 		ticks = 1;
    657      1.1      maxv 
    658      1.1      maxv 	getmicrotime(&tv);
    659      1.1      maxv 
    660      1.1      maxv 	tsleep(l, PUSER|PCATCH, "uslpthrd", ticks);	/* XXX */
    661      1.1      maxv 
    662      1.1      maxv 	if (SCARG(uap, slept) != NULL) {
    663      1.1      maxv 		getmicrotime(&ntv);
    664      1.1      maxv 		timersub(&ntv, &tv, &endtv);
    665      1.1      maxv 		if (endtv.tv_sec < 0 || endtv.tv_usec < 0)
    666      1.1      maxv 			endtv.tv_sec = endtv.tv_usec = 0;
    667      1.1      maxv 
    668  1.3.6.1    martin 		memset(&endotv, 0, sizeof(endotv));
    669      1.1      maxv 		endotv.tv_sec = endtv.tv_sec;
    670      1.1      maxv 		endotv.tv_usec = endtv.tv_usec;
    671      1.1      maxv 		error = copyout(&endotv, SCARG(uap, slept), sizeof endotv);
    672      1.1      maxv 	}
    673      1.1      maxv 	return (error);
    674      1.1      maxv }
    675      1.1      maxv 
    676      1.1      maxv int
    677      1.1      maxv linux_sys_osf1_getsysinfo(struct lwp *l, const struct linux_sys_osf1_getsysinfo_args *uap, register_t *retval)
    678      1.1      maxv {
    679      1.1      maxv 	extern int ncpus;
    680      1.1      maxv 	int error;
    681      1.1      maxv 	int unit;
    682      1.1      maxv 	long percpu;
    683      1.1      maxv 	long proctype;
    684      1.1      maxv 	u_int64_t fpflags;
    685      1.1      maxv 	struct osf1_cpu_info cpuinfo;
    686      1.1      maxv 	const void *data;
    687      1.1      maxv 	size_t datalen;
    688      1.1      maxv 
    689      1.1      maxv 	error = 0;
    690      1.1      maxv 
    691      1.1      maxv 	switch(SCARG(uap, op))
    692      1.1      maxv 	{
    693      1.1      maxv 	case OSF_GET_MAX_UPROCS:
    694      1.1      maxv 		data = &maxproc;
    695      1.1      maxv 		datalen = sizeof(maxproc);
    696      1.1      maxv 		break;
    697      1.1      maxv 	case OSF_GET_PHYSMEM:
    698      1.1      maxv 		data = &physmem;
    699      1.1      maxv 		datalen = sizeof(physmem);
    700      1.1      maxv 		break;
    701      1.1      maxv 	case OSF_GET_MAX_CPU:
    702      1.1      maxv 	case OSF_GET_CPUS_IN_BOX:
    703      1.1      maxv 		data = &ncpus;
    704      1.1      maxv 		datalen = sizeof(ncpus);
    705      1.1      maxv 		break;
    706      1.1      maxv 	case OSF_GET_IEEE_FP_CONTROL:
    707      1.1      maxv 		if (((fpflags = alpha_read_fp_c(l)) & IEEE_INHERIT) != 0) {
    708      1.1      maxv 			fpflags |= 1ULL << 63;
    709      1.1      maxv 			fpflags &= ~IEEE_INHERIT;
    710      1.1      maxv 		}
    711      1.1      maxv 		data = &fpflags;
    712      1.1      maxv 		datalen = sizeof(fpflags);
    713      1.1      maxv 		break;
    714      1.1      maxv 	case OSF_GET_CPU_INFO:
    715      1.1      maxv 		memset(&cpuinfo, 0, sizeof(cpuinfo));
    716      1.1      maxv #ifdef __alpha__
    717      1.1      maxv 		unit = alpha_pal_whami();
    718      1.1      maxv #else
    719      1.1      maxv 		unit = 0; /* XXX */
    720      1.1      maxv #endif
    721      1.1      maxv 		cpuinfo.current_cpu = unit;
    722      1.1      maxv 		cpuinfo.cpus_in_box = ncpus;
    723      1.1      maxv 		cpuinfo.cpu_type = LOCATE_PCS(hwrpb, unit)->pcs_proc_type;
    724      1.1      maxv 		cpuinfo.ncpus = ncpus;
    725      1.1      maxv 		cpuinfo.cpus_present = ncpus;
    726      1.1      maxv 		cpuinfo.cpus_running = ncpus;
    727      1.1      maxv 		cpuinfo.cpu_binding = 1;
    728      1.1      maxv 		cpuinfo.cpu_ex_binding = 0;
    729      1.1      maxv 		cpuinfo.mhz = hwrpb->rpb_cc_freq / 1000000;
    730      1.1      maxv 		data = &cpuinfo;
    731      1.1      maxv 		datalen = sizeof(cpuinfo);
    732      1.1      maxv 		break;
    733      1.1      maxv 	case OSF_GET_PROC_TYPE:
    734      1.1      maxv #ifdef __alpha__
    735      1.1      maxv 		unit = alpha_pal_whami();
    736      1.1      maxv 		proctype = LOCATE_PCS(hwrpb, unit)->pcs_proc_type;
    737      1.1      maxv #else
    738      1.1      maxv 		proctype = 0;	/* XXX */
    739      1.1      maxv #endif
    740      1.1      maxv 		data = &proctype;
    741      1.1      maxv 		datalen = sizeof(percpu);
    742      1.1      maxv 		break;
    743      1.1      maxv 	case OSF_GET_HWRPB: /* note -- osf/1 doesn't have rpb_tbhint[8] */
    744      1.1      maxv 		data = hwrpb;
    745      1.1      maxv 		datalen = hwrpb->rpb_size;
    746      1.1      maxv 		break;
    747      1.1      maxv 	case OSF_GET_PLATFORM_NAME:
    748      1.1      maxv 		data = platform.model;
    749      1.1      maxv 		datalen = strlen(platform.model) + 1;
    750      1.1      maxv 		break;
    751      1.1      maxv 	default:
    752      1.1      maxv 		printf("osf1_getsysinfo called with unknown op=%ld\n",
    753      1.1      maxv 		       SCARG(uap, op));
    754      1.1      maxv 		/* return EINVAL; */
    755      1.1      maxv 		return 0;
    756      1.1      maxv 	}
    757      1.1      maxv 
    758      1.1      maxv 	if (SCARG(uap, nbytes) < datalen)
    759      1.1      maxv 		return (EINVAL);
    760      1.1      maxv 	error = copyout(data, SCARG(uap, buffer), datalen);
    761      1.1      maxv 	if (!error)
    762      1.1      maxv 		retval[0] = 1;
    763      1.1      maxv 	return (error);
    764      1.1      maxv }
    765      1.1      maxv 
    766      1.1      maxv int
    767      1.1      maxv linux_sys_osf1_setsysinfo(struct lwp *l, const struct linux_sys_osf1_setsysinfo_args *uap, register_t *retval)
    768      1.1      maxv {
    769      1.1      maxv 	u_int64_t temp;
    770      1.1      maxv 	int error;
    771      1.1      maxv 
    772      1.1      maxv 	error = 0;
    773      1.1      maxv 
    774      1.1      maxv 	switch(SCARG(uap, op)) {
    775      1.1      maxv 	case OSF_SET_IEEE_FP_CONTROL:
    776      1.1      maxv 
    777      1.1      maxv 		if ((error = copyin(SCARG(uap, buffer), &temp, sizeof(temp))))
    778      1.1      maxv 			break;
    779      1.1      maxv 		if (temp >> 63 != 0)
    780      1.1      maxv 			temp |= IEEE_INHERIT;
    781      1.1      maxv 		alpha_write_fp_c(l, temp);
    782      1.1      maxv 		break;
    783      1.1      maxv 	default:
    784      1.1      maxv 		uprintf("osf1_setsysinfo called with op=%ld\n", SCARG(uap, op));
    785      1.1      maxv 		//error = EINVAL;
    786      1.1      maxv 	}
    787      1.1      maxv 	retval[0] = 0;
    788      1.1      maxv 	return (error);
    789      1.1      maxv }
    790