From patchwork Sun Jun 10 03:00:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138099 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2584237lji; Sat, 9 Jun 2018 20:21:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIKP5OnkPeI6AalDxGoz0bQUaDVfNXx5Y9cDFwosDyAkwaNt8taJhZxxyT+p5I9PY1zRuVP X-Received: by 2002:a37:295e:: with SMTP id p91-v6mr10214241qkh.415.1528600887103; Sat, 09 Jun 2018 20:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528600887; cv=none; d=google.com; s=arc-20160816; b=C3vX8sP8OTiU0cYmTyQ+q/Dy7eghPj4lwA+JwaUbj7RPubFyIhhRKvjSCY7zs2GhUm 5FPfExa/BlbL+Rjr0jDXlhUXlJoRPCdb7GRB8HUvnixUzluUdRhoj795WRVdsklGv5Eh H240rEstESFOe87LLYGXwK+2t28o/QO3ASOdThbtlv1jcM8m77Wd80NE7egKI6He7OJN NfwaqeUH2y+OGPTD/X2+cod8E+wutfqpn/ynibg81INmY9iEfUWigwEt038oFWHjZTmx I2DJGnRPOw+y+bfuP73dT08i/qJ7xvhiR7vkFcc0hXnmWgrGeY9qwMm5qLhL3aVH4Fxs yYhg== 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:arc-authentication-results; bh=nUcgwKjKRtuUIl+X0SKW42bj2GseoHEMo16pVq3WZHs=; b=No/K02UoOdND6QafvZDAzVnN6KvMqodvYLnh0VWRTLeQxjc1G71XbB+QpsgO/kIU7w Z+efPd+uq1f6Mwxh9GfnsjIIf4wFXo529rBkl+kRbF8GrwKLNHLXDC/Zo0t7XSnBCRN2 j9LlQTGLIuJd+VSwK302kd2UqRysh0Ww82GpNjcxam44/ZeJNO1UDGxFkxV6mBf34c+B EZAbh2rL2PNIBztGYDGUEztt4qV4Q8yPvTGoTBHU5q3MHUx3ePMV2a8pTK0U/q24QmE7 lW82aLzE3FszT54eYa/pCvtzach/0HkOANpCmoQNftv+XWNTgQ8QqOakolsKAfnzjz1N ddeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hPPNacGv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n67-v6si22222390qkc.152.2018.06.09.20.21.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:21:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hPPNacGv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:42275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqv0-0001E7-G6 for patch@linaro.org; Sat, 09 Jun 2018 23:21:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqdB-0001v7-AI for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqdA-0003HQ-Gv for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:01 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:43596) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqdA-0003HB-Ax for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:00 -0400 Received: by mail-pl0-x241.google.com with SMTP id c41-v6so10384334plj.10 for ; Sat, 09 Jun 2018 20:03:00 -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=nUcgwKjKRtuUIl+X0SKW42bj2GseoHEMo16pVq3WZHs=; b=hPPNacGv8/qPETwucWmNA6Z80FGeHSlc+Pkz86WvYJSihXl06HWCwEsqR/FqQDvx2j r2r6jnRNtRm96m+Df1b8zR/VSxP0gkdoLGJHZSh9a2npwDNKMaFIdw4L+uUiObtOelQD +DYVG+3OfjCBDu9eyxGD993ihb6pnQyuGHYw0= 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=nUcgwKjKRtuUIl+X0SKW42bj2GseoHEMo16pVq3WZHs=; b=YvMNvJ62+hTtrrWF2N/sK96DtRyprexixGA2WMRe8eILqOzYh+yx5YZEYnHLLXcc24 1P6DSftajZwF5gv2Sox0RHth/AeeS+sWjzLErcg7un6L9iQILatLl2XNRheVw2my/5+4 eIJsobb1SNX45JV/lHUr0UYnfPi6QOIn02Z5SYXeHYEueMc2GVGPD3zZ3a8CLBN2tZm+ bwixDsRUP7RRQoafUPZY8o7FUOkTrnTZ6D97DEVZGQnanR9OWuOCnOrlSMVJoV5guyJb nVTwWT/R7mh6sFlYF8swGw3G6grTrBCdyECiUFdAeG0ox6Fex7jOV/UCb1VpyP1kIWiX hkGw== X-Gm-Message-State: APt69E1i5QdINomYEZNZp3YkH38A5EYf3fqeodJKhkh6sCUP3cOvM+JF FvfdkW+Rcsp2INLreKrAdXSlG2onLqc= X-Received: by 2002:a17:902:9a4b:: with SMTP id x11-v6mr12960917plv.176.1528599779153; Sat, 09 Jun 2018 20:02:59 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.02.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:02:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:00:48 -1000 Message-Id: <20180610030220.3777-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [PATCH v2 016/108] linux-user: Split out link, linkat 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" All targets define linkat; remove the ifdef. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 66 +++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a146b696fd..936c7a7484 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8052,6 +8052,36 @@ IMPL(fork) } #endif +#ifdef TARGET_NR_link +IMPL(link) +{ + char *p1 = lock_user_string(arg1); + char *p2 = lock_user_string(arg2); + abi_long ret = -TARGET_EFAULT; + + if (p1 && p2) { + ret = get_errno(link(p1, p2)); + } + unlock_user(p1, arg1, 0); + unlock_user(p2, arg2, 0); + return ret; +} +#endif + +IMPL(linkat) +{ + char *p1 = lock_user_string(arg2); + char *p2 = lock_user_string(arg4); + abi_long ret = -TARGET_EFAULT; + + if (p1 && p2) { + ret = get_errno(linkat(arg1, p1, arg3, p2, arg5)); + } + unlock_user(p1, arg2, 0); + unlock_user(p2, arg4, 0); + return ret; +} + #ifdef CONFIG_OPEN_BY_HANDLE IMPL(name_to_handle_at) { @@ -8270,38 +8300,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_link - case TARGET_NR_link: - { - void * p2; - p = lock_user_string(arg1); - p2 = lock_user_string(arg2); - if (!p || !p2) - ret = -TARGET_EFAULT; - else - ret = get_errno(link(p, p2)); - unlock_user(p2, arg2, 0); - unlock_user(p, arg1, 0); - } - return ret; -#endif -#if defined(TARGET_NR_linkat) - case TARGET_NR_linkat: - { - void * p2 = NULL; - if (!arg2 || !arg4) - return -TARGET_EFAULT; - p = lock_user_string(arg2); - p2 = lock_user_string(arg4); - if (!p || !p2) - ret = -TARGET_EFAULT; - else - ret = get_errno(linkat(arg1, p, arg3, p2, arg5)); - unlock_user(p, arg2, 0); - unlock_user(p2, arg4, 0); - } - return ret; -#endif #ifdef TARGET_NR_unlink case TARGET_NR_unlink: if (!(p = lock_user_string(arg1))) @@ -12506,6 +12504,10 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_fork SYSCALL(fork); #endif +#ifdef TARGET_NR_link + SYSCALL(link); +#endif + SYSCALL(linkat); #ifdef CONFIG_OPEN_BY_HANDLE SYSCALL(name_to_handle_at); #endif