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: AS17314 8.43.84.0/22 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_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 8BBB91F4DA for ; Wed, 19 Oct 2022 22:16:38 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="gsg1hycg"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B4B3A3856955 for ; Wed, 19 Oct 2022 22:16:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4B3A3856955 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666217797; bh=UxQ4AY34WML/uxXfzv2PVhcpfBrMOK+YpXlIOvrC6xA=; 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=gsg1hycglJEir9KxRZyWATunDpMvVlujB++vod0IhHqqkZ1Y8NmRIuuFkQn0FqfmD qpWJd+GUsVZ6HnOEqaYL2Pip9Gc8QY4eVJ07ExSQMicESwW5pLYYGS/ghWZFca09bi KekI5MEFJ5QzB6xozcF18Ie3DFxgWhT7339GAloc= Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id 10F4E3858C2F for ; Wed, 19 Oct 2022 22:14:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10F4E3858C2F Received: by mail-oi1-x230.google.com with SMTP id y72so20885123oia.3 for ; Wed, 19 Oct 2022 15:14:44 -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=UxQ4AY34WML/uxXfzv2PVhcpfBrMOK+YpXlIOvrC6xA=; b=eqE1MPbauc+kieSz+XucdZ1qJgpYBWcS16KtPLlXIKstatnkdmrB35ra9e47Xm2lZO FKaBsBA0tlJ8aanYmYOsF5vjix7YkktJEHYRW+OXo5lBYAIyXvsk0Dje+NKSHWuVSYSJ gLrAGW4HrR+Nbr2sC+Maf996Q1klLfoltqq8jiXQTB9i8JO1b8R15r4WgUtnFX8mOs1y r3O6AwI1AmEj2e8bMnOnx7xo/zSD4jY4QvODSnDl9XTJRWdU01RCkvyQtZ/XjlnkmnH2 bMqnllfM/bd/vPrrzjxzSDSPwzPoqjv2p011zv0rTSc75NjfTQmY00h+Cep93zhVweCC 41JQ== X-Gm-Message-State: ACrzQf2up/B8VuYVUgfmAnKbBryVaAMjlwfbZZRgXBoNDnLFmhovCm0b hr/XbXzcLoBe0R5FY0hriSFhdJlY2KLJNLIq X-Google-Smtp-Source: AMsMyM4U9EWLauZP/04vRCnsfiAHHkjYW0hG9RC/UsIwSw2TzTEV0+sVb2J95Ma9RCQsGvNApCZuBg== X-Received: by 2002:a05:6808:118e:b0:345:9c3e:121d with SMTP id j14-20020a056808118e00b003459c3e121dmr5956002oil.211.1666217683181; Wed, 19 Oct 2022 15:14:43 -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.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 15:14:42 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 04/30] Linux: consolidate chown implementation Date: Wed, 19 Oct 2022 19:14:07 -0300 Message-Id: <20221019221433.1082017-5-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 chown syscall if defined, otherwise use fchownat. Checked on x86_64-linux-gnu. --- sysdeps/unix/sysv/linux/{generic => }/chown.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) rename sysdeps/unix/sysv/linux/{generic => }/chown.c (77%) diff --git a/sysdeps/unix/sysv/linux/generic/chown.c b/sysdeps/unix/sysv/linux/chown.c similarity index 77% rename from sysdeps/unix/sysv/linux/generic/chown.c rename to sysdeps/unix/sysv/linux/chown.c index 53997a1127..c1cd4d6c3d 100644 --- a/sysdeps/unix/sysv/linux/generic/chown.c +++ b/sysdeps/unix/sysv/linux/chown.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 __chown (const char *file, uid_t owner, gid_t group) { - return INLINE_SYSCALL (fchownat, 5, AT_FDCWD, file, owner, group, 0); +#ifdef __NR_chown + return INLINE_SYSCALL_CALL (chown, file, owner, groups); +#else + return INLINE_SYSCALL_CALL (fchownat, AT_FDCWD, file, owner, group, 0); +#endif } libc_hidden_def (__chown) weak_alias (__chown, chown) -- 2.34.1