From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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-x231.google.com with SMTP id u15so20879119oie.2 for ; Wed, 19 Oct 2022 15:14:48 -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=eLXLMjIK8DsAGanH2FNH0SCS4eVC7hSznTdMLudL3GY=; b=tZbWhoPQsbNRiy6KkbLjATgX5Hq2hmLqnboGLBDvwNPo+6o4+sl9P+uOrBtGIQKbCA 2hWFdyJjXAclJkywasXKUEcxoGEoaO3VlUVK22+YUw+jo3/ZgTMfKK6TUt7lJGGCEhlJ nVMFJJ3KpcLJBEk7ZGGBCBkr/DyIFPXQbAM1Abx2WrpQkp9E6Iq6Uo5mDLCVhU2Ktch2 yk9brVw9tgkCM+TZ6q6fLe6qZFFrTHOaf1idGbfj6Ovz4p7hQNxcS3UibFefadbsF8u1 BIK1HVjBNE794TANQLHD8yYo83LyK01nD9IQJrzXtPkHTK3jkHv/BpuEkSK8m+sUXeK4 aDZw== 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) From: Adhemerval Zanella 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-Spam-Status: No, score=-12.7 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 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