Index: sys/amd64/linux32/linux32_dummy.c =================================================================== --- sys/amd64/linux32/linux32_dummy.c +++ sys/amd64/linux32/linux32_dummy.c @@ -133,8 +133,6 @@ DUMMY(recvmmsg); DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.36: */ -DUMMY(prlimit64); /* later: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); Index: sys/amd64/linux32/syscalls.master =================================================================== --- sys/amd64/linux32/syscalls.master +++ sys/amd64/linux32/syscalls.master @@ -553,7 +553,10 @@ 338 AUE_NULL STD { int linux_fanotify_init(void); } 339 AUE_NULL STD { int linux_fanotify_mark(void); } ; linux 2.6.36: -340 AUE_NULL STD { int linux_prlimit64(void); } +340 AUE_NULL STD { int linux_prlimit64(l_pid_t pid, \ + l_uint resource, \ + struct rlimit *new, \ + struct rlimit *old); } ; later: 341 AUE_NULL STD { int linux_name_to_handle_at(void); } 342 AUE_NULL STD { int linux_open_by_handle_at(void); } Index: sys/compat/linux/linux_misc.c =================================================================== --- sys/compat/linux/linux_misc.c +++ sys/compat/linux/linux_misc.c @@ -2016,3 +2016,58 @@ *bsdopts |= WLINUXCLONE; } +int +linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args) +{ + struct rlimit rlim; + struct proc *p; + u_int which; + int error; + +#ifdef DEBUG + if (ldebug(prlimit64)) + printf(ARGS(prlimit64, "%d, %d, %p, %p"), args->pid, + args->resource, (void *)args->new, (void *)args->old); +#endif + + if (args->resource >= LINUX_RLIM_NLIMITS) + return (EINVAL); + + which = linux_to_bsd_resource[args->resource]; + if (which == -1) + return (EINVAL); + + if (args->pid == 0) { + p = td->td_proc; + PROC_LOCK(p); + } else { + p = pfind(args->pid); + if (p == NULL) + return (ESRCH); + } + error = p_cansee(td, p); + if (error) { + PROC_UNLOCK(p); + return (EPERM); + } + + _PHOLD(p); + + if (args->old) { + lim_rlimit(p, which, &rlim); + PROC_UNLOCK(p); + error = copyout(&rlim, args->old, sizeof(rlim)); + if (error) + goto out; + } else + PROC_UNLOCK(p); + + if (args->new) { + error = copyin(args->new, &rlim, sizeof(rlim)); + if (error == 0) + error = kern_proc_setrlimit(td, p, which, &rlim); + } +out: + PRELE(p); + return (error); +} Index: sys/i386/linux/linux_dummy.c =================================================================== --- sys/i386/linux/linux_dummy.c +++ sys/i386/linux/linux_dummy.c @@ -129,8 +129,6 @@ DUMMY(recvmmsg); DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.36: */ -DUMMY(prlimit64); /* later: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); Index: sys/i386/linux/syscalls.master =================================================================== --- sys/i386/linux/syscalls.master +++ sys/i386/linux/syscalls.master @@ -561,7 +561,10 @@ 338 AUE_NULL STD { int linux_fanotify_init(void); } 339 AUE_NULL STD { int linux_fanotify_mark(void); } ; linux 2.6.36: -340 AUE_NULL STD { int linux_prlimit64(void); } +340 AUE_NULL STD { int linux_prlimit64(l_pid_t pid, \ + l_uint resource, \ + struct rlimit *new, \ + struct rlimit *old); } ; later: 341 AUE_NULL STD { int linux_name_to_handle_at(void); } 342 AUE_NULL STD { int linux_open_by_handle_at(void); }