From patchwork Sun May 19 20:37:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164560 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4815602ili; Sun, 19 May 2019 14:32:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvOeZfDvpQ8OKNPlZ5+UZKh4v/s8aSKtARgY7vx8BZ1TS/aVgJ+CH77eR9xdaXwaLRq1Ir X-Received: by 2002:a17:906:1ec2:: with SMTP id m2mr52957234ejj.47.1558301570942; Sun, 19 May 2019 14:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558301570; cv=none; d=google.com; s=arc-20160816; b=us0j/2M9fl3RgM0ayKhQqPQE08bMEF5yzU8VRwnqBMV5aD/bTBDmeC00w1ZNfw7IpS S8bYMD7m8DGM2vWaNRrXzcD4aX6gR/46za8r0j6SPQpNzabUqp4YvPaM9GWruMtJIDni tF5I2x6U2a52CVtDklk2N7FG36EyQgPFWL7aV5X4txW3Z5GVqzF+GN2vYgTd6l4hf8cb 2Iz+cLrcx+6uiUUxPDeiUpVK5XQL14nxYVrIO9R3RwDWZVxVib5JPQgQGEPncx7Zn8Zd XveGB4yyOOxhV4MWnBLUR7V5Kaip1NnKf5K/TyWV3M0wj4boUbVIjcvmG6PM66w3jrNx /1Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=+4pgGcHqpI/1ayoviAyV/bToyhUBomMihY7gyQ1lsgY=; b=AESgXsatTf/ddcSTPSHm4ZKCKsJ/F0n0bAZoOsy6fyWDxBo/aoeTTkBpLr6FN4TBWj 5qSPBqxsdVZrKm5HFh3HofViS7ilkeBpRK+3p1Dj61+nUHIVmaHabwQC6jpGlqZuQICR CGghcH+J9SmvbYdH/m354KZepYtp4CeXqEFMFM6ujgSBeyPGJyV46V8fO8VuMaulz1PE ATdNwBCROJ1MxzeIsHAvghSxuJDYPBitwySIEhQYpoAb+/Ssgi168JuctfhCCHwTplFO 2GvW/XVbA9y5lDC4WcEUfvHnITCObN8FKVW/tdlpxfkr9tuByLGkd46gj8iXc8S9wF32 eOpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="yNOh/qnB"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x12si1503398eda.175.2019.05.19.14.32.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:32:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="yNOh/qnB"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTQH-0000ln-Pj for patch@linaro.org; Sun, 19 May 2019 17:32:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSa3-0003zR-5a for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSa1-0004w6-Rg for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:51 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:32992) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSa1-0004vH-HJ for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:49 -0400 Received: by mail-pf1-x442.google.com with SMTP id z28so6189151pfk.0 for ; Sun, 19 May 2019 13:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+4pgGcHqpI/1ayoviAyV/bToyhUBomMihY7gyQ1lsgY=; b=yNOh/qnBcfc5fIBsPkbMKp0aWj5JMGBfKFKQuWBaSZTKRjfxkpgNhxvNaDzlLjCYqs TBrqkqUE3q6+xcHx14kx7BGthawXJrn7hA6SwtgdfUST9H87q10uzV7pgPHZy5xoBmmT njOXPTa/zL8C2VlkoQLT1vPUn1nfwFF67WuZJy8lPiVxL2/aAZlYNpvW5sKBCYrBTFoP 3UX52KZDgSlYFnIGePYlIvDdzCAm8d1porwbeQENJQxcYceAIlqQxH1GAGMdlFVaL4DX mu1/gDeY8HF0lX2dupdU/NoxBswx5V5zRU/b70NHoKPMb1f6fYv+k2p/X8i/W189OSV8 FtMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+4pgGcHqpI/1ayoviAyV/bToyhUBomMihY7gyQ1lsgY=; b=EkKP9tFDzIMKcPTOMkMn3YrKn5NCj9LZBsDIWBaIEXsVbAM7m7dDNeDHBhFwDnE9d6 U/7D1qkKygAI7azu3yJ3UdwXAo3kjG5dskyMMhITJKP9dJvd9LX3jZeHFReHK0dnZdI0 xvZ2xVPw+f7qyvWs7BgvdrC2bIRpNapJkzZBcmWOIfe+qUdE6AAPtfZKF1s6nDuDVFvC 5eb38mh+uChI8gaHyG7ae3Pk4pKoWeqIPcYprpxJf1ZODv8XJnm5EUB3Aup5VY+n0qnm FotfYPh8pR/thmm6NMsgpLRADP4aokVaisT/F0VLOJmZJzSmsgnKqXbStHwXgUMcXCgf tAuw== X-Gm-Message-State: APjAAAV0yZh26cL2FLaRrBmJhBneTXzNWUR2zC7dgWWo/MVBF+O7jgtn F+ysKiJuRGrTWCen//gmYZDvp045ZYU= X-Received: by 2002:a63:6a4a:: with SMTP id f71mr70548969pgc.44.1558298328375; Sun, 19 May 2019 13:38:48 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:37:16 -0700 Message-Id: <20190519203726.20729-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v7 64/74] linux-user: Split out gethostname, sethostname X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 4 ++++ linux-user/syscall-proc.inc.c | 28 ++++++++++++++++++++++++++++ linux-user/syscall.c | 19 ------------------- linux-user/strace.list | 6 ------ 4 files changed, 32 insertions(+), 25 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 77d750f66f..3ba697fd53 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -59,6 +59,9 @@ SYSCALL_DEF(futimesat, ARG_ATDIRFD, ARG_STR, ARG_PTR); #ifdef TARGET_NR_fork SYSCALL_DEF(fork); #endif +#ifdef TARGET_NR_gethostname +SYSCALL_DEF(gethostname, ARG_PTR, ARG_DEC); +#endif SYSCALL_DEF(getpgid, ARG_DEC); #ifdef TARGET_NR_getpgrp SYSCALL_DEF(getpgrp); @@ -207,6 +210,7 @@ SYSCALL_DEF(semctl, ARG_DEC, ARG_DEC, ARG_DEC, ARG_HEX); #if !defined(SYSCALL_TABLE) || defined(TARGET_NR_semget) SYSCALL_DEF(semget, ARG_DEC, ARG_DEC, ARG_HEX); #endif +SYSCALL_DEF(sethostname, ARG_STR); SYSCALL_DEF(setpgid, ARG_DEC, ARG_DEC); SYSCALL_DEF(setsid); #if !defined(SYSCALL_TABLE) || defined(TARGET_NR_semop) diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c index 567df54581..b1a801fb62 100644 --- a/linux-user/syscall-proc.inc.c +++ b/linux-user/syscall-proc.inc.c @@ -438,6 +438,21 @@ SYSCALL_IMPL(fork) } #endif +#ifdef TARGET_NR_gethostname +SYSCALL_IMPL(gethostname) +{ + char *name = lock_user(VERIFY_WRITE, arg1, arg2, 0); + abi_long ret; + + if (!name) { + return -TARGET_EFAULT; + } + ret = get_errno(gethostname(name, arg2)); + unlock_user(name, arg1, arg2); + return ret; +} +#endif + SYSCALL_IMPL(getpgid) { return get_errno(getpgid(arg1)); @@ -485,6 +500,19 @@ SYSCALL_IMPL(nice) } #endif +SYSCALL_IMPL(sethostname) +{ + void *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(sethostname(p, arg2)); + unlock_user(p, arg1, 0); + return ret; +} + SYSCALL_IMPL(setpgid) { return get_errno(setpgid(arg1, arg2)); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b8b18ac1de..6dd4196647 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4240,12 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_sethostname: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(sethostname(p, arg2)); - unlock_user(p, arg1, 0); - return ret; #ifdef TARGET_NR_setrlimit case TARGET_NR_setrlimit: { @@ -7078,19 +7072,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, return ret; } #endif -#ifdef TARGET_NR_gethostname - case TARGET_NR_gethostname: - { - char *name = lock_user(VERIFY_WRITE, arg1, arg2, 0); - if (name) { - ret = get_errno(gethostname(name, arg2)); - unlock_user(name, arg1, arg2); - } else { - ret = -TARGET_EFAULT; - } - return ret; - } -#endif #ifdef TARGET_NR_atomic_cmpxchg_32 case TARGET_NR_atomic_cmpxchg_32: { diff --git a/linux-user/strace.list b/linux-user/strace.list index b1c2f7851e..361ceec853 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -244,9 +244,6 @@ #ifdef TARGET_NR_getgroups32 { TARGET_NR_getgroups32, "getgroups32" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_gethostname -{ TARGET_NR_gethostname, "gethostname" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getitimer { TARGET_NR_getitimer, "getitimer" , NULL, NULL, NULL }, #endif @@ -1025,9 +1022,6 @@ #ifdef TARGET_NR_sethae { TARGET_NR_sethae, "sethae" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sethostname -{ TARGET_NR_sethostname, "sethostname" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_setitimer { TARGET_NR_setitimer, "setitimer" , NULL, NULL, NULL }, #endif