118 lines
4.1 KiB
Diff
118 lines
4.1 KiB
Diff
|
From agraf@suse.de Thu, 29 Sep 2011 11:00:25 +0200
|
||
|
Return-Path: <agraf@suse.de>
|
||
|
Received: from imap.suse.de ([unix socket])
|
||
|
by imap-int (Cyrus v2.2.12) with LMTPA;
|
||
|
Thu, 29 Sep 2011 11:07:10 +0200
|
||
|
X-Sieve: CMU Sieve 2.2
|
||
|
Received: from relay2.suse.de (relay2.suse.de [149.44.160.134])
|
||
|
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
|
||
|
(Client CN "relay.suse.de", Issuer "CAcert Class 3 Root" (verified OK))
|
||
|
by imap.suse.de (Postfix) with ESMTPS id AF8563C539A9
|
||
|
for <adrian@imap.suse.de>; Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
|
||
|
Received: by relay2.suse.de (Postfix)
|
||
|
id A639118552E6; Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
|
||
|
Received: from imap.suse.de (loadbalancer1.suse.de [149.44.160.248])
|
||
|
(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
|
||
|
(No client certificate requested)
|
||
|
by relay2.suse.de (Postfix) with ESMTPS id A573518552E1;
|
||
|
Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
|
||
|
Received: from localhost.localdomain (charybdis-ext.suse.de [195.135.221.2])
|
||
|
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
|
||
|
(Client did not present a certificate)
|
||
|
by imap.suse.de (Postfix) with ESMTPSA id 7AD993C539A9;
|
||
|
Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
|
||
|
From: Alexander Graf <agraf@suse.de>
|
||
|
To: adrian@suse.de
|
||
|
Cc: Peter Maydell <peter.maydell@linaro.org>, Riku Voipio <riku.voipio@linaro.org>
|
||
|
Subject: [PATCH] linux-user: Implement prlimit64 syscall
|
||
|
Date: Thu, 29 Sep 2011 11:00:25 +0200
|
||
|
Message-Id: <1317286825-2033-1-git-send-email-agraf@suse.de>
|
||
|
X-Mailer: git-send-email 1.6.0.2
|
||
|
|
||
|
From: Peter Maydell <peter.maydell@linaro.org>
|
||
|
|
||
|
Implement the prlimit64 syscall.
|
||
|
|
||
|
Slightly modified to apply upstream -Riku
|
||
|
|
||
|
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||
|
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
|
||
|
|
||
|
Index: qemu-0.14.1/linux-user/syscall.c
|
||
|
===================================================================
|
||
|
--- qemu-0.14.1.orig/linux-user/syscall.c
|
||
|
+++ qemu-0.14.1/linux-user/syscall.c
|
||
|
@@ -524,6 +524,21 @@ static int sys_inotify_init1(int flags)
|
||
|
#endif /* CONFIG_INOTIFY */
|
||
|
|
||
|
|
||
|
+#if defined(TARGET_NR_prlimit64)
|
||
|
+#ifndef __NR_prlimit64
|
||
|
+# define __NR_prlimit64 -1
|
||
|
+#endif
|
||
|
+#define __NR_sys_prlimit64 __NR_prlimit64
|
||
|
+/* The glibc rlimit structure may not be that used by the underlying syscall */
|
||
|
+struct host_rlimit64 {
|
||
|
+ uint64_t rlim_cur;
|
||
|
+ uint64_t rlim_max;
|
||
|
+};
|
||
|
+_syscall4(int, sys_prlimit64, pid_t, pid, int, resource,
|
||
|
+ const struct host_rlimit64 *, new_limit,
|
||
|
+ struct host_rlimit64 *, old_limit)
|
||
|
+#endif
|
||
|
+
|
||
|
extern int personality(int);
|
||
|
extern int flock(int, int);
|
||
|
extern int setfsuid(int);
|
||
|
@@ -7620,6 +7635,34 @@ abi_long do_syscall(void *cpu_env, int n
|
||
|
break;
|
||
|
}
|
||
|
#endif
|
||
|
+#ifdef TARGET_NR_prlimit64
|
||
|
+ case TARGET_NR_prlimit64:
|
||
|
+ {
|
||
|
+ /* args: pid, resource number, ptr to new rlimit, ptr to old rlimit */
|
||
|
+ struct target_rlimit64 *target_rnew, *target_rold;
|
||
|
+ struct host_rlimit64 rnew, rold, *rnewp = 0;
|
||
|
+ if (arg3) {
|
||
|
+ if (!lock_user_struct(VERIFY_READ, target_rnew, arg3, 1)) {
|
||
|
+ goto efault;
|
||
|
+ }
|
||
|
+ rnew.rlim_cur = tswap64(target_rnew->rlim_cur);
|
||
|
+ rnew.rlim_max = tswap64(target_rnew->rlim_max);
|
||
|
+ unlock_user_struct(target_rnew, arg3, 0);
|
||
|
+ rnewp = &rnew;
|
||
|
+ }
|
||
|
+
|
||
|
+ ret = get_errno(sys_prlimit64(arg1, arg2, rnewp, arg4 ? &rold : 0));
|
||
|
+ if (!is_error(ret) && arg4) {
|
||
|
+ if (!lock_user_struct(VERIFY_WRITE, target_rold, arg4, 1)) {
|
||
|
+ goto efault;
|
||
|
+ }
|
||
|
+ target_rold->rlim_cur = tswap64(rold.rlim_cur);
|
||
|
+ target_rold->rlim_max = tswap64(rold.rlim_max);
|
||
|
+ unlock_user_struct(target_rold, arg4, 1);
|
||
|
+ }
|
||
|
+ break;
|
||
|
+ }
|
||
|
+#endif
|
||
|
|
||
|
default:
|
||
|
unimplemented:
|
||
|
Index: qemu-0.14.1/linux-user/syscall_defs.h
|
||
|
===================================================================
|
||
|
--- qemu-0.14.1.orig/linux-user/syscall_defs.h
|
||
|
+++ qemu-0.14.1/linux-user/syscall_defs.h
|
||
|
@@ -2237,6 +2237,11 @@ struct target_mq_attr {
|
||
|
abi_long mq_curmsgs;
|
||
|
};
|
||
|
|
||
|
+struct target_rlimit64 {
|
||
|
+ uint64_t rlim_cur;
|
||
|
+ uint64_t rlim_max;
|
||
|
+};
|
||
|
+
|
||
|
#include "socket.h"
|
||
|
|
||
|
#include "errno_defs.h"
|