From patchwork Wed Dec 14 14:12:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 88030 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp215067qgi; Wed, 14 Dec 2016 06:12:37 -0800 (PST) X-Received: by 10.84.216.25 with SMTP id m25mr208864096pli.117.1481724757108; Wed, 14 Dec 2016 06:12:37 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y1si53065356pfd.3.2016.12.14.06.12.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2016 06:12:37 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-75868-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-75868-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-75868-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=x2RNvTC8NzpWJTE3S1ACB/4AFS09Ize /OqVaD8x26hx17+10iSCaDXXDg4D6iT9bakFhpRah/qjM2saqW2z68cvF7nmbQCO jabwqMSyuhAo/UP57h2VoynRIdWpNZR5dGgoGJVowWK+02rR/YGrRa3Aa7czDKRf DzJFTQJ+cEQ0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=qdUm4go47aj/6QyPL4GAHen15Ck=; b=KJAHV ufLssT7GvVOvQmh4mb00E9qmD8mBzcWjkGkhONudcrVLHol5fOd2OOo6gu8M+7Yc OgoAf98B+B+3bivhC8AQ6QFf7F8hgRyYt7WYvxDGWwQJ+L5NTDFen5yLQjlALxFC M3cuqpoQEaJ/B6Fn9v3i6zBDErakzlQE3V0pDI= Received: (qmail 71661 invoked by alias); 14 Dec 2016 14:12:25 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 71623 invoked by uid 89); 14 Dec 2016 14:12:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=errnoh, UD:errno.h, errno.h, isis X-HELO: mail-vk0-f48.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Td5kWwsjEcm1StXc8qWjPjwzsS4pWykYf+eRX9waWSY=; b=eApi3xmpqxMDJYNszcPwQQN6oRGXx8wIvQFICZwsQXAvroKM+z2yE96IMSp6edhepZ vZ1LmwW7XRe/jNqDdsSMocgd5hX/WEeTt8q3i0D3/ahzNaaiIX7gSonTnSXTMeFzKZar zodWXPS73+QWTBZ2NHN0tgBmhlrb6+gJwx9q9/n8IcCfmCmEw3SJ3zq0fQlk6Pc7hjo4 xGxlfoHDPHb+Oz0NhXyuaDDsygqoNrcOdJnH6B6XUDdcIRSsmIE9mMsYIQKaj0LFI1Vb E0aI8xBp6AhGDrl0qUYjwaQBVmozCMpxlCgvlSUtvMZMcvDMDEdDJGWkKDmn18opiSoU S0Qw== X-Gm-Message-State: AKaTC010ebby9abi2uxaa4uGYO2vKCnAIa/z24uLJ+XtiQjN0zTsxSMnSI0VwFNc9Gyq5BYM X-Received: by 10.176.83.92 with SMTP id y28mr86359754uay.128.1481724730162; Wed, 14 Dec 2016 06:12:10 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/2] Consolidate renameat Linux implementation Date: Wed, 14 Dec 2016 12:12:02 -0200 Message-Id: <1481724722-30103-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1481724722-30103-1-git-send-email-adhemerval.zanella@linaro.org> References: <1481724722-30103-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the Linux renameat implementation on sysdeps/unix/sysv/linux/renameat.c. The renameat syscall was deprecated at b0da6d44 for newer architectures, so using the auto-generation list may generate wrappers that returns ENOSYS. Current code try to use __NR_renameat and if it is not define it uses __NR_renameat2. Checked on x86_64 and aarch64. * sysdeps/unix/sysv/linux/renameat.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove renameat. --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/renameat.c | 32 ++++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/renameat.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c new file mode 100644 index 0000000..ac52947 --- /dev/null +++ b/sysdeps/unix/sysv/linux/renameat.c @@ -0,0 +1,32 @@ +/* Linux implementation for renameat function. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include + +int +renameat (int oldfd, const char *old, int newfd, const char *new) +{ +#ifdef __NR_renameat + return INLINE_SYSCALL_CALL (renameat, oldfd, old, newfd, new); +#else + return INLINE_SYSCALL_CALL (renameat2, oldfd, old, newfd, new, 0); +#endif +} diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 98b3bb9..5d3c417 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -89,7 +89,6 @@ fchownat - fchownat i:isiii fchownat linkat - linkat i:isisi linkat mkdirat - mkdirat i:isi mkdirat readlinkat - readlinkat i:issi readlinkat -renameat - renameat i:isis renameat symlinkat - symlinkat i:sis symlinkat unlinkat - unlinkat i:isi unlinkat