From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C34311F4DA for ; Wed, 19 Oct 2022 22:17:58 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="iyQg3T/g"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F127D385742E for ; Wed, 19 Oct 2022 22:17:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F127D385742E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666217878; bh=eLXLMjIK8DsAGanH2FNH0SCS4eVC7hSznTdMLudL3GY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iyQg3T/g5p0E1Favgm2YqEZBE3kxtljod74BYr1uwkjBn3pNaMtUYivAOv1tyfmiA FVzTiSKdU17IXmo7SXWDf2M11w56YAnQ85oFbvfsWwfktRB0jzIbkyKHxpi2hc2pMA RWOtImyehQuEq23y1o7iZLPcrIsXMvFcVKT0qigQ= Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 021CE38582B8 for ; Wed, 19 Oct 2022 22:14:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 021CE38582B8 Received: by mail-oi1-x231.google.com with SMTP id u15so20879119oie.2 for ; Wed, 19 Oct 2022 15:14:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eLXLMjIK8DsAGanH2FNH0SCS4eVC7hSznTdMLudL3GY=; b=1Yzo3RmR77ItE7/DuqiFEL7N9mGWhskeZXEneP7266sQzHyz+BH86cN9y/O28Rli5h TiTQJnau1YuERwLtflRKNNGfTHAT4jtY2fJ8oiyIR2FW7cnpnRjE+LAbMAI0QNCPCjHs qP3UM/9HywlH+BpvAKtfB1Ry+DIIqfvoBaIfd4oFojQo/0HLEFaCpyT5i6cvYSr1vkGd ru9nx0I7VOOYOnaAxe7LJA8LLje9W1WqcgLrz8IXNPszn76sfMF8e4LHn/KFwWi2eLxe 0R050dY+18Jeg/U97WxhIridpvg1zFackuRMi8MH78RQfgj43zYtIEe8/JfJ5mb16a7I b71g== X-Gm-Message-State: ACrzQf16WOW8XXyVICz2+2GEwb4qbvjNGU0XeY5cJdrFEt8s30h6drlz +5+PeqKGwDZ5HJns77PqHQmoFDm4UCKdT2Rh X-Google-Smtp-Source: AMsMyM5tpcP4j0Xfy3mQAWkgtDwDHUCQ/cQFBncxa4TaIHj01nbn4WY/lJQ0AA0G6+pL6+lhY6NLjQ== X-Received: by 2002:a05:6808:2223:b0:354:d41e:5318 with SMTP id bd35-20020a056808222300b00354d41e5318mr5420162oib.80.1666217688355; Wed, 19 Oct 2022 15:14:48 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:7d19:f1c1:9fb4:472a:ab68]) by smtp.gmail.com with ESMTPSA id m9-20020aca5809000000b00353fe4fb4casm7137927oib.48.2022.10.19.15.14.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 15:14:48 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 08/30] Linux: consolidate lchown implementation Date: Wed, 19 Oct 2022 19:14:11 -0300 Message-Id: <20221019221433.1082017-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221019221433.1082017-1-adhemerval.zanella@linaro.org> References: <20221019221433.1082017-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" Use lchown syscall if defined, otherwise use fchownat. Checked on x86_64-linux-gnu. --- sysdeps/unix/sysv/linux/{generic => }/lchown.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) rename sysdeps/unix/sysv/linux/{generic => }/lchown.c (75%) diff --git a/sysdeps/unix/sysv/linux/generic/lchown.c b/sysdeps/unix/sysv/linux/lchown.c similarity index 75% rename from sysdeps/unix/sysv/linux/generic/lchown.c rename to sysdeps/unix/sysv/linux/lchown.c index 996925d799..4888e5f194 100644 --- a/sysdeps/unix/sysv/linux/generic/lchown.c +++ b/sysdeps/unix/sysv/linux/lchown.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2011-2022 Free Software Foundation, Inc. +/* Change ownership of a file. Linux version. + Copyright (C) 2011-2022 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 @@ -23,7 +24,11 @@ int __lchown (const char *file, uid_t owner, gid_t group) { - return INLINE_SYSCALL (fchownat, 5, AT_FDCWD, file, owner, group, - AT_SYMLINK_NOFOLLOW); +#ifdef __NR_lchown + return INLINE_SYSCALL_CALL (lchown, file, owner, group); +#else + return INLINE_SYSCALL_CALL (fchownat, AT_FDCWD, file, owner, group, + AT_SYMLINK_NOFOLLOW); +#endif } weak_alias (__lchown, lchown) -- 2.34.1