Received: from eggs.gnu.org ([140.186.70.92]:54592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtJZo-00029G-UN for qemu-devel@nongnu.org; Fri, 03 Feb 2012 08:53:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtJZk-0006Pi-Rf for qemu-devel@nongnu.org; Fri, 03 Feb 2012 08:53:20 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:56497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtJZk-0006Ow-Ki for qemu-devel@nongnu.org; Fri, 03 Feb 2012 08:53:16 -0500 From: Peter Maydell Date: Fri, 3 Feb 2012 13:53:06 +0000 Message-Id: <1328277186-21665-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1328277186-21665-1-git-send-email-peter.maydell@linaro.org> References: <1328277186-21665-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 2/2] linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Riku Voipio , patches@linaro.org Add support for the prctl options PR_GET_NAME and PR_SET_NAME, which take or return a name in a 16 byte buffer pointed to by arg2. Signed-off-by: Peter Maydell --- linux-user/syscall.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7851fb5..489a8c2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6853,6 +6853,30 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } break; } +#ifdef PR_GET_NAME + case PR_GET_NAME: + { + void *name = lock_user(VERIFY_WRITE, arg2, 16, 1); + if (!name) { + goto efault; + } + ret = get_errno(prctl(arg1, (unsigned long)name, + arg3, arg4, arg5)); + unlock_user(name, arg2, 16); + break; + } + case PR_SET_NAME: + { + void *name = lock_user(VERIFY_READ, arg2, 16, 1); + if (!name) { + goto efault; + } + ret = get_errno(prctl(arg1, (unsigned long)name, + arg3, arg4, arg5)); + unlock_user(name, arg2, 0); + break; + } +#endif default: /* Most prctl options have no pointer arguments */ ret = get_errno(prctl(arg1, arg2, arg3, arg4, arg5)); -- 1.7.1