2 * Copyright (c) 2004 Tim J. Robbins
3 * Copyright (c) 2002 Doug Rabson
4 * Copyright (c) 2000 Marcel Moolenaar
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer
12 * in this position and unchanged.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include <sys/cdefs.h>
32 __FBSDID("$FreeBSD$");
34 #include <sys/param.h>
35 #include <sys/kernel.h>
36 #include <sys/systm.h>
37 #include <sys/imgact.h>
39 #include <sys/malloc.h>
41 #include <sys/mutex.h>
43 #include <sys/resource.h>
44 #include <sys/resourcevar.h>
45 #include <sys/syscallsubr.h>
46 #include <sys/sysproto.h>
47 #include <sys/unistd.h>
49 #include <machine/frame.h>
53 #include <vm/vm_extern.h>
54 #include <vm/vm_kern.h>
55 #include <vm/vm_map.h>
57 #include <amd64/linux32/linux.h>
58 #include <amd64/linux32/linux32_proto.h>
59 #include <compat/linux/linux_ipc.h>
60 #include <compat/linux/linux_signal.h>
61 #include <compat/linux/linux_util.h>
63 struct l_old_select_argv {
67 l_uintptr_t exceptfds;
72 linux_to_bsd_sigaltstack(int lsa)
76 if (lsa & LINUX_SS_DISABLE)
78 if (lsa & LINUX_SS_ONSTACK)
84 bsd_to_linux_sigaltstack(int bsa)
89 lsa |= LINUX_SS_DISABLE;
91 lsa |= LINUX_SS_ONSTACK;
96 * Custom version of exec_copyin_args() so that we can translate
100 linux_exec_copyin_args(struct image_args *args, char *fname,
101 enum uio_seg segflg, char **argv, char **envv)
108 bzero(args, sizeof(*args));
113 * Allocate temporary demand zeroed space for argument and
114 * environment strings
116 args->buf = (char *) kmem_alloc_wait(exec_map, PATH_MAX + ARG_MAX);
117 if (args->buf == NULL)
119 args->begin_argv = args->buf;
120 args->endp = args->begin_argv;
121 args->stringspace = ARG_MAX;
123 args->fname = args->buf + ARG_MAX;
126 * Copy the file name.
128 error = (segflg == UIO_SYSSPACE) ?
129 copystr(fname, args->fname, PATH_MAX, &length) :
130 copyinstr(fname, args->fname, PATH_MAX, &length);
135 * extract arguments first
137 p32 = (u_int32_t *)argv;
139 error = copyin(p32++, &arg, sizeof(arg));
145 error = copyinstr(argp, args->endp, args->stringspace, &length);
147 if (error == ENAMETOOLONG)
152 args->stringspace -= length;
153 args->endp += length;
157 args->begin_envv = args->endp;
160 * extract environment strings
163 p32 = (u_int32_t *)envv;
165 error = copyin(p32++, &arg, sizeof(arg));
171 error = copyinstr(envp, args->endp, args->stringspace,
174 if (error == ENAMETOOLONG)
179 args->stringspace -= length;
180 args->endp += length;
189 linux_execve(struct thread *td, struct linux_execve_args *args)
191 struct image_args eargs;
195 LCONVPATHEXIST(td, args->path, &path);
199 printf(ARGS(execve, "%s"), path);
202 error = linux_exec_copyin_args(&eargs, path, UIO_SYSSPACE, args->argp,
206 error = kern_execve(td, &eargs, NULL);
207 exec_free_args(&eargs);
216 CTASSERT(sizeof(struct iovec32) == 8);
219 linux32_copyinuio(struct iovec32 *iovp, u_int iovcnt, struct uio **uiop)
221 struct iovec32 iov32;
228 if (iovcnt > UIO_MAXIOV)
230 iovlen = iovcnt * sizeof(struct iovec);
231 uio = malloc(iovlen + sizeof *uio, M_IOV, M_WAITOK);
232 iov = (struct iovec *)(uio + 1);
233 for (i = 0; i < iovcnt; i++) {
234 error = copyin(&iovp[i], &iov32, sizeof(struct iovec32));
239 iov[i].iov_base = PTRIN(iov32.iov_base);
240 iov[i].iov_len = iov32.iov_len;
243 uio->uio_iovcnt = iovcnt;
244 uio->uio_segflg = UIO_USERSPACE;
245 uio->uio_offset = -1;
247 for (i = 0; i < iovcnt; i++) {
248 if (iov->iov_len > INT_MAX - uio->uio_resid) {
252 uio->uio_resid += iov->iov_len;
260 linux_readv(struct thread *td, struct linux_readv_args *uap)
265 error = linux32_copyinuio(uap->iovp, uap->iovcnt, &auio);
268 error = kern_readv(td, uap->fd, auio);
274 linux_writev(struct thread *td, struct linux_writev_args *uap)
279 error = linux32_copyinuio(uap->iovp, uap->iovcnt, &auio);
282 error = kern_writev(td, uap->fd, auio);
287 struct l_ipc_kludge {
293 linux_ipc(struct thread *td, struct linux_ipc_args *args)
296 switch (args->what & 0xFFFF) {
298 struct linux_semop_args a;
300 a.semid = args->arg1;
302 a.nsops = args->arg2;
303 return (linux_semop(td, &a));
306 struct linux_semget_args a;
309 a.nsems = args->arg2;
310 a.semflg = args->arg3;
311 return (linux_semget(td, &a));
314 struct linux_semctl_args a;
317 a.semid = args->arg1;
318 a.semnum = args->arg2;
320 error = copyin(args->ptr, &a.arg, sizeof(a.arg));
323 return (linux_semctl(td, &a));
326 struct linux_msgsnd_args a;
328 a.msqid = args->arg1;
330 a.msgsz = args->arg2;
331 a.msgflg = args->arg3;
332 return (linux_msgsnd(td, &a));
335 struct linux_msgrcv_args a;
337 a.msqid = args->arg1;
338 a.msgsz = args->arg2;
339 a.msgflg = args->arg3;
340 if ((args->what >> 16) == 0) {
341 struct l_ipc_kludge tmp;
346 error = copyin(args->ptr, &tmp, sizeof(tmp));
349 a.msgp = PTRIN(tmp.msgp);
350 a.msgtyp = tmp.msgtyp;
353 a.msgtyp = args->arg5;
355 return (linux_msgrcv(td, &a));
358 struct linux_msgget_args a;
361 a.msgflg = args->arg2;
362 return (linux_msgget(td, &a));
365 struct linux_msgctl_args a;
367 a.msqid = args->arg1;
370 return (linux_msgctl(td, &a));
373 struct linux_shmat_args a;
375 a.shmid = args->arg1;
376 a.shmaddr = args->ptr;
377 a.shmflg = args->arg2;
378 a.raddr = PTRIN((l_uint)args->arg3);
379 return (linux_shmat(td, &a));
382 struct linux_shmdt_args a;
384 a.shmaddr = args->ptr;
385 return (linux_shmdt(td, &a));
388 struct linux_shmget_args a;
392 a.shmflg = args->arg3;
393 return (linux_shmget(td, &a));
396 struct linux_shmctl_args a;
398 a.shmid = args->arg1;
401 return (linux_shmctl(td, &a));
411 linux_old_select(struct thread *td, struct linux_old_select_args *args)
413 struct l_old_select_argv linux_args;
414 struct linux_select_args newsel;
418 if (ldebug(old_select))
419 printf(ARGS(old_select, "%p"), args->ptr);
422 error = copyin(args->ptr, &linux_args, sizeof(linux_args));
426 newsel.nfds = linux_args.nfds;
427 newsel.readfds = PTRIN(linux_args.readfds);
428 newsel.writefds = PTRIN(linux_args.writefds);
429 newsel.exceptfds = PTRIN(linux_args.exceptfds);
430 newsel.timeout = PTRIN(linux_args.timeout);
431 return (linux_select(td, &newsel));
435 linux_fork(struct thread *td, struct linux_fork_args *args)
441 printf(ARGS(fork, ""));
444 if ((error = fork(td, (struct fork_args *)args)) != 0)
447 if (td->td_retval[1] == 1)
448 td->td_retval[0] = 0;
453 linux_vfork(struct thread *td, struct linux_vfork_args *args)
459 printf(ARGS(vfork, ""));
462 if ((error = vfork(td, (struct vfork_args *)args)) != 0)
464 /* Are we the child? */
465 if (td->td_retval[1] == 1)
466 td->td_retval[0] = 0;
470 #define CLONE_VM 0x100
471 #define CLONE_FS 0x200
472 #define CLONE_FILES 0x400
473 #define CLONE_SIGHAND 0x800
474 #define CLONE_PID 0x1000
477 linux_clone(struct thread *td, struct linux_clone_args *args)
479 int error, ff = RFPROC | RFSTOPPED;
486 printf(ARGS(clone, "flags %x, stack %x"),
487 (unsigned int)(uintptr_t)args->flags,
488 (unsigned int)(uintptr_t)args->stack);
489 if (args->flags & CLONE_PID)
490 printf(LMSG("CLONE_PID not yet supported"));
497 exit_signal = args->flags & 0x000000ff;
498 if (exit_signal >= LINUX_NSIG)
501 if (exit_signal <= LINUX_SIGTBLSZ)
502 exit_signal = linux_to_bsd_signal[_SIG_IDX(exit_signal)];
504 if (args->flags & CLONE_VM)
506 if (args->flags & CLONE_SIGHAND)
508 if (!(args->flags & CLONE_FILES))
511 error = fork1(td, ff, 0, &p2);
517 p2->p_sigparent = exit_signal;
519 td2 = FIRST_THREAD_IN_PROC(p2);
520 td2->td_frame->tf_rsp = PTROUT(args->stack);
524 printf(LMSG("clone: successful rfork to %ld, stack %p sig = %d"),
525 (long)p2->p_pid, args->stack, exit_signal);
529 * Make this runnable after we are finished with it.
531 mtx_lock_spin(&sched_lock);
533 setrunqueue(td2, SRQ_BORING);
534 mtx_unlock_spin(&sched_lock);
536 td->td_retval[0] = p2->p_pid;
537 td->td_retval[1] = 0;
551 #define STACK_SIZE (2 * 1024 * 1024)
552 #define GUARD_SIZE (4 * PAGE_SIZE)
554 static int linux_mmap_common(struct thread *, struct l_mmap_argv *);
557 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
559 struct l_mmap_argv linux_args;
563 printf(ARGS(mmap2, "%p, %d, %d, 0x%08x, %d, %d"),
564 (void *)(intptr_t)args->addr, args->len, args->prot,
565 args->flags, args->fd, args->pgoff);
568 linux_args.addr = PTROUT(args->addr);
569 linux_args.len = args->len;
570 linux_args.prot = args->prot;
571 linux_args.flags = args->flags;
572 linux_args.fd = args->fd;
573 linux_args.pgoff = args->pgoff;
575 return (linux_mmap_common(td, &linux_args));
579 linux_mmap(struct thread *td, struct linux_mmap_args *args)
582 struct l_mmap_argv linux_args;
584 error = copyin(args->ptr, &linux_args, sizeof(linux_args));
590 printf(ARGS(mmap, "%p, %d, %d, 0x%08x, %d, %d"),
591 (void *)(intptr_t)linux_args.addr, linux_args.len,
592 linux_args.prot, linux_args.flags, linux_args.fd,
595 if ((linux_args.pgoff % PAGE_SIZE) != 0)
597 linux_args.pgoff /= PAGE_SIZE;
599 return (linux_mmap_common(td, &linux_args));
603 linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
605 struct proc *p = td->td_proc;
606 struct mmap_args /* {
619 if (linux_args->flags & LINUX_MAP_SHARED)
620 bsd_args.flags |= MAP_SHARED;
621 if (linux_args->flags & LINUX_MAP_PRIVATE)
622 bsd_args.flags |= MAP_PRIVATE;
623 if (linux_args->flags & LINUX_MAP_FIXED)
624 bsd_args.flags |= MAP_FIXED;
625 if (linux_args->flags & LINUX_MAP_ANON)
626 bsd_args.flags |= MAP_ANON;
628 bsd_args.flags |= MAP_NOSYNC;
629 if (linux_args->flags & LINUX_MAP_GROWSDOWN) {
630 bsd_args.flags |= MAP_STACK;
632 /* The linux MAP_GROWSDOWN option does not limit auto
633 * growth of the region. Linux mmap with this option
634 * takes as addr the inital BOS, and as len, the initial
635 * region size. It can then grow down from addr without
636 * limit. However, linux threads has an implicit internal
637 * limit to stack size of STACK_SIZE. Its just not
638 * enforced explicitly in linux. But, here we impose
639 * a limit of (STACK_SIZE - GUARD_SIZE) on the stack
640 * region, since we can do this with our mmap.
642 * Our mmap with MAP_STACK takes addr as the maximum
643 * downsize limit on BOS, and as len the max size of
644 * the region. It them maps the top SGROWSIZ bytes,
645 * and autgrows the region down, up to the limit
648 * If we don't use the MAP_STACK option, the effect
649 * of this code is to allocate a stack region of a
650 * fixed size of (STACK_SIZE - GUARD_SIZE).
653 /* This gives us TOS */
654 bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) +
657 if ((caddr_t)PTRIN(bsd_args.addr) >
658 p->p_vmspace->vm_maxsaddr) {
659 /* Some linux apps will attempt to mmap
660 * thread stacks near the top of their
661 * address space. If their TOS is greater
662 * than vm_maxsaddr, vm_map_growstack()
663 * will confuse the thread stack with the
664 * process stack and deliver a SEGV if they
665 * attempt to grow the thread stack past their
666 * current stacksize rlimit. To avoid this,
667 * adjust vm_maxsaddr upwards to reflect
668 * the current stacksize rlimit rather
669 * than the maximum possible stacksize.
670 * It would be better to adjust the
671 * mmap'ed region, but some apps do not check
672 * mmap's return value.
675 p->p_vmspace->vm_maxsaddr =
676 (char *)LINUX32_USRSTACK -
677 lim_cur(p, RLIMIT_STACK);
681 /* This gives us our maximum stack size */
682 if (linux_args->len > STACK_SIZE - GUARD_SIZE)
683 bsd_args.len = linux_args->len;
685 bsd_args.len = STACK_SIZE - GUARD_SIZE;
687 /* This gives us a new BOS. If we're using VM_STACK, then
688 * mmap will just map the top SGROWSIZ bytes, and let
689 * the stack grow down to the limit at BOS. If we're
690 * not using VM_STACK we map the full stack, since we
691 * don't have a way to autogrow it.
693 bsd_args.addr -= bsd_args.len;
695 bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
696 bsd_args.len = linux_args->len;
699 * XXX i386 Linux always emulator forces PROT_READ on (why?)
700 * so we do the same. We add PROT_EXEC to work around buggy
701 * applications (e.g. Java) that take advantage of the fact
702 * that execute permissions are not enforced by x86 CPUs.
704 bsd_args.prot = linux_args->prot | PROT_EXEC | PROT_READ;
705 if (linux_args->flags & LINUX_MAP_ANON)
708 bsd_args.fd = linux_args->fd;
709 bsd_args.pos = (off_t)linux_args->pgoff * PAGE_SIZE;
714 printf("-> %s(%p, %d, %d, 0x%08x, %d, 0x%x)\n",
716 (void *)bsd_args.addr, (int)bsd_args.len, bsd_args.prot,
717 bsd_args.flags, bsd_args.fd, (int)bsd_args.pos);
719 error = mmap(td, &bsd_args);
722 printf("-> %s() return: 0x%x (0x%08x)\n",
723 __func__, error, (u_int)td->td_retval[0]);
729 linux_pipe(struct thread *td, struct linux_pipe_args *args)
737 printf(ARGS(pipe, "*"));
740 reg_rdx = td->td_retval[1];
743 td->td_retval[1] = reg_rdx;
747 pip[0] = td->td_retval[0];
748 pip[1] = td->td_retval[1];
749 error = copyout(pip, args->pipefds, 2 * sizeof(int));
751 td->td_retval[1] = reg_rdx;
755 td->td_retval[1] = reg_rdx;
756 td->td_retval[0] = 0;
761 linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
764 l_sigaction_t act, oact;
768 if (ldebug(sigaction))
769 printf(ARGS(sigaction, "%d, %p, %p"),
770 args->sig, (void *)args->nsa, (void *)args->osa);
773 if (args->nsa != NULL) {
774 error = copyin(args->nsa, &osa, sizeof(l_osigaction_t));
777 act.lsa_handler = osa.lsa_handler;
778 act.lsa_flags = osa.lsa_flags;
779 act.lsa_restorer = osa.lsa_restorer;
780 LINUX_SIGEMPTYSET(act.lsa_mask);
781 act.lsa_mask.__bits[0] = osa.lsa_mask;
784 error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL,
785 args->osa ? &oact : NULL);
787 if (args->osa != NULL && !error) {
788 osa.lsa_handler = oact.lsa_handler;
789 osa.lsa_flags = oact.lsa_flags;
790 osa.lsa_restorer = oact.lsa_restorer;
791 osa.lsa_mask = oact.lsa_mask.__bits[0];
792 error = copyout(&osa, args->osa, sizeof(l_osigaction_t));
799 * Linux has two extra args, restart and oldmask. We dont use these,
800 * but it seems that "restart" is actually a context pointer that
801 * enables the signal to happen with a different register set.
804 linux_sigsuspend(struct thread *td, struct linux_sigsuspend_args *args)
810 if (ldebug(sigsuspend))
811 printf(ARGS(sigsuspend, "%08lx"), (unsigned long)args->mask);
814 LINUX_SIGEMPTYSET(mask);
815 mask.__bits[0] = args->mask;
816 linux_to_bsd_sigset(&mask, &sigmask);
817 return (kern_sigsuspend(td, sigmask));
821 linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
828 if (ldebug(rt_sigsuspend))
829 printf(ARGS(rt_sigsuspend, "%p, %d"),
830 (void *)uap->newset, uap->sigsetsize);
833 if (uap->sigsetsize != sizeof(l_sigset_t))
836 error = copyin(uap->newset, &lmask, sizeof(l_sigset_t));
840 linux_to_bsd_sigset(&lmask, &sigmask);
841 return (kern_sigsuspend(td, sigmask));
845 linux_pause(struct thread *td, struct linux_pause_args *args)
847 struct proc *p = td->td_proc;
852 printf(ARGS(pause, ""));
856 sigmask = td->td_sigmask;
858 return (kern_sigsuspend(td, sigmask));
862 linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
869 if (ldebug(sigaltstack))
870 printf(ARGS(sigaltstack, "%p, %p"), uap->uss, uap->uoss);
873 if (uap->uss != NULL) {
874 error = copyin(uap->uss, &lss, sizeof(l_stack_t));
878 ss.ss_sp = PTRIN(lss.ss_sp);
879 ss.ss_size = lss.ss_size;
880 ss.ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags);
882 error = kern_sigaltstack(td, (uap->uss != NULL) ? &ss : NULL,
883 (uap->uoss != NULL) ? &oss : NULL);
884 if (!error && uap->uoss != NULL) {
885 lss.ss_sp = PTROUT(oss.ss_sp);
886 lss.ss_size = oss.ss_size;
887 lss.ss_flags = bsd_to_linux_sigaltstack(oss.ss_flags);
888 error = copyout(&lss, uap->uoss, sizeof(l_stack_t));
895 linux_ftruncate64(struct thread *td, struct linux_ftruncate64_args *args)
897 struct ftruncate_args sa;
900 if (ldebug(ftruncate64))
901 printf(ARGS(ftruncate64, "%u, %jd"), args->fd,
902 (intmax_t)args->length);
907 sa.length = args->length;
908 return ftruncate(td, &sa);
912 linux_gettimeofday(struct thread *td, struct linux_gettimeofday_args *uap)
921 atv32.tv_sec = atv.tv_sec;
922 atv32.tv_usec = atv.tv_usec;
923 error = copyout(&atv32, uap->tp, sizeof (atv32));
925 if (error == 0 && uap->tzp != NULL) {
926 rtz.tz_minuteswest = tz_minuteswest;
927 rtz.tz_dsttime = tz_dsttime;
928 error = copyout(&rtz, uap->tzp, sizeof (rtz));
934 linux_nanosleep(struct thread *td, struct linux_nanosleep_args *uap)
936 struct timespec rqt, rmt;
937 struct l_timespec ats32;
940 error = copyin(uap->rqtp, &ats32, sizeof(ats32));
943 rqt.tv_sec = ats32.tv_sec;
944 rqt.tv_nsec = ats32.tv_nsec;
945 error = kern_nanosleep(td, &rqt, &rmt);
946 if (uap->rmtp != NULL) {
947 ats32.tv_sec = rmt.tv_sec;
948 ats32.tv_nsec = rmt.tv_nsec;
949 error = copyout(&ats32, uap->rmtp, sizeof(ats32));
955 linux_getrusage(struct thread *td, struct linux_getrusage_args *uap)
961 error = kern_getrusage(td, uap->who, &s);
964 if (uap->rusage != NULL) {
965 s32.ru_utime.tv_sec = s.ru_utime.tv_sec;
966 s32.ru_utime.tv_usec = s.ru_utime.tv_usec;
967 s32.ru_stime.tv_sec = s.ru_stime.tv_sec;
968 s32.ru_stime.tv_usec = s.ru_stime.tv_usec;
969 s32.ru_maxrss = s.ru_maxrss;
970 s32.ru_ixrss = s.ru_ixrss;
971 s32.ru_idrss = s.ru_idrss;
972 s32.ru_isrss = s.ru_isrss;
973 s32.ru_minflt = s.ru_minflt;
974 s32.ru_majflt = s.ru_majflt;
975 s32.ru_nswap = s.ru_nswap;
976 s32.ru_inblock = s.ru_inblock;
977 s32.ru_oublock = s.ru_oublock;
978 s32.ru_msgsnd = s.ru_msgsnd;
979 s32.ru_msgrcv = s.ru_msgrcv;
980 s32.ru_nsignals = s.ru_nsignals;
981 s32.ru_nvcsw = s.ru_nvcsw;
982 s32.ru_nivcsw = s.ru_nivcsw;
983 error = copyout(&s32, uap->rusage, sizeof(s32));
989 linux_sched_rr_get_interval(struct thread *td,
990 struct linux_sched_rr_get_interval_args *uap)
993 struct l_timespec ts32;
996 error = kern_sched_rr_get_interval(td, uap->pid, &ts);
999 ts32.tv_sec = ts.tv_sec;
1000 ts32.tv_nsec = ts.tv_nsec;
1001 return (copyout(&ts32, uap->interval, sizeof(ts32)));
1005 linux_mprotect(struct thread *td, struct linux_mprotect_args *uap)
1007 struct mprotect_args bsd_args;
1009 bsd_args.addr = uap->addr;
1010 bsd_args.len = uap->len;
1011 bsd_args.prot = uap->prot;
1012 /* XXX PROT_READ implies PROT_EXEC; see linux_mmap_common(). */
1013 if ((bsd_args.prot & PROT_READ) != 0)
1014 bsd_args.prot |= PROT_EXEC;
1015 return (mprotect(td, &bsd_args));