From patchwork Sun Jun 10 03:01:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138104 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2585718lji; Sat, 9 Jun 2018 20:24:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKixWx7ORREdABG4eGuZqoNrimMSztUsw8TCXyA3JRKISe7ROFveNZiv/8gQas1nMou8WdJ X-Received: by 2002:a0c:b116:: with SMTP id q22-v6mr10934435qvc.19.1528601069714; Sat, 09 Jun 2018 20:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528601069; cv=none; d=google.com; s=arc-20160816; b=awJEijIc0kNa7xbDHjVBqYGAJesSz9Z/TfzfgdcGMA/Xc4pGc9ZPAQn/eAFBDD9Ow6 dURKR9mM/RP+u3TkuDGjzL2NKBro+Yi1Dd5k8qeLzTYwmZSSSnUYcKEavRlNbFGAEp6O 5ULR4dMLFVhZYXBBBe3pUOaFbiO7FYeFIh1ugltAzvfQHcMBlczi4NYRcVQPTfkMLiU3 lmy1nhsdgCENflO4+1g7MS0UFgo1RpmYm74FebYLuKi+upXdXBnPe4/NSAIAdJwvLL2V gbch+D/2j2MAI58nmnO3TM7QAJEO1nQaoL3BVCzs5bdXQv/e/SMkE4hBilGg/gsjYOOp JnVg== 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=MO3CtHl8xhdjUTpLRWtjJqDVjOPhlwO8K7Ht7HuLk7c=; b=IfFlgsqlqGcQF6ggK0gLV6U/hmwiXeXYPlU5C+Y4efrKjDLLpjzhhdfLrnzKumf/vK Linvt3ZD9CsOdtMZotP7TCT0xi8kivTjTf3hAaihwtBUWT04H68EBUirIjuJ4ud4GiDn bq69rJgWMPGrFFG0j1kqGSbORK3GS545/NJy1TliXm2eolnsTn47Sguof8Hp8RMa02d+ r5NFuaU+zUwzWT4zuTOxTH5q2COWPcdj37rRufD0X+zEs85NvPBu1XpMOj+kTjU4gKWk HjWFd+zn+eWMRC34ONxwhGBTtFOjr6NUG6F0toYjzPeRVHRBjCcII2SwUUf8LoVEOpnh BeyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eafUr+Xo; 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 u4-v6si3890318qke.259.2018.06.09.20.24.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:24:29 -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=eafUr+Xo; 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]:42288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqxx-0003JR-4F for patch@linaro.org; Sat, 09 Jun 2018 23:24:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqdv-0002bB-II for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqdu-0003a2-Ke for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:47 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:38926) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqdu-0003Zo-EP for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:46 -0400 Received: by mail-pg0-x242.google.com with SMTP id w12-v6so8138873pgc.6 for ; Sat, 09 Jun 2018 20:03:46 -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=MO3CtHl8xhdjUTpLRWtjJqDVjOPhlwO8K7Ht7HuLk7c=; b=eafUr+XooCrEkiQK4qNoMJ8OXIiyHSBujJX1Ajttp+aA77fw/daNofNYkuUYycTNai zfx0GiY5Uhf/NK7JkmdlxxHUxnLeGcGbkGSYdmlEclYzsKXYQbl7pzHTkbcfrC2AmQjg cTaJrofkeg03K90qF9KSgnFwhNFJ8XUf3jOt0= 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=MO3CtHl8xhdjUTpLRWtjJqDVjOPhlwO8K7Ht7HuLk7c=; b=CH0c/Om7TVZPfRidUQ0SnSf8QtNKsq54izikaAvIjaFc3O57ykO3OKCoCz3W6oS8TM qU90+mxClDL6Q7+eS8j97XN/nu1uEKdX0ynQcv52lxTDuhJwaU5qG4M1CBR9mBUzM64C ia5Gkk6LTfo0t1vPi3TA17W/RkCO6pWSZBSwULYHmYKZKT1RCOpdNxGN9k6ZuAQ9hXEH WpXi33gJd6oDlBVpmHc8KNKr24rR2s0TVw/vs4RHFXP/o74K+P2mUMv+bo3eUJ+6Fo36 f2F8+0z+Hx9h0kj+CHW5F/YEUGwuZuWvvGgM2KWzhdKW0QFG+/VxmjHKxj6iLouIDttu A8jg== X-Gm-Message-State: APt69E3bWraLKl5dK7HoggXE1u8p7/xyF8Jj8QspqYG+Z7CysWJWIkRM rew2P2l8+YvzaJIWNMRhAT4kezPdeaY= X-Received: by 2002:a63:3641:: with SMTP id d62-v6mr10184577pga.18.1528599825190; Sat, 09 Jun 2018 20:03:45 -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.03.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:03:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:08 -1000 Message-Id: <20180610030220.3777-37-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:c05::242 Subject: [Qemu-devel] [PATCH v2 036/108] linux-user: Split out symlink, symlinkat 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 symlinkat; remove the ifdef. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 64 +++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 30 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 326323e377..39d8a70d7d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9331,6 +9331,36 @@ IMPL(stime) } #endif +#ifdef TARGET_NR_symlink +IMPL(symlink) +{ + char *p1 = lock_user_string(arg1); + char *p2 = lock_user_string(arg2); + abi_long ret = -TARGET_EFAULT; + + if (p1 && p2) { + ret = get_errno(symlink(p1, p2)); + } + unlock_user(p2, arg2, 0); + unlock_user(p1, arg1, 0); + return ret; +} +#endif + +IMPL(symlinkat) +{ + char *p1 = lock_user_string(arg1); + char *p2 = lock_user_string(arg3); + abi_long ret = -TARGET_EFAULT; + + if (p1 && p2) { + ret = get_errno(symlinkat(p1, arg2, p2)); + } + unlock_user(p2, arg3, 0); + unlock_user(p1, arg1, 0); + return ret; +} + IMPL(sync) { sync(); @@ -9561,36 +9591,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_symlink - case TARGET_NR_symlink: - { - void *p2; - p = lock_user_string(arg1); - p2 = lock_user_string(arg2); - if (!p || !p2) - ret = -TARGET_EFAULT; - else - ret = get_errno(symlink(p, p2)); - unlock_user(p2, arg2, 0); - unlock_user(p, arg1, 0); - } - return ret; -#endif -#if defined(TARGET_NR_symlinkat) - case TARGET_NR_symlinkat: - { - void *p2; - p = lock_user_string(arg1); - p2 = lock_user_string(arg3); - if (!p || !p2) - ret = -TARGET_EFAULT; - else - ret = get_errno(symlinkat(p, arg2, p2)); - unlock_user(p2, arg3, 0); - unlock_user(p, arg1, 0); - } - return ret; -#endif #ifdef TARGET_NR_readlink case TARGET_NR_readlink: { @@ -12837,6 +12837,10 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_stime SYSCALL(stime); #endif +#ifdef TARGET_NR_symlink + SYSCALL(symlink); +#endif + SYSCALL(symlinkat); SYSCALL(sync); #ifdef CONFIG_SYNCFS SYSCALL(syncfs);