From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x230.google.com with SMTP id y72so20885123oia.3 for ; Wed, 19 Oct 2022 15:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UxQ4AY34WML/uxXfzv2PVhcpfBrMOK+YpXlIOvrC6xA=; b=MO1eGFxHzvNjKtX5CSpW+wOKaTZAKnrBdx/i3mjHBthcQy3Gyg1QefELAuaewSybnA vu2S6V6pKcenopOywQCUnZUTgf4SfO+pN6jKJSK24ndRo2zWvmhKiUgp9Vy/o7C2A6q1 wul7O3kd37U1JaKYn2aXSeMH1riFqSgQOZnc4ijks65h1JDXj5B5i9H7iN9O94xdvE5t OtLAIy4Vps/jwZbykpPsX+2GOEMuF5TvbiaIvOO/bau/Evyrzj6l2Ij768AP37cYFylH svUy+ISuB61tAHfOojemzWOtAvFn81IRy4ZUBtoL2DcMJtVfPXoofo4fJcd8Dd44u+xF flNA== 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) From: Adhemerval Zanella 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-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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