Home | History | Annotate | Line # | Download | only in common
linux32_unistd.c revision 1.21.6.1
      1  1.21.6.1    mjf /*	$NetBSD: linux32_unistd.c,v 1.21.6.1 2008/06/02 13:23:04 mjf Exp $ */
      2       1.1   manu 
      3       1.1   manu /*-
      4       1.1   manu  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
      5       1.1   manu  *
      6       1.1   manu  * Redistribution and use in source and binary forms, with or without
      7       1.1   manu  * modification, are permitted provided that the following conditions
      8       1.1   manu  * are met:
      9       1.1   manu  * 1. Redistributions of source code must retain the above copyright
     10       1.1   manu  *    notice, this list of conditions and the following disclaimer.
     11       1.1   manu  * 2. Redistributions in binary form must reproduce the above copyright
     12       1.1   manu  *    notice, this list of conditions and the following disclaimer in the
     13       1.1   manu  *    documentation and/or other materials provided with the distribution.
     14       1.1   manu  * 3. All advertising materials mentioning features or use of this software
     15       1.1   manu  *    must display the following acknowledgement:
     16       1.1   manu  *	This product includes software developed by Emmanuel Dreyfus
     17       1.1   manu  * 4. The name of the author may not be used to endorse or promote
     18       1.1   manu  *    products derived from this software without specific prior written
     19       1.1   manu  *    permission.
     20       1.1   manu  *
     21       1.1   manu  * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
     22       1.1   manu  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     23       1.1   manu  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     24       1.1   manu  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
     25       1.1   manu  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     26       1.1   manu  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     27       1.1   manu  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28       1.1   manu  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     29       1.1   manu  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30       1.1   manu  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     31       1.1   manu  * POSSIBILITY OF SUCH DAMAGE.
     32       1.1   manu  */
     33       1.1   manu 
     34       1.1   manu #include <sys/cdefs.h>
     35       1.1   manu 
     36  1.21.6.1    mjf __KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.21.6.1 2008/06/02 13:23:04 mjf Exp $");
     37       1.1   manu 
     38       1.1   manu #include <sys/types.h>
     39       1.1   manu #include <sys/param.h>
     40       1.1   manu #include <sys/fstypes.h>
     41       1.1   manu #include <sys/signal.h>
     42       1.1   manu #include <sys/dirent.h>
     43       1.1   manu #include <sys/kernel.h>
     44       1.1   manu #include <sys/fcntl.h>
     45       1.1   manu #include <sys/select.h>
     46       1.1   manu #include <sys/proc.h>
     47       1.1   manu #include <sys/ucred.h>
     48       1.1   manu #include <sys/swap.h>
     49       1.1   manu 
     50       1.1   manu #include <machine/types.h>
     51       1.1   manu 
     52       1.1   manu #include <sys/syscallargs.h>
     53       1.1   manu 
     54       1.1   manu #include <compat/netbsd32/netbsd32.h>
     55       1.1   manu #include <compat/netbsd32/netbsd32_conv.h>
     56       1.1   manu 
     57       1.1   manu #include <compat/linux/common/linux_types.h>
     58       1.1   manu #include <compat/linux/common/linux_signal.h>
     59       1.1   manu #include <compat/linux/common/linux_machdep.h>
     60       1.1   manu #include <compat/linux/common/linux_misc.h>
     61       1.1   manu #include <compat/linux/common/linux_oldolduname.h>
     62       1.1   manu #include <compat/linux/linux_syscallargs.h>
     63       1.1   manu 
     64       1.1   manu #include <compat/linux32/common/linux32_types.h>
     65       1.1   manu #include <compat/linux32/common/linux32_signal.h>
     66       1.1   manu #include <compat/linux32/common/linux32_machdep.h>
     67       1.1   manu #include <compat/linux32/common/linux32_sysctl.h>
     68       1.1   manu #include <compat/linux32/common/linux32_socketcall.h>
     69       1.1   manu #include <compat/linux32/linux32_syscallargs.h>
     70       1.1   manu 
     71       1.1   manu static int linux32_select1(struct lwp *, register_t *,
     72       1.1   manu     int, fd_set *, fd_set *, fd_set *, struct timeval *);
     73       1.1   manu 
     74       1.1   manu int
     75      1.17    dsl linux32_sys_brk(struct lwp *l, const struct linux32_sys_brk_args *uap, register_t *retval)
     76       1.1   manu {
     77      1.17    dsl 	/* {
     78       1.1   manu 		syscallarg(netbsd32_charp) nsize;
     79      1.17    dsl 	} */
     80       1.1   manu 	struct linux_sys_brk_args ua;
     81       1.1   manu 
     82       1.1   manu 	NETBSD32TOP_UAP(nsize, char);
     83       1.1   manu 	return linux_sys_brk(l, &ua, retval);
     84       1.1   manu }
     85       1.1   manu 
     86       1.1   manu int
     87      1.17    dsl linux32_sys_llseek(struct lwp *l, const struct linux32_sys_llseek_args *uap, register_t *retval)
     88       1.1   manu {
     89      1.17    dsl 	/* {
     90       1.1   manu 		syscallcarg(int) fd;
     91       1.1   manu                 syscallarg(u_int32_t) ohigh;
     92       1.1   manu                 syscallarg(u_int32_t) olow;
     93      1.16  njoly 		syscallarg(netbsd32_caddr_t) res;
     94       1.1   manu 		syscallcarg(int) whence;
     95      1.17    dsl 	} */
     96       1.1   manu 	struct linux_sys_llseek_args ua;
     97       1.1   manu 
     98       1.1   manu 	NETBSD32TO64_UAP(fd);
     99       1.1   manu 	NETBSD32TO64_UAP(ohigh);
    100       1.1   manu 	NETBSD32TO64_UAP(olow);
    101       1.1   manu 	NETBSD32TOP_UAP(res, char);
    102       1.1   manu 	NETBSD32TO64_UAP(whence);
    103       1.1   manu 
    104       1.1   manu 	return linux_sys_llseek(l, &ua, retval);
    105       1.1   manu }
    106       1.1   manu 
    107       1.1   manu int
    108      1.17    dsl linux32_sys_select(struct lwp *l, const struct linux32_sys_select_args *uap, register_t *retval)
    109       1.1   manu {
    110      1.17    dsl 	/* {
    111       1.1   manu 		syscallarg(int) nfds;
    112       1.1   manu 		syscallarg(netbsd32_fd_setp_t) readfds;
    113       1.1   manu 		syscallarg(netbsd32_fd_setp_t) writefds;
    114       1.1   manu 		syscallarg(netbsd32_fd_setp_t) exceptfds;
    115       1.1   manu 		syscallarg(netbsd32_timevalp_t) timeout;
    116      1.17    dsl 	} */
    117       1.1   manu 
    118       1.1   manu 	return linux32_select1(l, retval, SCARG(uap, nfds),
    119       1.7    dsl 	    SCARG_P32(uap, readfds),
    120       1.7    dsl 	    SCARG_P32(uap, writefds),
    121       1.7    dsl 	    SCARG_P32(uap, exceptfds),
    122       1.7    dsl 	    SCARG_P32(uap, timeout));
    123       1.1   manu }
    124       1.1   manu 
    125       1.1   manu int
    126      1.17    dsl linux32_sys_oldselect(struct lwp *l, const struct linux32_sys_oldselect_args *uap, register_t *retval)
    127       1.1   manu {
    128      1.17    dsl 	/* {
    129       1.1   manu 		syscallarg(linux32_oldselectp_t) lsp;
    130      1.17    dsl 	} */
    131       1.1   manu 	struct linux32_oldselect lsp32;
    132       1.1   manu 	int error;
    133       1.1   manu 
    134       1.7    dsl 	if ((error = copyin(SCARG_P32(uap, lsp), &lsp32, sizeof(lsp32))) != 0)
    135       1.1   manu 		return error;
    136       1.1   manu 
    137       1.1   manu 	return linux32_select1(l, retval, lsp32.nfds,
    138       1.1   manu 	     NETBSD32PTR64(lsp32.readfds), NETBSD32PTR64(lsp32.writefds),
    139       1.1   manu 	     NETBSD32PTR64(lsp32.exceptfds), NETBSD32PTR64(lsp32.timeout));
    140       1.1   manu }
    141       1.1   manu 
    142       1.1   manu static int
    143       1.1   manu linux32_select1(l, retval, nfds, readfds, writefds, exceptfds, timeout)
    144       1.1   manu         struct lwp *l;
    145       1.1   manu         register_t *retval;
    146       1.1   manu         int nfds;
    147       1.1   manu         fd_set *readfds, *writefds, *exceptfds;
    148       1.1   manu         struct timeval *timeout;
    149       1.1   manu {
    150      1.10    dsl 	struct timeval tv0, tv1, utv, *tv = NULL;
    151       1.1   manu 	struct netbsd32_timeval utv32;
    152       1.1   manu 	int error;
    153       1.1   manu 
    154      1.10    dsl 	timerclear(&utv); /* XXX GCC4 */
    155       1.2    skd 
    156       1.1   manu 	/*
    157       1.1   manu 	 * Store current time for computation of the amount of
    158       1.1   manu 	 * time left.
    159       1.1   manu 	 */
    160       1.1   manu 	if (timeout) {
    161       1.1   manu 		if ((error = copyin(timeout, &utv32, sizeof(utv32))))
    162       1.1   manu 			return error;
    163       1.1   manu 
    164       1.1   manu 		netbsd32_to_timeval(&utv32, &utv);
    165       1.1   manu 
    166       1.1   manu 		if (itimerfix(&utv)) {
    167       1.1   manu 			/*
    168       1.1   manu 			 * The timeval was invalid.  Convert it to something
    169       1.1   manu 			 * valid that will act as it does under Linux.
    170       1.1   manu 			 */
    171       1.1   manu 			utv.tv_sec += utv.tv_usec / 1000000;
    172       1.1   manu 			utv.tv_usec %= 1000000;
    173       1.1   manu 			if (utv.tv_usec < 0) {
    174       1.1   manu 				utv.tv_sec -= 1;
    175       1.1   manu 				utv.tv_usec += 1000000;
    176       1.1   manu 			}
    177       1.1   manu 			if (utv.tv_sec < 0)
    178       1.1   manu 				timerclear(&utv);
    179       1.1   manu 		}
    180       1.1   manu 		microtime(&tv0);
    181       1.8  njoly 		tv = &utv;
    182       1.1   manu 	}
    183       1.1   manu 
    184       1.1   manu 	error = selcommon(l, retval, nfds,
    185       1.8  njoly 	    readfds, writefds, exceptfds, tv, NULL);
    186       1.1   manu 
    187       1.1   manu 	if (error) {
    188       1.1   manu 		/*
    189       1.1   manu 		 * See fs/select.c in the Linux kernel.  Without this,
    190       1.1   manu 		 * Maelstrom doesn't work.
    191       1.1   manu 		 */
    192       1.1   manu 		if (error == ERESTART)
    193       1.1   manu 			error = EINTR;
    194       1.1   manu 		return error;
    195       1.1   manu 	}
    196       1.1   manu 
    197       1.1   manu 	if (timeout) {
    198       1.1   manu 		if (*retval) {
    199       1.1   manu 			/*
    200       1.1   manu 			 * Compute how much time was left of the timeout,
    201       1.1   manu 			 * by subtracting the current time and the time
    202       1.1   manu 			 * before we started the call, and subtracting
    203       1.1   manu 			 * that result from the user-supplied value.
    204       1.1   manu 			 */
    205       1.1   manu 			microtime(&tv1);
    206       1.1   manu 			timersub(&tv1, &tv0, &tv1);
    207      1.10    dsl 			timersub(&utv, &tv1, &utv);
    208       1.1   manu 			if (utv.tv_sec < 0)
    209       1.1   manu 				timerclear(&utv);
    210       1.1   manu 		} else {
    211       1.1   manu 			timerclear(&utv);
    212       1.1   manu 		}
    213       1.1   manu 
    214       1.1   manu 		netbsd32_from_timeval(&utv, &utv32);
    215       1.1   manu 
    216       1.1   manu 		if ((error = copyout(&utv32, timeout, sizeof(utv32))))
    217       1.1   manu 			return error;
    218       1.1   manu 	}
    219       1.1   manu 
    220       1.1   manu 	return 0;
    221       1.1   manu }
    222       1.1   manu 
    223       1.1   manu int
    224      1.17    dsl linux32_sys_pipe(struct lwp *l, const struct linux32_sys_pipe_args *uap, register_t *retval)
    225       1.1   manu {
    226      1.17    dsl 	/* {
    227       1.1   manu 		syscallarg(netbsd32_intp) fd;
    228      1.17    dsl 	} */
    229       1.1   manu 	int error;
    230       1.1   manu 	int pfds[2];
    231       1.1   manu 
    232       1.1   manu 	if ((error = sys_pipe(l, 0, retval)))
    233       1.1   manu 		return error;
    234       1.1   manu 
    235       1.1   manu 	pfds[0] = (int)retval[0];
    236       1.1   manu 	pfds[1] = (int)retval[1];
    237       1.1   manu 
    238       1.7    dsl 	if ((error = copyout(pfds, SCARG_P32(uap, fd), 2 * sizeof (int))) != 0)
    239       1.1   manu 		return error;
    240       1.1   manu 
    241       1.1   manu 	retval[0] = 0;
    242       1.1   manu 	retval[1] = 0;
    243       1.1   manu 
    244       1.1   manu 	return 0;
    245       1.1   manu }
    246       1.1   manu 
    247       1.1   manu 
    248       1.1   manu int
    249      1.17    dsl linux32_sys_unlink(struct lwp *l, const struct linux32_sys_unlink_args *uap, register_t *retval)
    250       1.1   manu {
    251      1.17    dsl 	/* {
    252       1.1   manu 		syscallarg(const netbsd32_charp) path;
    253      1.17    dsl 	} */
    254       1.1   manu 	struct linux_sys_unlink_args ua;
    255       1.1   manu 
    256       1.1   manu 	NETBSD32TOP_UAP(path, const char);
    257       1.1   manu 
    258       1.1   manu 	return linux_sys_unlink(l, &ua, retval);
    259       1.1   manu }
    260       1.1   manu 
    261       1.1   manu int
    262      1.17    dsl linux32_sys_creat(struct lwp *l, const struct linux32_sys_creat_args *uap, register_t *retval)
    263       1.1   manu {
    264      1.17    dsl 	/* {
    265       1.1   manu 		syscallarg(const netbsd32_charp) path;
    266       1.1   manu 		syscallarg(int) mode;
    267      1.17    dsl 	} */
    268       1.1   manu 	struct sys_open_args ua;
    269       1.1   manu 
    270       1.1   manu 	NETBSD32TOP_UAP(path, const char);
    271       1.1   manu 	SCARG(&ua, flags) = O_CREAT | O_TRUNC | O_WRONLY;
    272       1.1   manu 	NETBSD32TO64_UAP(mode);
    273       1.1   manu 
    274       1.1   manu 	return sys_open(l, &ua, retval);
    275       1.1   manu }
    276       1.1   manu 
    277       1.1   manu int
    278      1.17    dsl linux32_sys_mknod(struct lwp *l, const struct linux32_sys_mknod_args *uap, register_t *retval)
    279       1.1   manu {
    280      1.17    dsl 	/* {
    281       1.1   manu 		syscallarg(const netbsd32_charp) path;
    282       1.1   manu 		syscallarg(int) mode;
    283       1.1   manu 		syscallarg(int) dev;
    284      1.17    dsl 	} */
    285       1.1   manu 	struct linux_sys_mknod_args ua;
    286       1.1   manu 
    287       1.1   manu 	NETBSD32TOP_UAP(path, const char);
    288       1.1   manu 	NETBSD32TO64_UAP(mode);
    289       1.1   manu 	NETBSD32TO64_UAP(dev);
    290       1.1   manu 
    291       1.1   manu 	return linux_sys_mknod(l, &ua, retval);
    292       1.1   manu }
    293       1.1   manu 
    294       1.1   manu int
    295      1.17    dsl linux32_sys_break(struct lwp *l, const struct linux32_sys_break_args *uap, register_t *retval)
    296       1.1   manu {
    297       1.1   manu #if 0
    298      1.17    dsl 	/* {
    299       1.1   manu 		syscallarg(const netbsd32_charp) nsize;
    300      1.17    dsl 	} */
    301       1.1   manu #endif
    302       1.1   manu 
    303       1.1   manu 	return ENOSYS;
    304       1.1   manu }
    305       1.1   manu 
    306       1.1   manu int
    307      1.17    dsl linux32_sys_rename(struct lwp *l, const struct linux32_sys_rename_args *uap, register_t *retval)
    308       1.1   manu {
    309      1.17    dsl 	/* {
    310       1.1   manu 		syscallarg(const netbsd32_charp) from;
    311       1.1   manu 		syscallarg(const netbsd32_charp) to;
    312      1.17    dsl 	} */
    313      1.17    dsl 	struct sys___posix_rename_args ua;
    314       1.1   manu 
    315       1.1   manu 	NETBSD32TOP_UAP(from, const char);
    316       1.1   manu 	NETBSD32TOP_UAP(to, const char);
    317       1.1   manu 
    318       1.1   manu 	return sys___posix_rename(l, &ua, retval);
    319       1.1   manu }
    320       1.1   manu 
    321       1.1   manu int
    322      1.17    dsl linux32_sys_swapon(struct lwp *l, const struct linux32_sys_swapon_args *uap, register_t *retval)
    323       1.1   manu {
    324      1.17    dsl 	/* {
    325       1.1   manu 		syscallarg(const netbsd32_charp) name;
    326      1.17    dsl 	} */
    327       1.1   manu 	struct sys_swapctl_args ua;
    328       1.1   manu 
    329       1.1   manu         SCARG(&ua, cmd) = SWAP_ON;
    330       1.7    dsl         SCARG(&ua, arg) = SCARG_P32(uap, name);
    331       1.1   manu         SCARG(&ua, misc) = 0;   /* priority */
    332       1.1   manu         return (sys_swapctl(l, &ua, retval));
    333       1.1   manu }
    334       1.1   manu 
    335       1.1   manu int
    336      1.17    dsl linux32_sys_swapoff(struct lwp *l, const struct linux32_sys_swapoff_args *uap, register_t *retval)
    337       1.1   manu {
    338      1.17    dsl 	/* {
    339       1.1   manu 		syscallarg(const netbsd32_charp) path;
    340      1.17    dsl 	} */
    341       1.1   manu 	struct sys_swapctl_args ua;
    342       1.1   manu 
    343       1.1   manu         SCARG(&ua, cmd) = SWAP_OFF;
    344       1.7    dsl         SCARG(&ua, arg) = SCARG_P32(uap, path);
    345       1.1   manu         SCARG(&ua, misc) = 0;   /* priority */
    346       1.1   manu         return (sys_swapctl(l, &ua, retval));
    347       1.1   manu }
    348       1.1   manu 
    349       1.1   manu 
    350       1.1   manu int
    351      1.17    dsl linux32_sys_reboot(struct lwp *l, const struct linux32_sys_reboot_args *uap, register_t *retval)
    352       1.1   manu {
    353      1.17    dsl 	/* {
    354       1.1   manu 		syscallarg(int) magic1;
    355       1.1   manu 		syscallarg(int) magic2;
    356       1.1   manu 		syscallarg(int) cmd;
    357       1.1   manu 		syscallarg(netbsd32_voidp) arg;
    358      1.17    dsl 	} */
    359       1.1   manu 	struct linux_sys_reboot_args ua;
    360       1.1   manu 
    361       1.1   manu 	NETBSD32TO64_UAP(magic1);
    362       1.1   manu 	NETBSD32TO64_UAP(magic2);
    363       1.1   manu 	NETBSD32TO64_UAP(cmd);
    364       1.1   manu 	NETBSD32TOP_UAP(arg, void);
    365       1.1   manu 
    366       1.1   manu 	return linux_sys_reboot(l, &ua, retval);
    367       1.1   manu }
    368       1.1   manu 
    369       1.1   manu int
    370      1.17    dsl linux32_sys_truncate(struct lwp *l, const struct linux32_sys_truncate_args *uap, register_t *retval)
    371       1.1   manu {
    372      1.17    dsl 	/* {
    373       1.1   manu 		syscallarg(const netbsd32_charp) path;
    374       1.1   manu 		syscallarg(netbsd32_charp) buf;
    375       1.1   manu 		syscallarg(int) count;
    376      1.17    dsl 	} */
    377       1.1   manu 	struct compat_43_sys_truncate_args ua;
    378       1.1   manu 
    379       1.1   manu 	NETBSD32TOP_UAP(path, const char);
    380       1.1   manu 	NETBSD32TO64_UAP(length);
    381       1.1   manu 
    382       1.1   manu 	return compat_43_sys_truncate(l, &ua, retval);
    383       1.1   manu }
    384       1.1   manu 
    385       1.1   manu int
    386      1.17    dsl linux32_sys_setresuid(struct lwp *l, const struct linux32_sys_setresuid_args *uap, register_t *retval)
    387       1.3   manu {
    388      1.17    dsl 	/* {
    389       1.3   manu 		syscallarg(uid_t) ruid;
    390       1.3   manu 		syscallarg(uid_t) euid;
    391       1.3   manu 		syscallarg(uid_t) suid;
    392      1.17    dsl 	} */
    393       1.3   manu 	struct linux_sys_setresuid_args ua;
    394       1.3   manu 
    395       1.3   manu 	SCARG(&ua, ruid) = (SCARG(uap, ruid) == -1) ? -1 : SCARG(uap, ruid);
    396       1.3   manu 	SCARG(&ua, euid) = (SCARG(uap, euid) == -1) ? -1 : SCARG(uap, euid);
    397       1.3   manu 	SCARG(&ua, suid) = (SCARG(uap, suid) == -1) ? -1 : SCARG(uap, suid);
    398       1.3   manu 
    399       1.3   manu 	return linux_sys_setresuid(l, &ua, retval);
    400       1.3   manu }
    401       1.3   manu 
    402       1.3   manu int
    403      1.17    dsl linux32_sys_setresgid(struct lwp *l, const struct linux32_sys_setresgid_args *uap, register_t *retval)
    404       1.3   manu {
    405      1.17    dsl 	/* {
    406       1.3   manu 		syscallarg(gid_t) rgid;
    407       1.3   manu 		syscallarg(gid_t) egid;
    408       1.3   manu 		syscallarg(gid_t) sgid;
    409      1.17    dsl 	} */
    410       1.3   manu 	struct linux_sys_setresgid_args ua;
    411       1.3   manu 
    412       1.3   manu 	SCARG(&ua, rgid) = (SCARG(uap, rgid) == -1) ? -1 : SCARG(uap, rgid);
    413       1.3   manu 	SCARG(&ua, egid) = (SCARG(uap, egid) == -1) ? -1 : SCARG(uap, egid);
    414       1.3   manu 	SCARG(&ua, sgid) = (SCARG(uap, sgid) == -1) ? -1 : SCARG(uap, sgid);
    415       1.3   manu 
    416       1.3   manu 	return linux_sys_setresgid(l, &ua, retval);
    417       1.3   manu }
    418      1.13  njoly 
    419      1.13  njoly int
    420      1.17    dsl linux32_sys_nice(struct lwp *l, const struct linux32_sys_nice_args *uap, register_t *retval)
    421      1.13  njoly {
    422      1.17    dsl 	/* {
    423      1.13  njoly 		syscallarg(int) incr;
    424      1.17    dsl 	} */
    425  1.21.6.1    mjf 	struct sys_setpriority_args bsa;
    426      1.13  njoly 
    427      1.13  njoly 	SCARG(&bsa, which) = PRIO_PROCESS;
    428      1.13  njoly 	SCARG(&bsa, who) = 0;
    429      1.13  njoly 	SCARG(&bsa, prio) = SCARG(uap, incr);
    430      1.13  njoly 
    431  1.21.6.1    mjf 	return sys_setpriority(l, &bsa, retval);
    432      1.13  njoly }
    433      1.13  njoly 
    434      1.13  njoly int
    435      1.17    dsl linux32_sys_alarm(struct lwp *l, const struct linux32_sys_alarm_args *uap, register_t *retval)
    436      1.13  njoly {
    437      1.17    dsl 	/* {
    438      1.13  njoly 		syscallarg(unsigned int) secs;
    439      1.17    dsl 	} */
    440      1.13  njoly 	struct linux_sys_alarm_args ua;
    441      1.13  njoly 
    442      1.13  njoly 	NETBSD32TO64_UAP(secs);
    443      1.13  njoly 
    444      1.13  njoly 	return linux_sys_alarm(l, &ua, retval);
    445      1.13  njoly }
    446      1.13  njoly 
    447      1.13  njoly int
    448      1.17    dsl linux32_sys_fdatasync(struct lwp *l, const struct linux32_sys_fdatasync_args *uap, register_t *retval)
    449      1.13  njoly {
    450      1.17    dsl 	/* {
    451      1.13  njoly 		syscallarg(int) fd;
    452      1.17    dsl 	} */
    453      1.13  njoly 	struct linux_sys_fdatasync_args ua;
    454      1.13  njoly 
    455      1.13  njoly 	NETBSD32TO64_UAP(fd);
    456      1.13  njoly 
    457      1.13  njoly 	return linux_sys_fdatasync(l, &ua, retval);
    458      1.13  njoly }
    459      1.13  njoly 
    460      1.13  njoly int
    461      1.17    dsl linux32_sys_setfsuid(struct lwp *l, const struct linux32_sys_setfsuid_args *uap, register_t *retval)
    462      1.13  njoly {
    463      1.17    dsl 	/* {
    464      1.13  njoly 		syscallarg(uid_t) uid;
    465      1.17    dsl 	} */
    466      1.13  njoly 	struct linux_sys_setfsuid_args ua;
    467      1.13  njoly 
    468      1.13  njoly 	NETBSD32TO64_UAP(uid);
    469      1.13  njoly 
    470      1.13  njoly 	return linux_sys_setfsuid(l, &ua, retval);
    471      1.13  njoly }
    472      1.13  njoly 
    473      1.13  njoly int
    474      1.18  njoly linux32_sys_setfsgid(struct lwp *l, const struct linux32_sys_setfsgid_args *uap, register_t *retval)
    475      1.18  njoly {
    476      1.18  njoly 	/* {
    477      1.18  njoly 		syscallarg(gid_t) gid;
    478      1.18  njoly 	} */
    479      1.18  njoly 	struct linux_sys_setfsgid_args ua;
    480      1.18  njoly 
    481      1.18  njoly 	NETBSD32TO64_UAP(gid);
    482      1.18  njoly 
    483      1.18  njoly 	return linux_sys_setfsgid(l, &ua, retval);
    484      1.18  njoly }
    485      1.20    dsl 
    486      1.20    dsl /*
    487      1.20    dsl  * pread(2).
    488      1.20    dsl  */
    489      1.20    dsl int
    490      1.20    dsl linux32_sys_pread(struct lwp *l,
    491      1.20    dsl     const struct linux32_sys_pread_args *uap, register_t *retval)
    492      1.20    dsl {
    493      1.20    dsl 	/* {
    494      1.20    dsl 		syscallarg(int) fd;
    495      1.21  njoly 		syscallarg(netbsd32_voidp) buf;
    496      1.20    dsl 		syscallarg(netbsd32_size_t) nbyte;
    497      1.21  njoly 		syscallarg(linux32_off_t) offset;
    498      1.20    dsl 	} */
    499      1.20    dsl 	struct sys_pread_args pra;
    500      1.20    dsl 
    501      1.20    dsl 	SCARG(&pra, fd) = SCARG(uap, fd);
    502      1.21  njoly 	SCARG(&pra, buf) = SCARG_P32(uap, buf);
    503      1.20    dsl 	SCARG(&pra, nbyte) = SCARG(uap, nbyte);
    504      1.20    dsl 	SCARG(&pra, offset) = SCARG(uap, offset);
    505      1.20    dsl 
    506      1.20    dsl 	return sys_pread(l, &pra, retval);
    507      1.20    dsl }
    508      1.20    dsl 
    509      1.20    dsl /*
    510      1.20    dsl  * pwrite(2).
    511      1.20    dsl  */
    512      1.20    dsl int
    513      1.20    dsl linux32_sys_pwrite(struct lwp *l,
    514      1.20    dsl     const struct linux32_sys_pwrite_args *uap, register_t *retval)
    515      1.20    dsl {
    516      1.20    dsl 	/* {
    517      1.20    dsl 		syscallarg(int) fd;
    518      1.21  njoly 		syscallarg(const netbsd32_voidp) buf;
    519      1.20    dsl 		syscallarg(netbsd32_size_t) nbyte;
    520      1.21  njoly 		syscallarg(linux32_off_t) offset;
    521      1.20    dsl 	} */
    522      1.20    dsl 	struct sys_pwrite_args pra;
    523      1.20    dsl 
    524      1.20    dsl 	SCARG(&pra, fd) = SCARG(uap, fd);
    525      1.21  njoly 	SCARG(&pra, buf) = SCARG_P32(uap, buf);
    526      1.20    dsl 	SCARG(&pra, nbyte) = SCARG(uap, nbyte);
    527      1.20    dsl 	SCARG(&pra, offset) = SCARG(uap, offset);
    528      1.20    dsl 
    529      1.20    dsl 	return sys_pwrite(l, &pra, retval);
    530      1.20    dsl }
    531      1.20    dsl 
    532