From patchwork Fri Feb 3 13:53:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 6592 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4829723E16 for ; Fri, 3 Feb 2012 13:53:12 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0B808A182EE for ; Fri, 3 Feb 2012 13:53:11 +0000 (UTC) Received: by ghbz22 with SMTP id z22so2008388ghb.11 for ; Fri, 03 Feb 2012 05:53:11 -0800 (PST) Received: by 10.50.156.196 with SMTP id wg4mr8542894igb.13.1328277191389; Fri, 03 Feb 2012 05:53:11 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.169.210 with SMTP id a18cs16237ibz; Fri, 3 Feb 2012 05:53:10 -0800 (PST) Received: by 10.180.92.73 with SMTP id ck9mr11766232wib.2.1328277189586; Fri, 03 Feb 2012 05:53:09 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id s55si4095595wec.85.2012.02.03.05.53.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Feb 2012 05:53:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RtJZa-0005dw-Op; Fri, 03 Feb 2012 13:53:06 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio Subject: [PATCH 2/2] linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME Date: Fri, 3 Feb 2012 13:53:06 +0000 Message-Id: <1328277186-21665-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1328277186-21665-1-git-send-email-peter.maydell@linaro.org> References: <1328277186-21665-1-git-send-email-peter.maydell@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));