Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106016576
D1050.id4411.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D1050.id4411.diff
View Options
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
@@ -554,7 +554,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
@@ -2035,6 +2035,71 @@
}
int
+linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args)
+{
+ struct rlimit rlim, nrlim;
+ 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);
+
+ /*
+ * Note. Unlike FreeBSD where rlim is signed 64-bit Linux rlim
+ * is unsigned 64-bit. FreeBSD treats negative limits as INFINITY
+ * so we do not need a conversion even.
+ */
+ if (args->new != NULL) {
+ error = copyin(args->new, &nrlim, sizeof(struct rlimit));
+ if (error != 0)
+ return (error);
+ }
+
+ 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 != 0) {
+ PROC_UNLOCK(p);
+ return (EPERM);
+ }
+ }
+
+ _PHOLD(p);
+
+ if (args->old != NULL) {
+ lim_rlimit(p, which, &rlim);
+ PROC_UNLOCK(p);
+ error = copyout(&rlim, args->old, sizeof(struct rlimit));
+ if (error != 0)
+ goto out;
+ } else
+ PROC_UNLOCK(p);
+
+ if (args->new != NULL)
+ error = kern_proc_setrlimit(td, p, which, &nrlim);
+
+ out:
+ PRELE(p);
+ return (error);
+}
+
+int
linux_sched_rr_get_interval(struct thread *td,
struct linux_sched_rr_get_interval_args *uap)
{
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
@@ -562,7 +562,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); }
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 11:21 PM (10 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15591718
Default Alt Text
D1050.id4411.diff (3 KB)
Attached To
Mode
D1050: Implement prlimit64() system call.
Attached
Detach File
Event Timeline
Log In to Comment