From patchwork Thu Jul 23 19:46:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40154 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B3A133861001; Thu, 23 Jul 2020 19:46:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3A133861001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533613; bh=vIMtlB+62GbBMKQtA9RrHfOFMlx4EcNer3z/X9Zlx1w=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=y1NTvk9j1m2Zixaj4vzr4rtnpqx5nFb0lTzvA0SiqOHiSwEmxZjdQtwdPjRbzBQsu 2mFrBUy4rnbHnXYcPds0MxhKyc7SULm3tZe17MdZJEpbk+WbFeARDADyZiNJ1zHRcQ 7J78hpaWomFeDwTe1eecYYP0fI1WJkkpza+wXjXU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by sourceware.org (Postfix) with ESMTPS id C48C33857002 for ; Thu, 23 Jul 2020 19:46:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C48C33857002 Received: by mail-qk1-x742.google.com with SMTP id d4so3165982qkk.8 for ; Thu, 23 Jul 2020 12:46:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vIMtlB+62GbBMKQtA9RrHfOFMlx4EcNer3z/X9Zlx1w=; b=r1rx6pxZuwYUuzWWmc6V66NLJiJW4PLLKiOWo034p2oxuAimVuYVacK30fjaFsJol7 E3YHwpL+oYGMrSzL7zqie0R+7UX8mJgyd+EvfSpJkW7JapUXjpRUZyurM+iTcuoI/RBs mAwZ4ETOKXwRnQ4gblnIs+gOW+/Ko1L77ZA2+ftcCOroPWSDWVq/OojLK0s1B7Cwt3aM vzkje8eIDp6fr4U+nddyKgNaD2fDz34nB+cCMYk5LwUksSt4q0qGrL30Ct1nItJmImRo vz25QthmJjWW12IBQrxfSsyyKcG03D7CkXpBKbPri0smIo+ClaIFFWXqnU5Du9OhZ1kO gfew== X-Gm-Message-State: AOAM532i5mZN+/Aj/NoVl9/YnGcdAyLD3kk7Zrr7Ov4DV89nD+Nhk1pC btVtvgFadQFhMlqhs2K5edxOZa09iCA= X-Google-Smtp-Source: ABdhPJzEc1hLtnBFkyuTrloPTCzehgk7UoLoCDynIZ4csG0vqCSdc6maUh2VRl6ahBLsXa4mcAQxTA== X-Received: by 2002:a37:6894:: with SMTP id d142mr6776714qkc.287.1595533610099; Thu, 23 Jul 2020 12:46:50 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:49 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 01/16] linux: Always define STAT_IS_KERNEL_STAT Date: Thu, 23 Jul 2020 16:46:26 -0300 Message-Id: <20200723194641.1949404-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It allows to check for its value instead of its existence. Checked with a build for all affected ABIS. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/alpha/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/fxstat.c | 2 +- sysdeps/unix/sysv/linux/fxstatat.c | 4 ++-- sysdeps/unix/sysv/linux/hppa/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/lxstat.c | 2 +- sysdeps/unix/sysv/linux/microblaze/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/mips/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/xstat.c | 2 +- sysdeps/unix/sysv/linux/xstatconv.c | 2 +- sysdeps/unix/sysv/linux/xstatconv.h | 2 +- 14 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h index d637e099cf..9bcc96c577 100644 --- a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h @@ -85,5 +85,6 @@ struct glibc21_stat long __glibc_reserved[4]; }; +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c index ce474dcd47..a88404b5c3 100644 --- a/sysdeps/unix/sysv/linux/fxstat.c +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -38,7 +38,7 @@ __fxstat (int vers, int fd, struct stat *buf) if (vers == _STAT_VER_KERNEL) return INLINE_SYSCALL (fstat, 2, fd, buf); -#ifdef STAT_IS_KERNEL_STAT +#if STAT_IS_KERNEL_STAT return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); #else struct kernel_stat kbuf; diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c index 3eb898e322..937fec45c2 100644 --- a/sysdeps/unix/sysv/linux/fxstatat.c +++ b/sysdeps/unix/sysv/linux/fxstatat.c @@ -37,7 +37,7 @@ int __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { int result; -#ifdef STAT_IS_KERNEL_STAT +#if STAT_IS_KERNEL_STAT # define kst (*st) #else struct kernel_stat kst; @@ -46,7 +46,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result))) { -#ifdef STAT_IS_KERNEL_STAT +#if STAT_IS_KERNEL_STAT return 0; #else return __xstat_conv (vers, &kst, st); diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h index a3ac53a1ef..0cbd010fc3 100644 --- a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h @@ -30,5 +30,6 @@ struct kernel_stat { #define _HAVE_STAT_NSEC #define _HAVE_STAT64_NSEC +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h index eecc962de3..ff54a4524c 100644 --- a/sysdeps/unix/sysv/linux/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/kernel_stat.h @@ -34,5 +34,6 @@ struct kernel_stat #define _HAVE_STAT64___ST_INO #define _HAVE_STAT64_NSEC +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c index e0cfc4f1fa..dcd685873d 100644 --- a/sysdeps/unix/sysv/linux/lxstat.c +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -37,7 +37,7 @@ __lxstat (int vers, const char *name, struct stat *buf) if (vers == _STAT_VER_KERNEL) return INLINE_SYSCALL (lstat, 2, name, buf); -#ifdef STAT_IS_KERNEL_STAT +#if STAT_IS_KERNEL_STAT return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); #else struct kernel_stat kbuf; diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h index 765e0dca67..4daaedc4b6 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h @@ -48,5 +48,6 @@ struct kernel_stat #define _HAVE_STAT64___UNUSED5 }; +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h index 388df1bfff..e75f3e805b 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h @@ -56,5 +56,6 @@ struct kernel_stat }; #endif +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h index c5948a4d3c..75610b8df3 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h @@ -47,5 +47,6 @@ struct kernel_stat #define _HAVE_STAT64___PAD2 #define _HAVE_STAT64_NSEC +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h index a4416009f1..5c8cacaf67 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h @@ -31,5 +31,6 @@ struct kernel_stat #define _HAVE_STAT_NSEC #define _HAVE_STAT64_NSEC +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h index 30afb553b9..d14b2487ac 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h @@ -44,5 +44,6 @@ struct kernel_stat64 long int __glibc_reserved[3]; }; +#define STAT_IS_KERNEL_STAT 0 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c index a93d635611..76c90e20c7 100644 --- a/sysdeps/unix/sysv/linux/xstat.c +++ b/sysdeps/unix/sysv/linux/xstat.c @@ -37,7 +37,7 @@ __xstat (int vers, const char *name, struct stat *buf) if (vers == _STAT_VER_KERNEL) return INLINE_SYSCALL (stat, 2, name, buf); -#ifdef STAT_IS_KERNEL_STAT +#if STAT_IS_KERNEL_STAT return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); #else struct kernel_stat kbuf; diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c index c01fb00a3a..3622a82cd0 100644 --- a/sysdeps/unix/sysv/linux/xstatconv.c +++ b/sysdeps/unix/sysv/linux/xstatconv.c @@ -20,7 +20,7 @@ #include #include -#ifdef STAT_IS_KERNEL_STAT +#if STAT_IS_KERNEL_STAT /* Dummy. */ struct kernel_stat; diff --git a/sysdeps/unix/sysv/linux/xstatconv.h b/sysdeps/unix/sysv/linux/xstatconv.h index 39102c9469..5319236cae 100644 --- a/sysdeps/unix/sysv/linux/xstatconv.h +++ b/sysdeps/unix/sysv/linux/xstatconv.h @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see . */ -#ifndef STAT_IS_KERNEL_STAT +#if !STAT_IS_KERNEL_STAT extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) attribute_hidden; extern int __xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf) From patchwork Thu Jul 23 19:46:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40155 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B9E073861838; Thu, 23 Jul 2020 19:46:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9E073861838 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533615; bh=cy0cIwLEUm4a4vYgBakqPfNVJGFXEvc6LB9z1W+J1OA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Wm3mRez38qKt0nBw1fI9TW6S+ElCiabiqE64NyPh+C2GVWwrVXtzJbxUb4MSnwnKF U/4h8/AnLqYAVuAohCOc4r+eE/HzbHfaOMsjAwehqlJ3OfY7uiozOY+gdFnJBct254 UWIJXf35k3xoCINNZ8mTslFnHDlE/3HfxqBfe/Ak= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by sourceware.org (Postfix) with ESMTPS id 888A43858D38 for ; Thu, 23 Jul 2020 19:46:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 888A43858D38 Received: by mail-qt1-x842.google.com with SMTP id e12so5298688qtr.9 for ; Thu, 23 Jul 2020 12:46:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cy0cIwLEUm4a4vYgBakqPfNVJGFXEvc6LB9z1W+J1OA=; b=S7llGSZqSDkhU2OcdcGFL+MR/xxSpTHGoHuEKudPcB51ScUC2HFzz/L5oj7pSoqwSn gRBRdBlgrm4+R05RbPPxnP+2U5tQmz4GQINytsqdBDLtGi58uXs5yDgTSvppoZPSG2VY eQsxjdMqtIP4LQN6ZOBLFMMU7VA1mKoAH4nDhlQTNck/NA1jkC5jpH0zNBZFLGDcdGke 8SU8R4jpk2zO31hCK4Zz99gtkNQAICYgC5kRfEwYFBVxNIxRPkLAG6FVJPPxoqbyexv/ 4XyBzkIHEStoWG0SvBhgrC5zvwyJzUT2CI4knZjoIdktMDr2BKDceqw5oBO2WYy6y2jN mRpQ== X-Gm-Message-State: AOAM532+Rik0FeopE5VN9RxNrBn/EtHF36mr8EiT2kyastHD4RuJH+Ln 2EkiPDVAFGI2YOlGKaf6d+djk9pA5uw= X-Google-Smtp-Source: ABdhPJxSgAXeDpIrYDQep4z8Zz2P68OkLPLfqz7bdon4L5IK5Dy5IN1giTObsC46ck+jHYwAliscew== X-Received: by 2002:ac8:44a8:: with SMTP id a8mr6094123qto.29.1595533611824; Thu, 23 Jul 2020 12:46:51 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:51 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 02/16] linux: Define STAT64_IS_KERNEL_STAT64 Date: Thu, 23 Jul 2020 16:46:27 -0300 Message-Id: <20200723194641.1949404-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It indicates that the glibc export stat64 is similar in size and layout of the kernel stat64 used on the syscall. It is not currently used on stat implementation, but the idea is to indicate whether to use the kernel_stat to issue on the syscall on the *stat*64 variant (more specifically on mips which its exported ABI does not match the kernel). Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/alpha/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/arc/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/hppa/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/ia64/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/microblaze/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/mips/kernel_stat.h | 6 ++++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h | 1 + sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h | 6 ++++++ sysdeps/unix/sysv/linux/x86_64/kernel_stat.h | 1 + 13 files changed, 23 insertions(+) diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h index 9bcc96c577..ff69045f8f 100644 --- a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h @@ -86,5 +86,6 @@ struct glibc21_stat }; #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h b/sysdeps/unix/sysv/linux/arc/kernel_stat.h index 8fdd86b9e8..fd9b113f45 100644 --- a/sysdeps/unix/sysv/linux/arc/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/arc/kernel_stat.h @@ -19,6 +19,7 @@ /* Needed to elide the itemized copy code in common xstatconv.c. */ #define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 /* Nice side-effect of 64-bit time_t switch is these are same. */ #define XSTAT_IS_XSTAT64 1 diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h index 0cbd010fc3..e8ad135e70 100644 --- a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h @@ -31,5 +31,6 @@ struct kernel_stat { #define _HAVE_STAT64_NSEC #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h index b38bf741d3..c96a0589dc 100644 --- a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h @@ -17,5 +17,6 @@ . */ #define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h index ff54a4524c..b1bc1459f0 100644 --- a/sysdeps/unix/sysv/linux/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/kernel_stat.h @@ -35,5 +35,6 @@ struct kernel_stat #define _HAVE_STAT64_NSEC #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h index 4daaedc4b6..9ab1e50115 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h @@ -49,5 +49,6 @@ struct kernel_stat }; #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h index e75f3e805b..21dba2de73 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h @@ -1,3 +1,6 @@ +#ifndef _KERNEL_STAT_H +#define _KERNEL_STAT_H + #include /* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the userland data structures are not identical, because of different @@ -57,5 +60,8 @@ struct kernel_stat #endif #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 0 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 + +#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h index 75610b8df3..5757e65f8e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h @@ -48,5 +48,6 @@ struct kernel_stat #define _HAVE_STAT64_NSEC #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h index 5c10da3356..9f11b69e4f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h @@ -17,5 +17,6 @@ . */ #define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h index b38bf741d3..c96a0589dc 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h @@ -17,5 +17,6 @@ . */ #define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h index 5c8cacaf67..4a2df42d37 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h @@ -32,5 +32,6 @@ struct kernel_stat #define _HAVE_STAT64_NSEC #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 0 #define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h index d14b2487ac..0f3d405239 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h @@ -1,3 +1,6 @@ +#ifndef _KERNEL_STAT_H +#define _KERNEL_STAT_H + /* Definition of `struct stat' used in the kernel */ struct kernel_stat { @@ -45,5 +48,8 @@ struct kernel_stat64 }; #define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 0 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 + +#endif /* _KERNEL_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h index b38bf741d3..c96a0589dc 100644 --- a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h @@ -17,5 +17,6 @@ . */ #define STAT_IS_KERNEL_STAT 1 +#define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 #define STATFS_IS_STATFS64 0 From patchwork Thu Jul 23 19:46:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40156 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4D886385042C; Thu, 23 Jul 2020 19:46:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D886385042C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533619; bh=gBYu11ARBM3vS/Kn5q1TMj2laY8xeSwTwODa+Ixobek=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=VAmqbZcqxgBZmvB+RdQ51doaLGYaLjQJOfHFmI6LkBdmvFPdAkcTf6BZxqSts75sg fmTECIISGCXzYKvKcNZ7mFoMsv4dS24KLJkip1r2nt8ShYbecRkAyxiWK3HfgxvApk yLKOSWQroGoP7bw2nwf6LbVIQZimRUsq5JI36uNo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by sourceware.org (Postfix) with ESMTPS id 2A4BB385042C for ; Thu, 23 Jul 2020 19:46:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2A4BB385042C Received: by mail-qv1-xf41.google.com with SMTP id h17so3139799qvr.0 for ; Thu, 23 Jul 2020 12:46:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gBYu11ARBM3vS/Kn5q1TMj2laY8xeSwTwODa+Ixobek=; b=SmZ4FGMXIlmo9PPzjx2wD31n02DNHHFN1z0KhDwlvAyqCrd4ClpCB7BaVMG8ARs4sw 7heGQiK/zLSDsmbAvGCVggA5+DiBr0VDHKg9HUeN0flJ5Wt8BmhNGR7hlQ6QB7mmmgZS TL23G1nvd0UIeohRZ93qUm7AvtrfTsifvwN9xNLKKCu3JU0+6/QpRlMr3sqnmi0uONut usPL6hqO4brOA3FYK6HVnzNmzuDZ8/ePAGm4LagQ7mkjNQAy4FZx7br3Xu1aLvp4uddq HTCEKD2XUjkOlJNtVom2Btmp22OSUa0eb5+vgowcjgsSdmIvkmaUE1ooyiRKkkBntjI/ m1hQ== X-Gm-Message-State: AOAM530Q3AqOT0yrCHqXsMQu5H6Kah4d59yMdktklLn6sC2CFnRBH2HJ QQqmxU//gt6tji/4mD9mtK3jgQgZzdE= X-Google-Smtp-Source: ABdhPJwBxJaS/AD0YzhqDSLEX4zNoBnR4UBvJ1C0CRuSrVJ+WpmSB2S7/qyqzrBG3TACevDSW2gMAg== X-Received: by 2002:a0c:dd8f:: with SMTP id v15mr4100032qvk.144.1595533613544; Thu, 23 Jul 2020 12:46:53 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:53 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 03/16] linux: Consolidate xstat{64} Date: Thu, 23 Jul 2020 16:46:28 -0300 Message-Id: <20200723194641.1949404-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The LFS support is implemented on xstat64.c, instead of xstat.c for 64-bit architectures. The xstat.c implements the non-LFS it is no-op for !XSTAT_IS_XSTAT64. The generic non-LFS implementation handle two cases: 1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issues __NR_fstat64 plus handle the overflow on st_ino, st_size, or st_blocks. It only handles _STAT_VER_KERNEL. 2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, s390, sh, powerpc, and sparc32). For _STAT_VER_KERNEL it issues __NR_stat, otherwise it issues __NR_stat64 and convert to non-LFS stat struct handling possible overflows on st_ino, st_size, or st_blocks. Also the non-LFS mips is an outlier and it has its own implementation since _STAT_VER_LINUX requires a different conversion function (it uses the kernel_stat as the syscall argument since its exported ABI is different than the kernel one for both non-LFS and LFS implementation). The generic LFS implementation handles multiple cases: 1. XSTAT_IS_XSTAT64 being 1: 1.1. Old 64-bit kABI (ia64, powerpc64*, s390x, sparc64, x86_64): it issues __NR_stat for _STAT_VER_KERNEL or _STAT_VER_LINUX. 1.2. New kABIs which uses generic 64-bit Linux ABI (aarch64 and riscv64): it issues __NR_newfstatat and only for _STAT_VER_KERNEL. 1.3. New 32-bit kABIs with only 64-bit time_t support (arc and riscv32): it issues __NR_statx and covert to struct stat64. 2. Old ABIs with XSTAT_IS_XSTAT64 being 0: 2.1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios2): it issues __NR_fstatat64 for _STAT_VER_KERNEL. 2.2. Old kABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, s390, sh, mips32, powerpc32, and sparc32): it issues __NR_stat64. Also, two special cases requires specific LFS implementations: 1. alpha: it requires to handle _STAT_VER_KERNEL64 to call __NR_stat64 or use the kernel_stat with __NR_stat otherwise. 2. mips64: as for non-LFS implementation its ABIs differ from glibc exported one, which requires an specific conversion function to handle the kernel_stat. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/alpha/xstat.c | 57 ---------------- .../{generic/xstat.c => alpha/xstat64.c} | 47 ++++++------- sysdeps/unix/sysv/linux/arm/xstat.c | 1 - .../sysv/linux/generic/wordsize-32/xstat.c | 54 --------------- .../sysv/linux/generic/wordsize-32/xstat64.c | 63 ----------------- sysdeps/unix/sysv/linux/hppa/xstat.c | 1 - sysdeps/unix/sysv/linux/i386/xstat.c | 59 ---------------- sysdeps/unix/sysv/linux/m68k/xstat.c | 1 - sysdeps/unix/sysv/linux/microblaze/xstat.c | 1 - sysdeps/unix/sysv/linux/mips/mips64/xstat64.c | 16 +---- .../sysv/linux/{wordsize-64 => mips}/xstat.c | 32 +++++---- .../unix/sysv/linux/powerpc/powerpc32/xstat.c | 1 - sysdeps/unix/sysv/linux/s390/s390-32/xstat.c | 1 - sysdeps/unix/sysv/linux/sh/xstat.c | 1 - sysdeps/unix/sysv/linux/sparc/sparc32/xstat.c | 1 - sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c | 1 - sysdeps/unix/sysv/linux/wordsize-64/xstat64.c | 1 - sysdeps/unix/sysv/linux/xstat.c | 60 +++++++++-------- sysdeps/unix/sysv/linux/xstat64.c | 51 ++++++++++++-- sysdeps/unix/sysv/linux/xstatover.h | 67 +++++++++++++++++++ 20 files changed, 184 insertions(+), 332 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/xstat.c rename sysdeps/unix/sysv/linux/{generic/xstat.c => alpha/xstat64.c} (57%) delete mode 100644 sysdeps/unix/sysv/linux/arm/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c delete mode 100644 sysdeps/unix/sysv/linux/hppa/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/i386/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/microblaze/xstat.c rename sysdeps/unix/sysv/linux/{wordsize-64 => mips}/xstat.c (67%) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/sh/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/xstat64.c create mode 100644 sysdeps/unix/sysv/linux/xstatover.h diff --git a/sysdeps/unix/sysv/linux/alpha/xstat.c b/sysdeps/unix/sysv/linux/alpha/xstat.c deleted file mode 100644 index 3ba1ae1811..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/xstat.c +++ /dev/null @@ -1,57 +0,0 @@ -/* xstat using old-style Unix stat system call. - Copyright (C) 2004-2020 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 - . */ - -#define __xstat64 __xstat64_disable - -#include -#include -#include -#include -#include -#include -#include - -#undef __xstat64 - - -/* Get information about the file NAME in BUF. */ -int -__xstat (int vers, const char *name, struct stat *buf) -{ - int result; - struct kernel_stat kbuf; - - if (vers == _STAT_VER_KERNEL64) - { - result = INTERNAL_SYSCALL_CALL (stat64, name, buf); - if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) - return result; - __set_errno (INTERNAL_SYSCALL_ERRNO (result)); - return -1; - } - - result = INTERNAL_SYSCALL_CALL (stat, name, &kbuf); - if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) - return __xstat_conv (vers, &kbuf, buf); - __set_errno (INTERNAL_SYSCALL_ERRNO (result)); - return -1; -} -hidden_def (__xstat) -weak_alias (__xstat, _xstat); -strong_alias (__xstat, __xstat64); -hidden_ver (__xstat, __xstat64) diff --git a/sysdeps/unix/sysv/linux/generic/xstat.c b/sysdeps/unix/sysv/linux/alpha/xstat64.c similarity index 57% rename from sysdeps/unix/sysv/linux/generic/xstat.c rename to sysdeps/unix/sysv/linux/alpha/xstat64.c index 2eb27a6f91..ac1af53780 100644 --- a/sysdeps/unix/sysv/linux/generic/xstat.c +++ b/sysdeps/unix/sysv/linux/alpha/xstat64.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* xstat using old-style Unix stat system call. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,33 +16,34 @@ License along with the GNU C Library. If not, see . */ -/* Ignore prototype to avoid error if we alias __xstat and __xstat64. */ -#define __xstat64 __xstat64_disable - -#include -#include -#include +#define __xstat __redirect___xstat #include +#undef __xstat +#include #include - #include -#include +#include /* Get information about the file NAME in BUF. */ int -__xstat (int vers, const char *name, struct stat *buf) +__xstat64 (int vers, const char *name, struct stat64 *buf) { - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (newfstatat, 4, AT_FDCWD, name, buf, 0); - - errno = EINVAL; - return -1; + switch (vers) + { + case _STAT_VER_KERNEL64: + return INLINE_SYSCALL_CALL (stat64, name, buf); + + default: + { + struct kernel_stat kbuf; + int r = INTERNAL_SYSCALL_CALL (stat, name, &kbuf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); + } + } } +weak_alias (__xstat64, __xstat); +weak_alias (__xstat64, __GI___xstat); -hidden_def (__xstat) -weak_alias (__xstat, _xstat); -#if XSTAT_IS_XSTAT64 -#undef __xstat64 -strong_alias (__xstat, __xstat64); -hidden_ver (__xstat, __xstat64) -#endif +hidden_def (__xstat64) diff --git a/sysdeps/unix/sysv/linux/arm/xstat.c b/sysdeps/unix/sysv/linux/arm/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/arm/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c deleted file mode 100644 index a4a921c1ea..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 -#include - -#include -#include - -#if !XSTAT_IS_XSTAT64 -#include "overflow.h" -#include - -/* Get information about the file NAME in BUF. */ -int -__xstat (int vers, const char *name, struct stat *buf) -{ - if (vers == _STAT_VER_KERNEL) - { -# ifdef __NR_fstatat64 - int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0); -# else - struct statx tmp; - int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, AT_NO_AUTOMOUNT, - STATX_BASIC_STATS, &tmp); - if (rc == 0) - __cp_stat64_statx ((struct stat64 *)buf, &tmp); -# endif - return rc ?: stat_overflow (buf); - } - - errno = EINVAL; - return -1; -} -hidden_def (__xstat) -#endif diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c deleted file mode 100644 index 0848b5a4b4..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 - . */ - -/* Hide the prototype for __xstat so that GCC will not complain about - the different function signature if it is aliased to __xstat64. - If XSTAT_IS_XSTAT64 is set to non-zero then the stat and stat64 - structures have an identical layout but different type names. */ - -#define __xstat __xstat_disable - -#include -#include -#include -#include -#include - -#include -#include - -#include - -/* Get information about the file NAME in BUF. */ -int -__xstat64 (int vers, const char *name, struct stat64 *buf) -{ - if (vers == _STAT_VER_KERNEL) - { -#ifdef __NR_fstatat64 - return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0); -#else - struct statx tmp; - int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, AT_NO_AUTOMOUNT, - STATX_BASIC_STATS, &tmp); - if (rc == 0) - __cp_stat64_statx (buf, &tmp); - return rc; -#endif - } - errno = EINVAL; - return -1; -} -hidden_def (__xstat64) - -#undef __xstat -#if XSTAT_IS_XSTAT64 -strong_alias (__xstat64, __xstat) -hidden_ver (__xstat64, __xstat) -#endif diff --git a/sysdeps/unix/sysv/linux/hppa/xstat.c b/sysdeps/unix/sysv/linux/hppa/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/hppa/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/i386/xstat.c b/sysdeps/unix/sysv/linux/i386/xstat.c deleted file mode 100644 index 96f67168ac..0000000000 --- a/sysdeps/unix/sysv/linux/i386/xstat.c +++ /dev/null @@ -1,59 +0,0 @@ -/* xstat using old-style Unix stat system call. - Copyright (C) 1991-2020 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 - . */ - -/* Ho hum, if xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __xstat64 __xstat64_disable - -#include -#include -#include -#include - -#include -#include - -#include - - -/* Get information about the file NAME in BUF. */ -int -__xstat (int vers, const char *name, struct stat *buf) -{ - int result; - - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (stat, 2, name, buf); - - { - struct stat64 buf64; - - result = INTERNAL_SYSCALL_CALL (stat64, name, &buf64); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); - else - return __xstat32_conv (vers, &buf64, buf); - } -} -hidden_def (__xstat) -weak_alias (__xstat, _xstat); -#if XSTAT_IS_XSTAT64 -# undef __xstat64 -strong_alias (__xstat, __xstat64); -hidden_ver (__xstat, __xstat64) -#endif diff --git a/sysdeps/unix/sysv/linux/m68k/xstat.c b/sysdeps/unix/sysv/linux/m68k/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/microblaze/xstat.c b/sysdeps/unix/sysv/linux/microblaze/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/microblaze/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c index 7eee9e67d4..99b03c7593 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c @@ -1,4 +1,4 @@ -/* xstat64 using 64-bit MIPS stat system call. +/* xstat64 using Linux stat64 system call. Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,14 +16,9 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include #include - #include -#include - #include /* Get information about the file NAME in BUF. */ @@ -31,14 +26,9 @@ int __xstat64 (int vers, const char *name, struct stat64 *buf) { - int result; struct kernel_stat kbuf; - - result = INLINE_SYSCALL (stat, 2, name, &kbuf); - if (result == 0) - result = __xstat64_conv (vers, &kbuf, buf); - - return result; + int r = INLINE_SYSCALL_CALL (stat, name, &kbuf); + return r ?: __xstat64_conv (vers, &kbuf, buf); } hidden_def (__xstat64) diff --git a/sysdeps/unix/sysv/linux/wordsize-64/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c similarity index 67% rename from sysdeps/unix/sysv/linux/wordsize-64/xstat.c rename to sysdeps/unix/sysv/linux/mips/xstat.c index 438d54d291..835691cf89 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/xstat.c +++ b/sysdeps/unix/sysv/linux/mips/xstat.c @@ -16,29 +16,27 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, since xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __xstat64 __xstat64_disable - -#include -#include #include - +#include +#include #include -#include +#include /* Get information about the file NAME in BUF. */ int __xstat (int vers, const char *name, struct stat *buf) { - if (vers == _STAT_VER_KERNEL || vers == _STAT_VER_LINUX) - return INLINE_SYSCALL (stat, 2, name, buf); - - __set_errno (EINVAL); - return -1; + switch (vers) + { + case _STAT_VER_KERNEL: + return INLINE_SYSCALL_CALL (stat, name, buf); + + default: + { + struct kernel_stat kbuf; + int r = INTERNAL_SYSCALL_CALL (stat, name, &kbuf); + return r ?: __xstat_conv (vers, &kbuf, buf); + } + } } hidden_def (__xstat) -weak_alias (__xstat, _xstat); -#undef __xstat64 -strong_alias (__xstat, __xstat64); -hidden_ver (__xstat, __xstat64) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/xstat.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sh/xstat.c b/sysdeps/unix/sysv/linux/sh/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/sh/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/xstat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/xstat.c deleted file mode 100644 index e9869f5508..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c deleted file mode 100644 index c3b00cb1d4..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../i386/xstat.c" diff --git a/sysdeps/unix/sysv/linux/wordsize-64/xstat64.c b/sysdeps/unix/sysv/linux/wordsize-64/xstat64.c deleted file mode 100644 index e7acd3b45e..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/xstat64.c +++ /dev/null @@ -1 +0,0 @@ -/* xstat64 is in xstat.c */ diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c index 76c90e20c7..0ae52b1901 100644 --- a/sysdeps/unix/sysv/linux/xstat.c +++ b/sysdeps/unix/sysv/linux/xstat.c @@ -16,44 +16,46 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, if xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __xstat64 __xstat64_disable - -#include -#include #include +#include #include - #include -#include -#include +#if !XSTAT_IS_XSTAT64 +# include +# include /* Get information about the file NAME in BUF. */ int __xstat (int vers, const char *name, struct stat *buf) { - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (stat, 2, name, buf); - -#if STAT_IS_KERNEL_STAT - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); -#else - struct kernel_stat kbuf; - int result; - - result = INLINE_SYSCALL (stat, 2, name, &kbuf); - if (result == 0) - result = __xstat_conv (vers, &kbuf, buf); - - return result; + switch (vers) + { + case _STAT_VER_KERNEL: + { +# if STAT_IS_KERNEL_STAT + /* New kABIs which uses generic pre 64-bit time Linux ABI, + e.g. csky, nios2 */ + int r = INLINE_SYSCALL_CALL (fstatat64, AT_FDCWD, name, buf, 0); + return r ?: stat_overflow (buf); +# else + /* Old kABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, + microblaze, s390, sh, powerpc, and sparc32. */ + return INLINE_SYSCALL_CALL (stat, name, buf); +# endif + } + + default: + { +# if STAT_IS_KERNEL_STAT + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); +# else + struct stat64 buf64; + int r = INLINE_SYSCALL_CALL (stat64, name, &buf64); + return r ?: __xstat32_conv (vers, &buf64, buf); #endif + } + } } hidden_def (__xstat) -weak_alias (__xstat, _xstat); -#if XSTAT_IS_XSTAT64 -#undef __xstat64 -strong_alias (__xstat, __xstat64); -hidden_ver (__xstat, __xstat64) -#endif +#endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c index 16c6e69710..4feb55f429 100644 --- a/sysdeps/unix/sysv/linux/xstat64.c +++ b/sysdeps/unix/sysv/linux/xstat64.c @@ -16,24 +16,61 @@ License along with the GNU C Library; if not, see . */ -#include -#include +#define __xstat __redirect___xstat #include +#undef __xstat +#include #include - #include -#include +#include +#include /* Get information about the file NAME in BUF. */ int ___xstat64 (int vers, const char *name, struct stat64 *buf) { - int result; - result = INLINE_SYSCALL (stat64, 2, name, buf); - return result; +#if XSTAT_IS_XSTAT64 +# if defined __NR_stat + /* Old 64-bit kABI, e.g. ia64, powerpc64*, s390x, sparc64, x86_64. */ + if (vers == _STAT_VER_KERNEL || vers == _STAT_VER_LINUX) + return INLINE_SYSCALL_CALL (stat, name, buf); +# elif defined __NR_newfstatat + /* New kABIs which uses generic 64-bit Linux ABI, e.g. aarch64, riscv64. */ + if (vers == _STAT_VER_KERNEL) + return INLINE_SYSCALL_CALL (newfstatat, AT_FDCWD, name, buf, 0); +# else + /* New 32-bit kABIs with only 64-bit time_t support, e.g. arc, riscv32. */ + if (vers == _STAT_VER_KERNEL) + { + struct statx tmp; + int r = INLINE_SYSCALL_CALL (statx, AT_FDCWD, name, AT_NO_AUTOMOUNT, + STATX_BASIC_STATS, &tmp); + if (r == 0) + __cp_stat64_statx (buf, &tmp); + return r; + } +# endif +#else +# if STAT_IS_KERNEL_STAT + /* New kABIs which uses generic pre 64-bit time Linux ABI, + e.g. csky, nios2 */ + if (vers == _STAT_VER_KERNEL) + return INLINE_SYSCALL_CALL (fstatat64, AT_FDCWD, name, buf, 0); +# else + /* Old kABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, + microblaze, s390, sh, mips32, powerpc32, and sparc32. */ + return INLINE_SYSCALL_CALL (stat64, name, buf); +# endif /* STAT_IS_KERNEL_STAT */ +#endif /* XSTAT_IS_XSTAT64 */ + + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } +#if XSTAT_IS_XSTAT64 +weak_alias (___xstat64, __xstat); +weak_alias (___xstat64, __GI___xstat); +#endif #include diff --git a/sysdeps/unix/sysv/linux/xstatover.h b/sysdeps/unix/sysv/linux/xstatover.h new file mode 100644 index 0000000000..20178114f9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/xstatover.h @@ -0,0 +1,67 @@ +/* Overflow tests for stat, statfs, and lseek functions. + Copyright (C) 2020 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 + +/* Test for overflows of structures where we ask the kernel to fill them + in with standard 64-bit syscalls but return them through APIs that + only expose the low 32 bits of some fields. */ + +static inline off_t lseek_overflow (loff_t res) +{ + off_t retval = (off_t) res; + if (retval == res) + return retval; + + __set_errno (EOVERFLOW); + return (off_t) -1; +} + +static inline int stat_overflow (struct stat *buf) +{ +#if defined __INO_T_MATCHES_INO64_T || !STAT_IS_KERNEL_STAT + return 0; +#else + if (buf->__st_ino_pad == 0 && buf->__st_size_pad == 0 + && buf->__st_blocks_pad == 0) + return 0; + + __set_errno (EOVERFLOW); + return -1; +#endif +} + +/* Note that f_files and f_ffree may validly be a sign-extended -1. */ +static inline int statfs_overflow (struct statfs *buf) +{ +#if __STATFS_MATCHES_STATFS64 || !STAT_IS_KERNEL_STAT + return 0; +#else + if (buf->__f_blocks_pad == 0 && buf->__f_bfree_pad == 0 + && buf->__f_bavail_pad == 0 + && (buf->__f_files_pad == 0 + || (buf->f_files == -1U && buf->__f_files_pad == -1)) + && (buf->__f_ffree_pad == 0 + || (buf->f_ffree == -1U && buf->__f_ffree_pad == -1))) + return 0; + + __set_errno (EOVERFLOW); + return -1; +#endif +} From patchwork Thu Jul 23 19:46:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40157 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5DF0238618C3; Thu, 23 Jul 2020 19:47:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DF0238618C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533621; bh=NO4Uc4XvpHet6fOKoiHgwlMYs2LdSx7NrCVVX3h6rDk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mSqhIcoQDb57jeTH70wJJ4UeHzTh/wqVYvr2JE7gBrSxo+ZWUdRJwp/Kdbj7MZaWW yZ6SKEr4rlqnFt3J40c1BsPlaCncTYxCJA3MHEjEMyrRskBIWy27UXrcCNCCbpzjbq FTfvqT+I/a4T18lV4RZJ8SXeaW9agL1RXIJCDsVk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by sourceware.org (Postfix) with ESMTPS id 998193858D38 for ; Thu, 23 Jul 2020 19:46:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 998193858D38 Received: by mail-qv1-xf41.google.com with SMTP id t11so3131160qvk.1 for ; Thu, 23 Jul 2020 12:46:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NO4Uc4XvpHet6fOKoiHgwlMYs2LdSx7NrCVVX3h6rDk=; b=OJ8oi7/GKfXR3S0blapA+qjCx+TYtqwfNMSBxZfm7rEPQtSKRQpW/2j2HwvSN5JQ53 UGOlIPstXe/xcZOhLK7hxSbRdyrNjFLgm8B6K2FCNdrM7LRwP3f2LsAZi0dC9+2Nb6kj V60Ro5AabyDbMFOWqVhcCz5KWsA/TTkyEWd8ZnJUHwVi/LOn298MyjhQ2BUkrgo21pM+ uQZV1/jdOcuoPdVIWNbQuL6y49bkQYFlhIrmor64jJofm+1Fu3AldDAc6DRieIEY+I7d ZirHftyaXqJhJs6gzESiNegpOuYALaTeyGtbZm6fqS0MXI1Hj6X8y9KAOfWSttEtytpe cNkg== X-Gm-Message-State: AOAM531HVS2ArRegYIiUsyQ5Z8GI7LpBIATeA+3r+oxOtWoOg4x0IFMf KblPh3v6cfjevjg3WUOxEfSUlcaIBtU= X-Google-Smtp-Source: ABdhPJyPooJFRGlX89uyoksG/pSBtEukuokEtlZjxOLIlqHD6Bq9/YT7MVNkqpn91SL+2dtn3zriGg== X-Received: by 2002:a0c:fd84:: with SMTP id p4mr6448900qvr.175.1595533615313; Thu, 23 Jul 2020 12:46:55 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:54 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 04/16] linux: Consolidate lxstat{64} Date: Thu, 23 Jul 2020 16:46:29 -0300 Message-Id: <20200723194641.1949404-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The LFS support is implemented on lxstat64.c, instead of lxstat.c for 64-bit architectures. The xstat.c implements the non-LFS and it is a no-op for !XSTAT_IS_XSTAT64. The generic non-LFS implementation handles two cases: 1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issues __NR_fstat64 with AT_SYMLINK_NOFOLLOW plus handles the possible overflow off st_ino, st_size, or st_blocks. It only handles _STAT_VER_KERNEL. 2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, s390, sh, powerpc, and sparc32). For _STAT_VER_KERNEL it issues __NR_lstat, otherwise it isseus __NR_lstat64 and convert to non-LFS stat struct and handle possible overflows on st_ino, st_size, or st_blocks. Also non-LFS mips is an outlier and it has its own implementation since _STAT_VER_LINUX requires a different conversion function (it uses the kernel_stat as the syscall argument since its exported ABI is different than the kernel one for both non-LFS and LFS implementation). The generic LFS implementation handles multiple cases: 1. XSTAT_IS_XSTAT64 being 1: 1.1. Old 64-bit kABI (ia64, powerpc64*, s390x, sparc64, x86_64): it issues __NR_lstat for _STAT_VER_KERNEL or _STAT_VER_LINUX. 1.2. New kABIs which uses generic 64-bit Linux ABI (aarch64 and riscv64): it issues __NR_newfstatat with AT_SYMLINK_NOFOLLOW and only for _STAT_VER_KERNEL. 1.3. New 32-bit kABIs with only 64-bit time_t support (arc and riscv32): it issues __NR_statx and covert to struct stat64. 2. Old ABIs with XSTAT_IS_XSTAT64 being 0: 2.1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios2): it issues __NR_fstatat64 for _STAT_VER_KERNEL. 2.2. Old kABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, s390, sh, mips32, powerpc32, and sparc32): it issues __NR_lstat64. Also, two special cases requires specific LFS implementations: 1. alpha: it requires to handle _STAT_VER_KERNEL64 to issue __NR_lstat64 and use the kernel_stat with __NR_lstat otherwise. 2. mips64: as for non-LFS implementation its ABIs differ from glibc exported one, which requires a specific conversion function to handle the kernel_stat. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/alpha/lxstat.c | 57 ---------------- .../{generic/lxstat.c => alpha/lxstat64.c} | 47 ++++++------- sysdeps/unix/sysv/linux/arm/lxstat.c | 1 - .../sysv/linux/generic/wordsize-32/lxstat.c | 55 ---------------- .../sysv/linux/generic/wordsize-32/lxstat64.c | 66 ------------------- sysdeps/unix/sysv/linux/hppa/lxstat.c | 1 - sysdeps/unix/sysv/linux/i386/lxstat.c | 60 ----------------- sysdeps/unix/sysv/linux/lxstat.c | 64 +++++++++--------- sysdeps/unix/sysv/linux/lxstat64.c | 58 +++++++++++++--- sysdeps/unix/sysv/linux/m68k/lxstat.c | 1 - sysdeps/unix/sysv/linux/microblaze/lxstat.c | 1 - .../sysv/linux/{wordsize-64 => mips}/lxstat.c | 37 +++++------ .../unix/sysv/linux/mips/mips64/lxstat64.c | 14 +--- .../sysv/linux/powerpc/powerpc32/lxstat.c | 2 - sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c | 1 - sysdeps/unix/sysv/linux/sh/lxstat.c | 2 - .../unix/sysv/linux/sparc/sparc32/lxstat.c | 2 - .../unix/sysv/linux/sparc/sparc64/lxstat.c | 1 - .../unix/sysv/linux/wordsize-64/lxstat64.c | 1 - 19 files changed, 126 insertions(+), 345 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/lxstat.c rename sysdeps/unix/sysv/linux/{generic/lxstat.c => alpha/lxstat64.c} (55%) delete mode 100644 sysdeps/unix/sysv/linux/arm/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c delete mode 100644 sysdeps/unix/sysv/linux/hppa/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/i386/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/microblaze/lxstat.c rename sysdeps/unix/sysv/linux/{wordsize-64 => mips}/lxstat.c (60%) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/sh/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/lxstat64.c diff --git a/sysdeps/unix/sysv/linux/alpha/lxstat.c b/sysdeps/unix/sysv/linux/alpha/lxstat.c deleted file mode 100644 index eb03a5fbfe..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/lxstat.c +++ /dev/null @@ -1,57 +0,0 @@ -/* lxstat using old-style Unix stat system call. - Copyright (C) 2004-2020 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 - . */ - -#define __lxstat64 __lxstat64_disable - -#include -#include -#include -#include -#include -#include -#include - -#undef __lxstat64 - - -/* Get information about the file NAME in BUF. */ -int -__lxstat (int vers, const char *name, struct stat *buf) -{ - int result; - struct kernel_stat kbuf; - - if (vers == _STAT_VER_KERNEL64) - { - result = INTERNAL_SYSCALL_CALL (lstat64, name, buf); - if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) - return result; - __set_errno (INTERNAL_SYSCALL_ERRNO (result)); - return -1; - } - - result = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf); - if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) - return __xstat_conv (vers, &kbuf, buf); - __set_errno (INTERNAL_SYSCALL_ERRNO (result)); - return -1; -} -hidden_def (__lxstat) -weak_alias (__lxstat, _lxstat); -strong_alias (__lxstat, __lxstat64); -hidden_ver (__lxstat, __lxstat64) diff --git a/sysdeps/unix/sysv/linux/generic/lxstat.c b/sysdeps/unix/sysv/linux/alpha/lxstat64.c similarity index 55% rename from sysdeps/unix/sysv/linux/generic/lxstat.c rename to sysdeps/unix/sysv/linux/alpha/lxstat64.c index 1cf082961a..90dc0c7ce7 100644 --- a/sysdeps/unix/sysv/linux/generic/lxstat.c +++ b/sysdeps/unix/sysv/linux/alpha/lxstat64.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* lxstat using old-style Unix stat system call. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,33 +16,34 @@ License along with the GNU C Library. If not, see . */ -/* Ignore prototype to avoid error if we alias __lxstat and __lxstat64. */ -#define __lxstat64 __lxstat64_disable - -#include -#include -#include +#define __lxstat __redirect___lxstat #include +#undef __lxstat +#include #include - #include -#include +#include /* Get information about the file NAME in BUF. */ int -__lxstat (int vers, const char *name, struct stat *buf) +__lxstat64 (int vers, const char *name, struct stat64 *buf) { - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (newfstatat, 4, AT_FDCWD, name, buf, - AT_SYMLINK_NOFOLLOW); - errno = EINVAL; - return -1; + switch (vers) + { + case _STAT_VER_KERNEL64: + return INLINE_SYSCALL_CALL (lstat64, name, buf); + + default: + { + struct kernel_stat kbuf; + int r = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); + } + } } +weak_alias (__lxstat64, __lxstat); +weak_alias (__lxstat64, __GI___lxstat); -hidden_def (__lxstat) -weak_alias (__lxstat, _lxstat); -#if XSTAT_IS_XSTAT64 -#undef __lxstat64 -strong_alias (__lxstat, __lxstat64); -hidden_ver (__lxstat, __lxstat64) -#endif +hidden_def (__lxstat64) diff --git a/sysdeps/unix/sysv/linux/arm/lxstat.c b/sysdeps/unix/sysv/linux/arm/lxstat.c deleted file mode 100644 index 0efa0aea49..0000000000 --- a/sysdeps/unix/sysv/linux/arm/lxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c deleted file mode 100644 index bd02631d68..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 -#include - -#include -#include - -#if !XSTAT_IS_XSTAT64 -#include "overflow.h" -#include - -/* Get information about the file NAME in BUF. */ -int -__lxstat (int vers, const char *name, struct stat *buf) -{ - if (vers == _STAT_VER_KERNEL) - { -#ifdef __NR_fstatat64 - int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, - AT_SYMLINK_NOFOLLOW); -#else - struct statx tmp; - int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, - AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW, - STATX_BASIC_STATS, &tmp); - if (rc == 0) - __cp_stat64_statx ((struct stat64 *)buf, &tmp); -#endif - return rc ?: stat_overflow (buf); - } - errno = EINVAL; - return -1; -} -hidden_def (__lxstat) -#endif diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c deleted file mode 100644 index 3eab0a1847..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 - . */ - -/* Hide the prototype for __lxstat so that GCC will not complain about - the different function signature if it is aliased to __lxstat64. - If XSTAT_IS_XSTAT64 is set to non-zero then the stat and stat64 - structures have an identical layout but different type names. */ - -#define __lxstat __lxstat_disable - -#include -#include -#include -#include -#include - -#include -#include - -#include - -/* Get information about the file NAME in BUF. */ -int -__lxstat64 (int vers, const char *name, struct stat64 *buf) -{ - if (vers == _STAT_VER_KERNEL) - { -#ifdef __NR_fstatat64 - return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, - AT_SYMLINK_NOFOLLOW); -#else - struct statx tmp; - int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, - AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW, - STATX_BASIC_STATS, &tmp); - if (rc == 0) - __cp_stat64_statx (buf, &tmp); - return rc; -#endif - } - - errno = EINVAL; - return -1; -} -hidden_def (__lxstat64) - -#undef __lxstat -#if XSTAT_IS_XSTAT64 -strong_alias (__lxstat64, __lxstat) -hidden_ver (__lxstat64, __lxstat) -#endif diff --git a/sysdeps/unix/sysv/linux/hppa/lxstat.c b/sysdeps/unix/sysv/linux/hppa/lxstat.c deleted file mode 100644 index 0efa0aea49..0000000000 --- a/sysdeps/unix/sysv/linux/hppa/lxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.c b/sysdeps/unix/sysv/linux/i386/lxstat.c deleted file mode 100644 index e960077893..0000000000 --- a/sysdeps/unix/sysv/linux/i386/lxstat.c +++ /dev/null @@ -1,60 +0,0 @@ -/* lxstat using old-style Unix lstat system call. - Copyright (C) 1991-2020 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 - . */ - -/* Ho hum, if xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __lxstat64 __lxstat64_disable - -#include -#include -#include -#include - -#include -#include - -#include - - -/* Get information about the file NAME in BUF. */ -int -__lxstat (int vers, const char *name, struct stat *buf) -{ - int result; - - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (lstat, 2, name, buf); - - { - struct stat64 buf64; - - result = INTERNAL_SYSCALL_CALL (lstat64, name, &buf64); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); - else - return __xstat32_conv (vers, &buf64, buf); - } -} - -hidden_def (__lxstat) -weak_alias (__lxstat, _lxstat); -#if XSTAT_IS_XSTAT64 -#undef __lxstat64 -strong_alias (__lxstat, __lxstat64); -hidden_ver (__lxstat, __lxstat64) -#endif diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c index dcd685873d..dc63d20061 100644 --- a/sysdeps/unix/sysv/linux/lxstat.c +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -1,4 +1,4 @@ -/* lxstat using old-style Unix lstat system call. +/* lxstat using old-style Unix stat system call. Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,45 +16,47 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, if xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __lxstat64 __lxstat64_disable - -#include -#include #include +#include #include - #include -#include -#include +#if !XSTAT_IS_XSTAT64 +# include +# include /* Get information about the file NAME in BUF. */ int __lxstat (int vers, const char *name, struct stat *buf) { - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (lstat, 2, name, buf); - -#if STAT_IS_KERNEL_STAT - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); -#else - struct kernel_stat kbuf; - int result; - - result = INLINE_SYSCALL (lstat, 2, name, &kbuf); - if (result == 0) - result = __xstat_conv (vers, &kbuf, buf); - - return result; + switch (vers) + { + case _STAT_VER_KERNEL: + { +# if STAT_IS_KERNEL_STAT + /* New kABIs which uses generic pre 64-bit time Linux ABI, + e.g. csky, nios2 */ + int r = INLINE_SYSCALL_CALL (fstatat64, AT_FDCWD, name, buf, + AT_SYMLINK_NOFOLLOW); + return r ?: stat_overflow (buf); +# else + /* Old kABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, + microblaze, s390, sh, powerpc, and sparc. */ + return INLINE_SYSCALL_CALL (lstat, name, buf); +# endif + } + + default: + { +# if STAT_IS_KERNEL_STAT + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); +# else + struct stat64 buf64; + int r = INTERNAL_SYSCALL_CALL (lstat64, name, &buf64); + return r ?: __xstat32_conv (vers, &buf64, buf); #endif + } + } } - hidden_def (__lxstat) -weak_alias (__lxstat, _lxstat); -#if XSTAT_IS_XSTAT64 -#undef __lxstat64 -strong_alias (__lxstat, __lxstat64); -hidden_ver (__lxstat, __lxstat64) -#endif +#endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c index 0ea8399d68..375013e9b1 100644 --- a/sysdeps/unix/sysv/linux/lxstat64.c +++ b/sysdeps/unix/sysv/linux/lxstat64.c @@ -1,5 +1,5 @@ /* lxstat64 using Linux lstat64 system call. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2020 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 @@ -16,23 +16,65 @@ License along with the GNU C Library; if not, see . */ -#include -#include +#define __lxstat __redirect___lxstat #include +#undef __lxstat +#include #include - #include -#include +#include +#include /* Get information about the file NAME in BUF. */ + int ___lxstat64 (int vers, const char *name, struct stat64 *buf) { - int result; - result = INLINE_SYSCALL (lstat64, 2, name, buf); - return result; +#if XSTAT_IS_XSTAT64 +# if defined __NR_lstat + /* Old 64-bit kABI, e.g. ia64, powerpc64*, s390x, sparc64, x86_64. */ + if (vers == _STAT_VER_KERNEL || vers == _STAT_VER_LINUX) + return INLINE_SYSCALL_CALL (lstat, name, buf); +# elif defined __NR_newfstatat + /* New kABIs which uses generic 64-bit Linux ABI, e.g. aarch64, riscv64. */ + if (vers == _STAT_VER_KERNEL) + return INLINE_SYSCALL_CALL (newfstatat, AT_FDCWD, name, buf, + AT_SYMLINK_NOFOLLOW); +# else + /* New 32-bit kABIs with only 64-bit time_t support, e.g. arc, riscv32. */ + if (vers == _STAT_VER_KERNEL) + { + struct statx tmp; + int r = INLINE_SYSCALL_CALL (statx, AT_FDCWD, name, + AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW, + STATX_BASIC_STATS, &tmp); + if (r == 0) + __cp_stat64_statx (buf, &tmp); + return r; + } +# endif +#else +# if STAT_IS_KERNEL_STAT + /* New kABIs which uses generic pre 64-bit time Linux ABI, + e.g. csky, nios2 */ + if (vers == _STAT_VER_KERNEL) + return INLINE_SYSCALL_CALL (fstatat64, AT_FDCWD, name, buf, + AT_SYMLINK_NOFOLLOW); +# else + /* Old kABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, + microblaze, s390, sh, mips32, powerpc32, and sparc32. */ + return INLINE_SYSCALL_CALL (lstat64, name, buf); +# endif /* STAT_IS_KERNEL_STAT */ +#endif /* XSTAT_IS_XSTAT64 */ + + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } +#if XSTAT_IS_XSTAT64 +weak_alias (___lxstat64, __lxstat); +weak_alias (___lxstat64, __GI___lxstat); +#endif + #include #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) diff --git a/sysdeps/unix/sysv/linux/m68k/lxstat.c b/sysdeps/unix/sysv/linux/m68k/lxstat.c deleted file mode 100644 index 0efa0aea49..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/lxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/microblaze/lxstat.c b/sysdeps/unix/sysv/linux/microblaze/lxstat.c deleted file mode 100644 index 0efa0aea49..0000000000 --- a/sysdeps/unix/sysv/linux/microblaze/lxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/wordsize-64/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c similarity index 60% rename from sysdeps/unix/sysv/linux/wordsize-64/lxstat.c rename to sysdeps/unix/sysv/linux/mips/lxstat.c index 156fbe7c64..eb07549adf 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/lxstat.c +++ b/sysdeps/unix/sysv/linux/mips/lxstat.c @@ -1,4 +1,4 @@ -/* lxstat using old-style Unix lstat system call. +/* lxstat using old-style Unix stat system call. Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,30 +16,27 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, since xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __lxstat64 __lxstat64_disable - -#include -#include #include - +#include +#include #include -#include +#include -/* Get information about the file FD in BUF. */ +/* Get information about the file NAME in BUF. */ int __lxstat (int vers, const char *name, struct stat *buf) { - if (vers == _STAT_VER_KERNEL || vers == _STAT_VER_LINUX) - return INLINE_SYSCALL (lstat, 2, name, buf); - - __set_errno (EINVAL); - return -1; + switch (vers) + { + case _STAT_VER_KERNEL: + return INLINE_SYSCALL_CALL (lstat, name, buf); + + default: + { + struct kernel_stat kbuf; + int r = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf); + return r ?: __xstat_conv (vers, &kbuf, buf); + } + } } - hidden_def (__lxstat) -weak_alias (__lxstat, _lxstat); -#undef __lxstat64 -strong_alias (__lxstat, __lxstat64); -hidden_ver (__lxstat, __lxstat64) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c index 62d4fe70eb..28bac57e58 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c @@ -16,28 +16,18 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include #include - #include -#include - #include /* Get information about the file NAME in BUF. */ int __lxstat64 (int vers, const char *name, struct stat64 *buf) { - int result; struct kernel_stat kbuf; - - result = INLINE_SYSCALL (lstat, 2, name, &kbuf); - if (result == 0) - result = __xstat64_conv (vers, &kbuf, buf); - - return result; + int r = INLINE_SYSCALL_CALL (lstat, name, &kbuf); + return r ?: __xstat64_conv (vers, &kbuf, buf); } hidden_def (__lxstat64) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/lxstat.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/lxstat.c deleted file mode 100644 index 2371cd9719..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/lxstat.c +++ /dev/null @@ -1,2 +0,0 @@ -#include - diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c deleted file mode 100644 index 0efa0aea49..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sh/lxstat.c b/sysdeps/unix/sysv/linux/sh/lxstat.c deleted file mode 100644 index 2371cd9719..0000000000 --- a/sysdeps/unix/sysv/linux/sh/lxstat.c +++ /dev/null @@ -1,2 +0,0 @@ -#include - diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/lxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/lxstat.c deleted file mode 100644 index 2371cd9719..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/lxstat.c +++ /dev/null @@ -1,2 +0,0 @@ -#include - diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c deleted file mode 100644 index 7f1e98e433..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../i386/lxstat.c" diff --git a/sysdeps/unix/sysv/linux/wordsize-64/lxstat64.c b/sysdeps/unix/sysv/linux/wordsize-64/lxstat64.c deleted file mode 100644 index bb5dbd0fff..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/lxstat64.c +++ /dev/null @@ -1 +0,0 @@ -/* lxstat64 is in lxstat.c */ From patchwork Thu Jul 23 19:46:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40158 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E412C3861896; Thu, 23 Jul 2020 19:47:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E412C3861896 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533623; bh=HLRrePAe+l8ooqrXKYeXpjVFMzmeuMOSZdKPVqReWF8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gLjcAHAb4BvqOdAfFOHh89zhxo7D2FT+F+MG3ba0o3Fja1jYgH7iHOG1c35+tA3lD l/wfG0SxYZqAyBFHBAPCnaPTXmOFKxo6aN2t9HebDodOsq+wgk4Pbc2w6tpY/eo8Ab neUsr5AMXd306eAd7hjpW9Aj2V6CgYTIZ2biDwSQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by sourceware.org (Postfix) with ESMTPS id 42D7A3857002 for ; Thu, 23 Jul 2020 19:46:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 42D7A3857002 Received: by mail-qv1-xf44.google.com with SMTP id di5so3098862qvb.11 for ; Thu, 23 Jul 2020 12:46:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HLRrePAe+l8ooqrXKYeXpjVFMzmeuMOSZdKPVqReWF8=; b=VSqh2slEC+e07eBZRixHoxe3zgkIuk7wPpQAXQuORvzplciWCZAm6ujiq/dDeOiu4l p4vRrdAiPxiS5tm11gf5avutnMHaCBXjTZMjBVLy3Qd6DlrBpnz4inhO0rOZv6vpF3M3 Suvdo/JOf5WNEtHHzsZi02H9opDlefLpnkYo642f7Js/IovH31FyMgV0n7uad9mqavUp OGaj65x5SMc37f98PIPpomZkkhWSUzgevzBOusowVBFBFaVpyjGh8gzXtaErWkyjNVkm WeghwQSguCvNqA6Suf/gfik0zDjwYzuu4hUGqgzWcJyMsVnVbtn2rJeLw2SV8kna8DvS BJ2g== X-Gm-Message-State: AOAM53369/eFu69zMUAMHSGrgnIu4tYTyzlCLkgc/iKCCM8aPFhgjlzA Bn9SRrNxzIpDps/dYsKT7nutg8l35Mc= X-Google-Smtp-Source: ABdhPJy6brdRWiR4M78cMUX+TMDGs7I7x1ARRWCLTVQcnpoikn1ba+nXoiapGS/95hR60KG8dJAqJQ== X-Received: by 2002:a0c:a9db:: with SMTP id c27mr6445629qvb.204.1595533616922; Thu, 23 Jul 2020 12:46:56 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:56 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 05/16] linux: Consolidate fxstat{64} Date: Thu, 23 Jul 2020 16:46:30 -0300 Message-Id: <20200723194641.1949404-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The LFS support is implemented on fxstat64.c, instead of fxstat.c for 64-bit architectures. The fxstat.c implements the non-LFS and it is a no-op for !XSTAT_IS_XSTAT64. The generic non-LFS implementation handles two cases: 1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issuess __NR_fstat64 plus handle the overflow on st_ino, st_size, or st_blocks. It only handles _STAT_VER_KERNEL. 2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, s390, sh, powerpc, and sparc32). For _STAT_VER_KERNEL it issues __NR_fstat, otherwise it calls __NR_fstat64 and convert to non-LFS stat struct and handle possible overflows on st_ino, st_size, or st_blocks. Also non-LFS mips is an outlier and it has its own implementation since _STAT_VER_LINUX requires a different conversion function (it uses the kernel_stat as the sysissues argument since its exported ABI is different than the kernel one for both non-LFS and LFS implementation). The generic LFS implementation handles multiple cases: 1. XSTAT_IS_XSTAT64 being 1: 1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, sparc64, riscv64, and x86_64): it issuess __NR_fstat for _STAT_VER_KERNEL or _STAT_VER_LINUX. 1.2. New 32-bit kABIs with only 64-bit time_t support (arc and riscv32): it issuess __NR_statx and covert to struct stat64. 2. Old ABIs with XSTAT_IS_XSTAT64 being 0 (arm, csky, i386, hppa, m68k, microblaze, mips32, nios2, sh, powerpc32, and sparc32): it issues __NR_fstat64. Also, two special cases requires specific implementations: 1. alpha: it requires to handle _STAT_VER_KERNEL64 to issues __NR_fstat64 and use the kernel_stat with __NR_fstat otherwise. 2. mips64: as for non-LFS implementation its ABIs differ from glibc exported one, which requires an specific conversion function to handle the kernel_stat. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski --- .../sysv/linux/alpha/{fxstat.c => fxstat64.c} | 48 ++++++-------- sysdeps/unix/sysv/linux/arm/fxstat.c | 1 - sysdeps/unix/sysv/linux/fxstat.c | 62 +++++++++---------- sysdeps/unix/sysv/linux/fxstat64.c | 43 ++++++++----- .../sysv/linux/generic/wordsize-32/fxstat.c | 57 ----------------- .../sysv/linux/generic/wordsize-32/fxstat64.c | 36 ----------- sysdeps/unix/sysv/linux/hppa/fxstat.c | 1 - sysdeps/unix/sysv/linux/i386/fxstat.c | 59 ------------------ sysdeps/unix/sysv/linux/m68k/fxstat.c | 1 - sysdeps/unix/sysv/linux/microblaze/fxstat.c | 1 - .../sysv/linux/{wordsize-64 => mips}/fxstat.c | 37 +++++------ .../unix/sysv/linux/mips/mips64/fxstat64.c | 13 +--- .../sysv/linux/powerpc/powerpc32/fxstat.c | 1 - sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c | 1 - sysdeps/unix/sysv/linux/sh/fxstat.c | 1 - .../unix/sysv/linux/sparc/sparc32/fxstat.c | 1 - .../unix/sysv/linux/sparc/sparc64/fxstat.c | 1 - .../unix/sysv/linux/wordsize-64/fxstat64.c | 1 - 18 files changed, 97 insertions(+), 268 deletions(-) rename sysdeps/unix/sysv/linux/alpha/{fxstat.c => fxstat64.c} (53%) delete mode 100644 sysdeps/unix/sysv/linux/arm/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat64.c delete mode 100644 sysdeps/unix/sysv/linux/hppa/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/i386/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/microblaze/fxstat.c rename sysdeps/unix/sysv/linux/{wordsize-64 => mips}/fxstat.c (60%) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/sh/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/fxstat64.c diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat.c b/sysdeps/unix/sysv/linux/alpha/fxstat64.c similarity index 53% rename from sysdeps/unix/sysv/linux/alpha/fxstat.c rename to sysdeps/unix/sysv/linux/alpha/fxstat64.c index 0978610bf0..286a2f0a6c 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstat.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstat64.c @@ -1,4 +1,4 @@ -/* fxstat using old-style Unix stat system call. +/* fxstat64 using old-style Unix stat system call. Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,42 +16,32 @@ License along with the GNU C Library. If not, see . */ -#define __fxstat64 __fxstat64_disable - -#include -#include +#define __fxstat __redirect___fxstat64 #include +#undef __fxstat #include #include -#include #include -#undef __fxstat64 - - /* Get information about the file NAME in BUF. */ int -__fxstat (int vers, int fd, struct stat *buf) +__fxstat64 (int vers, int fd, struct stat64 *buf) { - int result; - struct kernel_stat kbuf; - - if (vers == _STAT_VER_KERNEL64) + switch (vers) { - result = INTERNAL_SYSCALL_CALL (fstat64, fd, buf); - if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) - return result; - __set_errno (INTERNAL_SYSCALL_ERRNO (result)); - return -1; + case _STAT_VER_KERNEL64: + return INLINE_SYSCALL_CALL (fstat64, fd, buf); + + default: + { + struct kernel_stat kbuf; + int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); + } } - - result = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); - if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) - return __xstat_conv (vers, &kbuf, buf); - __set_errno (INTERNAL_SYSCALL_ERRNO (result)); - return -1; } -hidden_def (__fxstat) -weak_alias (__fxstat, _fxstat); -strong_alias (__fxstat, __fxstat64); -hidden_ver (__fxstat, __fxstat64) +hidden_def (__fxstat64) +strong_alias (__fxstat64, __fxstat); +hidden_ver (__fxstat64, __fxstat) diff --git a/sysdeps/unix/sysv/linux/arm/fxstat.c b/sysdeps/unix/sysv/linux/arm/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/arm/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c index a88404b5c3..b46e344d0e 100644 --- a/sysdeps/unix/sysv/linux/fxstat.c +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -16,46 +16,46 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, if xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __fxstat64 __fxstat64_disable - -#include -#include -#include #include +#include #include - #include -#include -#include +#if !XSTAT_IS_XSTAT64 +# include +# include /* Get information about the file FD in BUF. */ int __fxstat (int vers, int fd, struct stat *buf) { - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (fstat, 2, fd, buf); - -#if STAT_IS_KERNEL_STAT - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); -#else - struct kernel_stat kbuf; - int result; - - result = INLINE_SYSCALL (fstat, 2, fd, &kbuf); - if (result == 0) - result = __xstat_conv (vers, &kbuf, buf); - - return result; + switch (vers) + { + case _STAT_VER_KERNEL: + { +# if STAT_IS_KERNEL_STAT + /* New kABIs which uses generic pre 64-bit time Linux ABI, + e.g. csky, nios2 */ + int r = INLINE_SYSCALL_CALL (fstat64, fd, buf); + return r ?: stat_overflow (buf); +# else + /* Old kABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, + microblaze, s390, sh, powerpc, and sparc. */ + return INLINE_SYSCALL_CALL (fstat, fd, buf); +# endif + } + + default: + { +# if STAT_IS_KERNEL_STAT + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); +# else + struct stat64 buf64; + int r = INLINE_SYSCALL_CALL (fstat64, fd, &buf64); + return r ?: __xstat32_conv (vers, &buf64, buf); #endif + } + } } - hidden_def (__fxstat) -weak_alias (__fxstat, _fxstat); -#if XSTAT_IS_XSTAT64 -#undef __fxstat64 -strong_alias (__fxstat, __fxstat64); -hidden_ver (__fxstat, __fxstat64) -#endif +#endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c index 9133a0a29b..d3834f1ce2 100644 --- a/sysdeps/unix/sysv/linux/fxstat64.c +++ b/sysdeps/unix/sysv/linux/fxstat64.c @@ -16,15 +16,13 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include +#define __fxstat __redirect___fxstat #include +#undef __fxstat +#include #include - #include -#include - +#include #include /* Get information about the file FD in BUF. */ @@ -32,17 +30,27 @@ int ___fxstat64 (int vers, int fd, struct stat64 *buf) { - int result; -#ifdef __NR_fstat64 - result = INLINE_SYSCALL (fstat64, 2, fd, buf); -#else +#if XSTAT_IS_XSTAT64 +# ifdef __NR_fstat + /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, sparc64, riscv64, + and x86_64. */ + if (vers == _STAT_VER_KERNEL || vers == _STAT_VER_LINUX) + return INLINE_SYSCALL_CALL (fstat, fd, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); +# else + /* New 32-bit kABIs with only 64-bit time_t support, e.g. arc, riscv32. */ struct statx tmp; - result = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS, - &tmp); - if (result == 0) + int r = INLINE_SYSCALL_CALL (statx, fd, "", AT_EMPTY_PATH, + STATX_BASIC_STATS, &tmp); + if (r == 0) __cp_stat64_statx (buf, &tmp); -#endif - return result; + return r; +# endif +#else + /* All kABIs with non-LFS support, e.g. arm, csky, i386, hppa, m68k, + microblaze, mips32, nios2, sh, powerpc32, and sparc32. */ + return INLINE_SYSCALL_CALL (fstat64, fd, buf); +#endif /* XSTAT_IS_XSTAT64 */ } #include @@ -56,3 +64,8 @@ hidden_ver (___fxstat64, __fxstat64) strong_alias (___fxstat64, __fxstat64) hidden_def (__fxstat64) #endif + +#if XSTAT_IS_XSTAT64 +strong_alias (__fxstat64, __fxstat); +hidden_ver (__fxstat64, __fxstat) +#endif diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c deleted file mode 100644 index 850450e1e8..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 -#include -#include - -#include -#include - -#if !XSTAT_IS_XSTAT64 -#include "overflow.h" -#include - -/* Get information about the file FD in BUF. */ -int -__fxstat (int vers, int fd, struct stat *buf) -{ - if (vers == _STAT_VER_KERNEL) - { -# ifdef __NR_fstat64 - int rc = INLINE_SYSCALL (fstat64, 2, fd, buf); -# else - struct statx tmp; - int rc = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH, - STATX_BASIC_STATS, &tmp); - if (rc == 0) - __cp_stat64_statx ((struct stat64 *)buf, &tmp); -# endif - return rc ?: stat_overflow (buf); - } - - errno = EINVAL; - return -1; -} - -hidden_def (__fxstat) -weak_alias (__fxstat, _fxstat); -#endif diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat64.c deleted file mode 100644 index b4a2a5b417..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat64.c +++ /dev/null @@ -1,36 +0,0 @@ -/* __fxstat64 () implementation. - Copyright (C) 2016-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 - . */ - -/* Hide the prototypes for __fxstat and _fxstat so that GCC will not - complain about the different function signatures if they are aliased - to __fxstat64. If XSTAT_IS_XSTAT64 is set to non-zero then the stat and - stat64 structures have an identical layout but different type names. */ - -#define __fxstat __fxstat_disable -#define _fxstat _fxstat_disable - -#include - -#undef __fxstat -#undef _fxstat -#if XSTAT_IS_XSTAT64 -weak_alias (__fxstat64, __fxstat) -weak_alias (__fxstat64, _fxstat) -hidden_ver (__fxstat64, __fxstat) -#endif diff --git a/sysdeps/unix/sysv/linux/hppa/fxstat.c b/sysdeps/unix/sysv/linux/hppa/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/hppa/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.c b/sysdeps/unix/sysv/linux/i386/fxstat.c deleted file mode 100644 index db59baa71b..0000000000 --- a/sysdeps/unix/sysv/linux/i386/fxstat.c +++ /dev/null @@ -1,59 +0,0 @@ -/* fxstat using old-style Unix fstat system call. - Copyright (C) 1991-2020 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 - . */ - -/* Ho hum, if xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __fxstat64 __fxstat64_disable - -#include -#include -#include -#include - -#include -#include - -#include - -/* Get information about the file FD in BUF. */ -int -__fxstat (int vers, int fd, struct stat *buf) -{ - int result; - - if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL (fstat, 2, fd, buf); - - { - struct stat64 buf64; - - result = INTERNAL_SYSCALL_CALL (fstat64, fd, &buf64); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); - else - return __xstat32_conv (vers, &buf64, buf); - } -} - -hidden_def (__fxstat) -weak_alias (__fxstat, _fxstat); -#if XSTAT_IS_XSTAT64 -#undef __fxstat64 -strong_alias (__fxstat, __fxstat64); -hidden_ver (__fxstat, __fxstat64) -#endif diff --git a/sysdeps/unix/sysv/linux/m68k/fxstat.c b/sysdeps/unix/sysv/linux/m68k/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/microblaze/fxstat.c b/sysdeps/unix/sysv/linux/microblaze/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/microblaze/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c similarity index 60% rename from sysdeps/unix/sysv/linux/wordsize-64/fxstat.c rename to sysdeps/unix/sysv/linux/mips/fxstat.c index 24bfe847d7..16c3cefee2 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/fxstat.c +++ b/sysdeps/unix/sysv/linux/mips/fxstat.c @@ -1,4 +1,4 @@ -/* fxstat using old-style Unix fstat system call. +/* fxstat using old-style Unix stat system call. Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,30 +16,27 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, since xstat == xstat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __fxstat64 __fxstat64_disable - -#include -#include #include - +#include +#include #include -#include +#include -/* Get information about the file FD in BUF. */ +/* Get information about the file NAME in BUF. */ int __fxstat (int vers, int fd, struct stat *buf) { - if (vers == _STAT_VER_KERNEL || vers == _STAT_VER_LINUX) - return INLINE_SYSCALL (fstat, 2, fd, buf); - - __set_errno (EINVAL); - return -1; + switch (vers) + { + case _STAT_VER_KERNEL: + return INLINE_SYSCALL_CALL (fstat, fd, buf); + + default: + { + struct kernel_stat kbuf; + int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); + return r ?: __xstat_conv (vers, &kbuf, buf); + } + } } - hidden_def (__fxstat) -weak_alias (__fxstat, _fxstat); -#undef __fxstat64 -strong_alias (__fxstat, __fxstat64); -hidden_ver (__fxstat, __fxstat64) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c index 8dd3d92eb1..3fcdd9f1ee 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c @@ -16,14 +16,9 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include #include - #include -#include - #include /* Get information about the file FD in BUF. */ @@ -31,14 +26,10 @@ int __fxstat64 (int vers, int fd, struct stat64 *buf) { - int result; struct kernel_stat kbuf; + int r = INLINE_SYSCALL_CALL (fstat, fd, &kbuf); + return r ?: __xstat64_conv (vers, &kbuf, buf); - result = INLINE_SYSCALL (fstat, 2, fd, &kbuf); - if (result == 0) - result = __xstat64_conv (vers, &kbuf, buf); - - return result; } hidden_def (__fxstat64) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstat.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sh/fxstat.c b/sysdeps/unix/sysv/linux/sh/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/sh/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fxstat.c deleted file mode 100644 index 4f219f0b9d..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c deleted file mode 100644 index e328ccbab0..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../i386/fxstat.c" diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstat64.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstat64.c deleted file mode 100644 index 9eff9ebeb7..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/fxstat64.c +++ /dev/null @@ -1 +0,0 @@ -/* fxstat64 is in fxstat.c */ From patchwork Thu Jul 23 19:46:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40160 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC0833861977; Thu, 23 Jul 2020 19:47:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC0833861977 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533625; bh=iG5YVL8W3E5APT9BWgwI42YJzXaqMt0g/WHKj9WfKaE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=oEkdK1tTZ8vI/wC91/2KiZ2FJcXs2QyFDqa0kFAqdMme6VT3thS7+yBAMC2/qdjEN VlJdkysFP81MslOCsF8te1KEeL9jemrj5Yipx3CSkD3JZuNxdsGw0/XtlX+eKE4Gt2 ZsctjgHoRQ39hhjr5PYtfC7SWaUL38wfG+yJqxPg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by sourceware.org (Postfix) with ESMTPS id 058E53861867 for ; Thu, 23 Jul 2020 19:47:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 058E53861867 Received: by mail-qk1-x743.google.com with SMTP id h7so6548936qkk.7 for ; Thu, 23 Jul 2020 12:47:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iG5YVL8W3E5APT9BWgwI42YJzXaqMt0g/WHKj9WfKaE=; b=SMPtzJ238HsNEXveeQXiUoksXjcCtZ49BJS9qwRAd+RZ0svuy2ZN7rSHkdxzg2d1jp abKHFI6a/ye47o3WtVblyJ8f6D4FPGaYF/hY6ziTN9is/6BWe9CQJ2twZpGuEa+0jW6o O7KL/PHQcZjx6D2EOmRrwYsc6wt7sQuOz/5e8TjGaLVzA+gpNIcZA3WzffSAhpkeyj47 JL/gygL55JLLJDaF82H395X31Cmd0UE1T87fXxEXAh4GPiAzvEDOv6clSEVOEMQINJlT A7Vg2zz3FJib3s7XvWpn66VuaVRI8JqKZq8g5k8XEj4gk6C/rLvJhLgncst6ivk3YQeG xb/w== X-Gm-Message-State: AOAM533JwbfITELSt3KPzx9vEmCWR5dRXd32B82YLQt+1DlLqgxfiBy3 uJhYt+xr80jXzQLejjDCGsHWoO+4hPk= X-Google-Smtp-Source: ABdhPJx4tTrs9PDpwvWfCoWh8zuQ9IT07uYFgth3StiB9cSZaZHGzz4H/DQdB1HMb2a3xdulBQER1w== X-Received: by 2002:a37:8d0:: with SMTP id 199mr6651437qki.335.1595533618551; Thu, 23 Jul 2020 12:46:58 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:58 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 06/16] linux: Consolidate fxstatat{64} Date: Thu, 23 Jul 2020 16:46:31 -0300 Message-Id: <20200723194641.1949404-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The LFS support is implemented on fxstat64.c, instead of fxstat.c for 64-bit architectures. The fxstatat.c implements the non-LFS and it is a no-op for !XSTAT_IS_XSTAT64. The generic non-LFS implementation handles two cases: 1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issues __NR_fstatat64 plus handle the overflow on st_ino, st_size, or st_blocks. It only handles _STAT_VER_KERNEL. 2. Old kABIs with old non-LFS support (arm, i386, hppa, m68k, mips32, microblaze, s390, sh, powerpc, and sparc32). it issues __NR_fstatat64 and convert to non-LFS stat struct based on the version. Also non-LFS mips64 is an outlier and it has its own implementation since _STAT_VER_LINUX requires a different conversion function (it uses the kernel_stat as the sysissues argument since its exported ABI is different than the kernel one for both non-LFS and LFS implementation). The generic LFS implementation handles multiple cases: 1. XSTAT_IS_XSTAT64 being 1: 1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and x86_64): it issues __NR_newfstatat for _STAT_VER_KERNEL or _STAT_VER_LINUX. 1.2. 64-bit kABI outlier (sparc64): it issuess fstatat64 with a temporary stat64 and convert to output stat64 based on the input version (and using a sparc64 specific __xstat32_conv). 1.3. New 32-bit kABIs with only 64-bit time_t support (arc and riscv32): it issues __NR_statx and covert to struct stat64. 2. Old ABIs with XSTAT_IS_XSTAT64 being 0 (arm, csky, i386, hppa, m68k, microblaze, mips32, nios2, sh, powerpc32, and sparc32): it issues __NR_fstat64. Also, two special cases requires specific implementations: 1. alpha: it uses the __NR_fstatat64 syscall instead. 2. mips64: as for non-LFS implementation its ABIs differ from glibc exported one, which requires an specific conversion function to handle the kernel_stat. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/Makefile | 3 +- sysdeps/unix/sysv/linux/alpha/dl-fxstatat64.c | 1 - sysdeps/unix/sysv/linux/alpha/fxstatat.c | 52 --------------- .../wordsize-32 => alpha}/fxstatat64.c | 35 +++++----- sysdeps/unix/sysv/linux/arm/fxstatat.c | 1 - sysdeps/unix/sysv/linux/fxstatat.c | 53 ++++++--------- sysdeps/unix/sysv/linux/fxstatat64.c | 65 +++++++++++-------- .../sysv/linux/generic/wordsize-32/fxstatat.c | 56 ---------------- sysdeps/unix/sysv/linux/hppa/fxstatat.c | 1 - sysdeps/unix/sysv/linux/i386/fxstatat.c | 54 --------------- sysdeps/unix/sysv/linux/m68k/fxstatat.c | 1 - sysdeps/unix/sysv/linux/microblaze/fxstatat.c | 1 - .../unix/sysv/linux/mips/mips32/fxstatat.c | 1 - .../{wordsize-64 => mips/mips64}/fxstatat.c | 33 +++------- .../unix/sysv/linux/mips/mips64/fxstatat64.c | 28 ++------ .../sysv/linux/powerpc/powerpc32/fxstatat.c | 1 - .../unix/sysv/linux/s390/s390-32/fxstatat.c | 1 - sysdeps/unix/sysv/linux/sh/fxstatat.c | 1 - .../unix/sysv/linux/sparc/sparc32/fxstatat.c | 1 - .../sysv/linux/sparc/sparc64/dl-fxstatat64.c | 1 - .../unix/sysv/linux/sparc/sparc64/fxstatat.c | 1 - .../sysv/linux/wordsize-64/dl-fxstatat64.c | 1 - .../unix/sysv/linux/wordsize-64/fxstatat64.c | 1 - 23 files changed, 92 insertions(+), 301 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/dl-fxstatat64.c delete mode 100644 sysdeps/unix/sysv/linux/alpha/fxstatat.c rename sysdeps/unix/sysv/linux/{generic/wordsize-32 => alpha}/fxstatat64.c (53%) delete mode 100644 sysdeps/unix/sysv/linux/arm/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/hppa/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/i386/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/microblaze/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c rename sysdeps/unix/sysv/linux/{wordsize-64 => mips/mips64}/fxstatat.c (56%) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/sh/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/dl-fxstatat64.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/dl-fxstatat64.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 9b2a253032..3c28adae0d 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -280,8 +280,7 @@ tests += tst-fallocate tst-fallocate64 tst-o_path-locks endif ifeq ($(subdir),elf) -sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir \ - dl-fxstatat64 +sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir libof-lddlibc4 = lddlibc4 diff --git a/sysdeps/unix/sysv/linux/alpha/dl-fxstatat64.c b/sysdeps/unix/sysv/linux/alpha/dl-fxstatat64.c deleted file mode 100644 index 330b33f7c7..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/dl-fxstatat64.c +++ /dev/null @@ -1 +0,0 @@ -#include "fxstatat.c" diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c deleted file mode 100644 index c5953d250a..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/fxstatat.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2005-2020 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 - . */ - -#define __fxstatat64 __fxstatat64_disable - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef __fxstatat64 - -/* Get information about the file NAME in BUF. */ -int -__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) -{ - int result, errno_out; - - /* ??? The __fxstatat entry point is new enough that it must be using - vers == _STAT_VER_KERNEL64. For the benefit of dl-fxstatat64.c, we - cannot actually check this, lest the compiler not optimize the rest - of the function away. */ - - result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag); - if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) - return result; - errno_out = INTERNAL_SYSCALL_ERRNO (result); - __set_errno (errno_out); - return -1; -} -libc_hidden_def (__fxstatat) -strong_alias (__fxstatat, __fxstatat64); -libc_hidden_ver(__fxstatat, __fxstatat64); diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat64.c b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c similarity index 53% rename from sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat64.c rename to sysdeps/unix/sysv/linux/alpha/fxstatat64.c index 894f6dd396..f10c1d31e8 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c @@ -1,7 +1,6 @@ -/* __fxstatat64 () implementation. - Copyright (C) 2016-2020 Free Software Foundation, Inc. +/* fxstat using old-style Unix stat system call. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,21 +16,21 @@ License along with the GNU C Library. If not, see . */ -/* Hide the prototype for __fxstatat so that GCC will not complain about - the different function signature if it is aliased to __fxstatat64. - If XSTAT_IS_XSTAT64 is set to non-zero then the stat and stat64 structures - have an identical layout but different type names. */ - -#define __fxstatat __fxstatat_disable - +#define __fxstatat __redirect___fxstatat64 #include -#undef _STAT_VER_LINUX -#define _STAT_VER_LINUX _STAT_VER_KERNEL - -#include - #undef __fxstatat -#if XSTAT_IS_XSTAT64 -weak_alias (__fxstatat64, __fxstatat) -libc_hidden_ver (__fxstatat64, __fxstatat) +#include +#include +#include + +/* Get information about the file NAME in BUF. */ +int +__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) +{ + return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); +} +libc_hidden_def (__fxstatat64) +#if IS_IN(libc) +strong_alias (__fxstatat64, __fxstatat); +hidden_ver (__fxstatat64, __fxstatat) #endif diff --git a/sysdeps/unix/sysv/linux/arm/fxstatat.c b/sysdeps/unix/sysv/linux/arm/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/arm/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c index 937fec45c2..0291a2c598 100644 --- a/sysdeps/unix/sysv/linux/fxstatat.c +++ b/sysdeps/unix/sysv/linux/fxstatat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* fxstatat used on fstatat, Linux implementation. + Copyright (C) 2005-2020 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 @@ -15,48 +16,36 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __fxstatat64 __fxstatat64_disable - -#include -#include -#include -#include -#include #include +#include #include - #include -#include -#include +#if !XSTAT_IS_XSTAT64 +# include +# include -/* Get information about the file NAME in BUF. */ +/* Get information about the file FD in BUF. */ int __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { - int result; #if STAT_IS_KERNEL_STAT -# define kst (*st) -#else - struct kernel_stat kst; -#endif - - result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); - if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result))) + /* New kABIs which uses generic pre 64-bit time Linux ABI, e.g. + csky, nios2 */ + if (vers == _STAT_VER_KERNEL) { -#if STAT_IS_KERNEL_STAT - return 0; + int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); + return r ?: stat_overflow (st); + } + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); #else - return __xstat_conv (vers, &kst, st); + /* Old kABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, mips32, + microblaze, s390, sh, powerpc32, and sparc32. */ + struct stat64 st64; + int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); + return r ?: __xstat32_conv (vers, &st64, st); #endif - } - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); } libc_hidden_def (__fxstatat) -#if XSTAT_IS_XSTAT64 -# undef __fxstatat64 -strong_alias (__fxstatat, __fxstatat64); -libc_hidden_def (__fxstatat64) -#endif + +#endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c index e24b456604..ac33ab4fc9 100644 --- a/sysdeps/unix/sysv/linux/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/fxstatat64.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* fxstatat64 used on fstatat64, Linux implementation. + Copyright (C) 2005-2020 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 @@ -15,41 +16,53 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include -#include -#include +#define __fxstatat __redirect___fxstatat #include +#undef __fxstatat +#include #include - #include -#include - +#include #include -/* Get information about the file NAME in BUF. */ +/* Get information about the file FD in BUF. */ int __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) { - if (__glibc_unlikely (vers != _STAT_VER_LINUX)) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - - int result; - -#ifdef __NR_fstatat64 - result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag); +#if XSTAT_IS_XSTAT64 +# ifdef __NR_newfstatat + /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and + x86_64. */ + if (vers == _STAT_VER_KERNEL || vers == _STAT_VER_LINUX) + return INLINE_SYSCALL_CALL (newfstatat, fd, file, st, flag); +# elif defined __NR_fstatat64 + /* 64-bit kABI outlier, e.g. sparc64. */ + struct stat64 st64; + int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); + return r ?: __xstat32_conv (vers, &st64, (struct stat *) st); +# else + /* New 32-bit kABIs with only 64-bit time_t support, e.g. arc, riscv32. */ + if (vers == _STAT_VER_KERNEL) + { + struct statx tmp; + int r = INLINE_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, + STATX_BASIC_STATS, &tmp); + if (r == 0) + __cp_stat64_statx (st, &tmp); + return r; + } +# endif #else - struct statx tmp; - - result = INTERNAL_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, - STATX_BASIC_STATS, &tmp); - if (result == 0) - __cp_stat64_statx (st, &tmp); + /* All kABIs with non-LFS support, e.g. arm, csky, i386, hppa, m68k, + microblaze, mips32, nios2, sh, powerpc32, and sparc32. */ + if (vers == _STAT_VER_LINUX) + return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); #endif - if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result))) - return 0; - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } libc_hidden_def (__fxstatat64) +#if XSTAT_IS_XSTAT64 && IS_IN(libc) +strong_alias (__fxstatat64, __fxstatat); +hidden_ver (__fxstatat64, __fxstatat) +#endif diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c deleted file mode 100644 index 8df65ebea0..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 -#include -#include - -#include -#include - -#if !XSTAT_IS_XSTAT64 -#include "overflow.h" -#include - -/* Get information about the file NAME in BUF. */ -int -__fxstatat (int vers, int fd, const char *file, struct stat *buf, int flag) -{ - if (vers == _STAT_VER_KERNEL) - { -# ifdef __NR_fstatat64 - int rc = INLINE_SYSCALL (fstatat64, 4, fd, file, buf, flag); -# else - struct statx tmp; - int rc = INLINE_SYSCALL (statx, 5, fd, file, - AT_NO_AUTOMOUNT | flag, - STATX_BASIC_STATS, &tmp); - if (rc == 0) - __cp_stat64_statx ((struct stat64 *)buf, &tmp); -# endif - return rc ?: stat_overflow (buf); - } - - errno = EINVAL; - return -1; -} -libc_hidden_def (__fxstatat) -#endif diff --git a/sysdeps/unix/sysv/linux/hppa/fxstatat.c b/sysdeps/unix/sysv/linux/hppa/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/hppa/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c deleted file mode 100644 index f720f6e429..0000000000 --- a/sysdeps/unix/sysv/linux/i386/fxstatat.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2005-2020 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 - . */ - -/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc - will complain since they don't strictly match. */ -#define __fxstatat64 __fxstatat64_disable - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - - -/* Get information about the file NAME relative to FD in ST. */ -int -__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) -{ - int result; - struct stat64 st64; - - result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); - else - return __xstat32_conv (vers, &st64, st); -} -libc_hidden_def (__fxstatat) -#if XSTAT_IS_XSTAT64 -# undef __fxstatat64 -strong_alias (__fxstatat, __fxstatat64); -libc_hidden_ver (__fxstatat, __fxstatat64) -#endif diff --git a/sysdeps/unix/sysv/linux/m68k/fxstatat.c b/sysdeps/unix/sysv/linux/m68k/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/microblaze/fxstatat.c b/sysdeps/unix/sysv/linux/microblaze/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/microblaze/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c b/sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c similarity index 56% rename from sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c rename to sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c index b8f5ab562e..58410a1441 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* fxstat using old-style Unix fstat system call. + Copyright (C) 1991-2020 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 @@ -15,34 +16,18 @@ License along with the GNU C Library; if not, see . */ -/* Ho hum, since fxstatat == fxstatat64 we must get rid of the - prototype or gcc will complain since they don't strictly match. */ -#define __fxstatat64 __fxstatat64_disable - -#include -#include -#include -#include -#include #include - +#include +#include #include -#include - +#include -/* Get information about the file NAME relative to FD in ST. */ +/* Get information about the file FD in BUF. */ int __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { - if (vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (newfstatat, 4, fd, file, st, flag); + struct kernel_stat kst; + int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + return r ?: __xstat_conv (vers, &kst, st); } libc_hidden_def (__fxstatat) -#undef __fxstatat64 -strong_alias (__fxstatat, __fxstatat64); -strong_alias (__fxstatat64, __GI___fxstatat64) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c index 62df5fb26c..e5416d8971 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c @@ -15,17 +15,9 @@ License along with the GNU C Library. If not, see . */ -#include -#include -#include -#include -#include #include #include - #include -#include - #include /* Get information about the file NAME in BUF. */ @@ -33,22 +25,12 @@ int __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) { - if (__builtin_expect (vers != _STAT_VER_LINUX, 0)) - { - __set_errno (EINVAL); - return -1; - } - - int result; - struct kernel_stat kst; - - result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); - if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result))) - return __xstat64_conv (vers, &kst, st); - else + if (vers == _STAT_VER_LINUX) { - __set_errno (INTERNAL_SYSCALL_ERRNO (result)); - return -1; + struct kernel_stat kst; + int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);; + return r ?: __xstat64_conv (vers, &kst, st); } + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } libc_hidden_def (__fxstatat64) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sh/fxstatat.c b/sysdeps/unix/sysv/linux/sh/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/sh/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-fxstatat64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-fxstatat64.c deleted file mode 100644 index 330b33f7c7..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-fxstatat64.c +++ /dev/null @@ -1 +0,0 @@ -#include "fxstatat.c" diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c deleted file mode 100644 index db08af8e0f..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../i386/fxstatat.c" diff --git a/sysdeps/unix/sysv/linux/wordsize-64/dl-fxstatat64.c b/sysdeps/unix/sysv/linux/wordsize-64/dl-fxstatat64.c deleted file mode 100644 index 330b33f7c7..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/dl-fxstatat64.c +++ /dev/null @@ -1 +0,0 @@ -#include "fxstatat.c" diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c deleted file mode 100644 index 05e7f413bb..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c +++ /dev/null @@ -1 +0,0 @@ -/* fxstatat64 is in fxstatat.c */ From patchwork Thu Jul 23 19:46:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40159 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6FA1A385043F; Thu, 23 Jul 2020 19:47:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FA1A385043F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533624; bh=NCnTvp8YBYPQGaZGH4OESIHuarayvFxWJ8NdWMP7JH4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=oiDFb3gtD24g2wHnElTO3QEmHBdbezJMcwnF7jjOj7MCsXMGQ2Wu+/45GUnfYq9kh J+KFxQ+Jb0OKvWQ7uS7favThstkX6ueyZGzzhiV7wrmWkWL79MWPf2ItO5PN5kOf3P tSKHgwuX7gCAivhVvJqzqW5Qip+PDS7yIETHOe2A= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by sourceware.org (Postfix) with ESMTPS id D95AF38618AD for ; Thu, 23 Jul 2020 19:47:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D95AF38618AD Received: by mail-qk1-x744.google.com with SMTP id l6so6556525qkc.6 for ; Thu, 23 Jul 2020 12:47:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NCnTvp8YBYPQGaZGH4OESIHuarayvFxWJ8NdWMP7JH4=; b=c1cYqsHR90KmdU2auUrwclqOdb1CrhrkiAxuFMiVm3+MlfE98vVr5pkEcyqbSrc/3N S9bmIQeVJ2qt1ZvByKWfEGARJfEZZ2d5i4yfPgSenZ8C7s6uo+j8KkYmX7AmJm7EoUdv RVcb43BHICfjjPYaopwOkV1hnauG0cBBvx29llc9JQXV+tsQ/wVIoaFizXNinR7t6QXY EPmzc6F5Y1XtqJyhoCWodAMWaAuvDVyuH+YLOPmfDOfSeft38Isdnc0pF0o48/eU1u2m 6vj63LK9eNltTvSPNlwqAMvzkxXSytPBryXeNlfEczv4iSErkNkLSRYq7+jtJk/IV8Q8 no+Q== X-Gm-Message-State: AOAM530v0iBZ/kwE0l9f4AJj3icLafu7CZH6RZDpWwA2a4rsWLCQV3c+ JVQiCNMiepPVAEFQ7/Dmt4iozsc5dEk= X-Google-Smtp-Source: ABdhPJwDr+mgP3gH68h/xDwUnnOXJ1GlT0HHOwwsZd5nf66+mdJ8AS3ORTDQZovZkKkTFvEGxtWNSA== X-Received: by 2002:a05:620a:16af:: with SMTP id s15mr6360102qkj.304.1595533620191; Thu, 23 Jul 2020 12:47:00 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:46:59 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 07/16] Linux: Consolidate xmknod Date: Thu, 23 Jul 2020 16:46:32 -0300 Message-Id: <20200723194641.1949404-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The __NR_mknodat syscall is supported on all kernels, so the generic implementation is used as default. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/generic/xmknod.c | 54 ------------------------ sysdeps/unix/sysv/linux/xmknod.c | 8 ++-- 2 files changed, 3 insertions(+), 59 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/generic/xmknod.c diff --git a/sysdeps/unix/sysv/linux/generic/xmknod.c b/sysdeps/unix/sysv/linux/generic/xmknod.c deleted file mode 100644 index a51fcbee22..0000000000 --- a/sysdeps/unix/sysv/linux/generic/xmknod.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 -#include - -#include -#include - -/* Create a device file named PATH, with permission and special bits MODE - and device number DEV (which can be constructed from major and minor - device numbers with the `makedev' macro above). */ -int -__xmknod (int vers, const char *path, mode_t mode, dev_t *dev) -{ - unsigned long long int k_dev; - - if (vers != _MKNOD_VER) - { - __set_errno (EINVAL); - return -1; - } - - /* We must convert the value to dev_t type used by the kernel. */ - k_dev = (*dev) & ((1ULL << 32) - 1); - if (k_dev != *dev) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (mknodat, 4, AT_FDCWD, path, mode, - (unsigned int) k_dev); -} -weak_alias (__xmknod, _xmknod) -libc_hidden_def (__xmknod) diff --git a/sysdeps/unix/sysv/linux/xmknod.c b/sysdeps/unix/sysv/linux/xmknod.c index 5d0ae97c34..42809d4c57 100644 --- a/sysdeps/unix/sysv/linux/xmknod.c +++ b/sysdeps/unix/sysv/linux/xmknod.c @@ -16,13 +16,10 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include #include - +#include #include -#include /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor @@ -40,7 +37,8 @@ __xmknod (int vers, const char *path, mode_t mode, dev_t *dev) if (k_dev != *dev) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - return INLINE_SYSCALL (mknod, 3, path, mode, (unsigned int) k_dev); + return INLINE_SYSCALL_CALL (mknodat, AT_FDCWD, path, mode, + (unsigned int) k_dev); } weak_alias (__xmknod, _xmknod) From patchwork Thu Jul 23 19:46:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40161 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8922E3861925; Thu, 23 Jul 2020 19:47:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8922E3861925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533628; bh=Z8SsZuM6S2M7v8JoLIx5R8T5AuRUEQmuvHKYYxwB9p4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=e5o5LGZbxof1pPdwBK0nDdTzccwRLMo5hR0ZFTZitPBA97bbWFZ5PuUSsbxWtiWUc ThcLDdiETMd7i6/ffDHgvA/tnpcqtG8hVR+ouccXBfDT5kuGYkRrQ8qR9jL/Zd1r4q vUQI6B0tp444Dmsc+zrqnCF0VW4V2FEjpgcl7pY8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by sourceware.org (Postfix) with ESMTPS id 97ED73861925 for ; Thu, 23 Jul 2020 19:47:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 97ED73861925 Received: by mail-qv1-xf42.google.com with SMTP id y11so169660qvl.4 for ; Thu, 23 Jul 2020 12:47:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z8SsZuM6S2M7v8JoLIx5R8T5AuRUEQmuvHKYYxwB9p4=; b=JtzzQao2KcR2Jw6dtHZsH02prsyERxvBQYXrZg7YoTzUW0f/dNZeHraMuKkSfXmI1K 40O4bOggtUneHNivTzUHzP1RSjlCeD57unGUt3CdsEYtx4Fz+IqSYJ3N5tCZwmkc+LwN kq7AewJAcBffA384bCToaKQYrP6PXI2paTmLCtnkTlVXQ/CWtaxpxPHyQNkc1Zqaw/Zs fTQfeXZAWVpTrHYzNHBwqRitlfZ1FslaG16rmgr4EmjDnlQ67MGlcF6knPr0A8+oNXY0 CMh/gnwG+KLwVLtmj9ujDoMIimpKJcpIj6EuRGepd41Y46kgI02jmrmXonDOwUVe8qhS 7/8A== X-Gm-Message-State: AOAM5300TaQa+4cG/skgQ7zD0VxZPLppZWLIzgrKlxmfV+7JJAlvpquN 4k5+7O3AAaCdjxaezEgpNo1Xs1xYkio= X-Google-Smtp-Source: ABdhPJyHS8aVPhSDtEDAgNaYfme6yNylW3O7vJMFlvQeQd9FlzBBplV9o24JS+G6kWzQ/5YE/2FNjQ== X-Received: by 2002:a05:6214:b88:: with SMTP id fe8mr6314644qvb.244.1595533621997; Thu, 23 Jul 2020 12:47:01 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:01 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 08/16] Remove internal usage of extensible stat functions Date: Thu, 23 Jul 2020 16:46:33 -0300 Message-Id: <20200723194641.1949404-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 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, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- catgets/open_catalog.c | 2 +- csu/check_fds.c | 2 +- elf/cache.c | 4 +-- elf/dl-load.c | 4 +-- elf/dl-misc.c | 2 +- elf/dl-profile.c | 2 +- iconv/gconv_cache.c | 2 +- include/sys/stat.h | 1 + inet/rcmd.c | 4 +-- inet/ruserpass.c | 2 +- intl/loadmsgcat.c | 2 +- io/file_change_detection.c | 4 +-- io/fts.c | 15 +++++----- io/fts64.c | 5 ++-- io/ftw.c | 46 ++++++++++++++--------------- io/ftw64.c | 8 ++--- io/getdirname.c | 4 +-- io/mkdirat.c | 2 +- io/mkfifoat.c | 2 +- io/openat.c | 2 +- io/openat64.c | 2 +- io/xmknodat.c | 2 +- libio/fileops.c | 2 +- locale/loadarchive.c | 4 +-- locale/loadlocale.c | 4 +-- misc/daemon.c | 2 +- misc/getusershell.c | 2 +- nptl/sem_open.c | 2 +- nscd/nscd_helper.c | 2 +- posix/glob.c | 7 ----- stdlib/canonicalize.c | 2 +- sysdeps/gnu/glob64-lstat-compat.c | 2 +- sysdeps/gnu/glob64.c | 2 +- sysdeps/mach/hurd/ptsname.c | 2 +- sysdeps/posix/dl-fileid.h | 2 +- sysdeps/posix/euidaccess.c | 2 +- sysdeps/posix/fdopendir.c | 2 +- sysdeps/posix/fpathconf.c | 2 +- sysdeps/posix/getaddrinfo.c | 4 +-- sysdeps/posix/isfdtype.c | 2 +- sysdeps/posix/opendir.c | 2 +- sysdeps/posix/pathconf.c | 2 +- sysdeps/posix/posix_fallocate.c | 2 +- sysdeps/posix/posix_fallocate64.c | 2 +- sysdeps/posix/sysconf.c | 2 +- sysdeps/posix/tempname.c | 5 ++-- sysdeps/unix/sysv/linux/faccessat.c | 2 +- sysdeps/unix/sysv/linux/fexecve.c | 4 +-- sysdeps/unix/sysv/linux/oldglob.c | 2 +- sysdeps/unix/sysv/linux/pathconf.c | 4 +-- sysdeps/unix/sysv/linux/ptsname.c | 4 +-- sysdeps/unix/sysv/linux/ttyname.c | 8 ++--- sysdeps/unix/sysv/linux/ttyname_r.c | 8 ++--- sysvipc/ftok.c | 2 +- time/getdate.c | 2 +- time/tzfile.c | 4 +-- 56 files changed, 108 insertions(+), 113 deletions(-) diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c index 6b14963d78..cf8d635ae7 100644 --- a/catgets/open_catalog.c +++ b/catgets/open_catalog.c @@ -194,7 +194,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var, return -1; } - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0) + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0) goto close_unlock_return; if (__builtin_expect (!S_ISREG (st.st_mode), 0) diff --git a/csu/check_fds.c b/csu/check_fds.c index 30634b81a7..29d9d04acb 100644 --- a/csu/check_fds.c +++ b/csu/check_fds.c @@ -71,7 +71,7 @@ check_one_fd (int fd, int mode) decsriptor numbers, in this order. */ struct stat64 st; if (__builtin_expect (nullfd != fd, 0) - || __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0 + || __builtin_expect (__fstat64 (fd, &st), 0) != 0 || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0 || st.st_rdev != dev) /* We cannot even give an error message here since it would diff --git a/elf/cache.c b/elf/cache.c index d92b4e59c1..1eb1455883 100644 --- a/elf/cache.c +++ b/elf/cache.c @@ -163,7 +163,7 @@ print_cache (const char *cache_name) error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), cache_name); struct stat64 st; - if (fstat64 (fd, &st) < 0 + if (__fstat64 (fd, &st) < 0 /* No need to map the file if it is empty. */ || st.st_size == 0) { @@ -699,7 +699,7 @@ load_aux_cache (const char *aux_cache_name) } struct stat64 st; - if (fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file)) + if (__fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file)) { close (fd); init_aux_cache (); diff --git a/elf/dl-load.c b/elf/dl-load.c index e39980fb19..646c5dca40 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1914,7 +1914,7 @@ open_path (const char *name, size_t namelen, int mode, buf[buflen - namelen - 1] = '\0'; - if (__xstat64 (_STAT_VER, buf, &st) != 0 + if (__stat64 (buf, &st) != 0 || ! S_ISDIR (st.st_mode)) /* The directory does not exist or it is no directory. */ this_dir->status[cnt] = nonexisting; @@ -1934,7 +1934,7 @@ open_path (const char *name, size_t namelen, int mode, directories and so exploit the bugs. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0 + if (__fstat64 (fd, &st) != 0 || (st.st_mode & S_ISUID) == 0) { /* The shared object cannot be tested for being SUID diff --git a/elf/dl-misc.c b/elf/dl-misc.c index f9d1fd7993..aee62e1e60 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -47,7 +47,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) int fd = __open64_nocancel (file, O_RDONLY | O_CLOEXEC); if (fd >= 0) { - if (__fxstat64 (_STAT_VER, fd, &st) >= 0) + if (__fstat64 (fd, &st) >= 0) { *sizep = st.st_size; diff --git a/elf/dl-profile.c b/elf/dl-profile.c index c681f5415c..89dd70ba3b 100644 --- a/elf/dl-profile.c +++ b/elf/dl-profile.c @@ -342,7 +342,7 @@ _dl_start_profile (void) return; } - if (__fxstat64 (_STAT_VER, fd, &st) < 0 || !S_ISREG (st.st_mode)) + if (__fstat64 (fd, &st) < 0 || !S_ISREG (st.st_mode)) { /* Not stat'able or not a regular file => don't use it. */ errstr = "%s: cannot stat file: %s\n"; diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c index 9fe371b4c0..b326cd19e2 100644 --- a/iconv/gconv_cache.c +++ b/iconv/gconv_cache.c @@ -64,7 +64,7 @@ __gconv_load_cache (void) return -1; /* Get information about the file. */ - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0 + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0 /* We do not have to start looking at the file if it cannot contain at least the cache header. */ || (size_t) st.st_size < sizeof (struct gconvcache_header)) diff --git a/include/sys/stat.h b/include/sys/stat.h index 92284ca48b..f8847cf73e 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -53,6 +53,7 @@ extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden; #define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) #define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) #define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) +#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) #define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) #define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) #define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) diff --git a/inet/rcmd.c b/inet/rcmd.c index 8a9616f847..452ff7d099 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -474,7 +474,7 @@ iruserfopen (const char *file, uid_t okuser) /* If not a regular file, if owned by someone other than user or root, if writeable by anyone but the owner, or if hardlinked anywhere, quit. */ - if (__lxstat64 (_STAT_VER, file, &st)) + if (__lstat64 (file, &st)) cp = _("lstat failed"); else if (!S_ISREG (st.st_mode)) cp = _("not regular file"); @@ -483,7 +483,7 @@ iruserfopen (const char *file, uid_t okuser) res = fopen (file, "rce"); if (!res) cp = _("cannot open"); - else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0) + else if (__fstat64 (fileno (res), &st) < 0) cp = _("fstat failed"); else if (st.st_uid && st.st_uid != okuser) cp = _("bad owner"); diff --git a/inet/ruserpass.c b/inet/ruserpass.c index 4fa6520c1a..d61a72877d 100644 --- a/inet/ruserpass.c +++ b/inet/ruserpass.c @@ -174,7 +174,7 @@ next: break; case PASSWD: if (strcmp(*aname, "anonymous") && - fstat64(fileno(cfile), &stb) >= 0 && + __fstat64(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { warnx(_("Error: .netrc file is readable by others.")); warnx(_("Remove 'password' line or make file unreadable by others.")); diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c index 91c1ef156a..d44a4a0b14 100644 --- a/intl/loadmsgcat.c +++ b/intl/loadmsgcat.c @@ -804,7 +804,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file, /* We must know about the size of the file. */ if ( #ifdef _LIBC - __builtin_expect (fstat64 (fd, &st) != 0, 0) + __builtin_expect (__fstat64 (fd, &st) != 0, 0) #else __builtin_expect (fstat (fd, &st) != 0, 0) #endif diff --git a/io/file_change_detection.c b/io/file_change_detection.c index c6d700ed05..f52d8fecfa 100644 --- a/io/file_change_detection.c +++ b/io/file_change_detection.c @@ -67,7 +67,7 @@ __file_change_detection_for_path (struct file_change_detection *file, const char *path) { struct stat64 st; - if (stat64 (path, &st) != 0) + if (__stat64 (path, &st) != 0) switch (errno) { case EACCES: @@ -105,7 +105,7 @@ __file_change_detection_for_fp (struct file_change_detection *file, else { struct stat64 st; - if (fstat64 (__fileno (fp), &st) != 0) + if (__fstat64 (__fileno (fp), &st) != 0) /* If we already have a file descriptor, all errors are fatal. */ return false; else diff --git a/io/fts.c b/io/fts.c index ba83691859..9668a205c3 100644 --- a/io/fts.c +++ b/io/fts.c @@ -81,8 +81,9 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; # define FTSOBJ FTS # define FTSENTRY FTSENT # define INO_T ino_t -# define STAT stat -# define LSTAT lstat +# define STRUCT_STAT stat +# define STAT __stat +# define LSTAT __lstat #endif static FTSENTRY *fts_alloc (FTSOBJ *, const char *, size_t); @@ -872,7 +873,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow) FTSENTRY *t; dev_t dev; INO_T ino; - struct STAT *sbp, sb; + struct STRUCT_STAT *sbp, sb; int saved_errno; /* If user needs stat info, stat buffer already allocated. */ @@ -906,7 +907,7 @@ fts_stat (FTSOBJ *sp, FTSENTRY *p, int follow) } } else if (LSTAT(p->fts_accpath, sbp)) { p->fts_errno = errno; -err: memset(sbp, 0, sizeof(struct STAT)); +err: memset(sbp, 0, sizeof(struct STRUCT_STAT)); return (FTS_NS); } @@ -996,7 +997,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen) */ len = sizeof(FTSENTRY) + namelen; if (!ISSET(FTS_NOSTAT)) - len += sizeof(struct STAT) + ALIGNBYTES; + len += sizeof(struct STRUCT_STAT) + ALIGNBYTES; if ((p = malloc(len)) == NULL) return (NULL); @@ -1005,7 +1006,7 @@ fts_alloc (FTSOBJ *sp, const char *name, size_t namelen) p->fts_name[namelen] = '\0'; if (!ISSET(FTS_NOSTAT)) - p->fts_statp = (struct STAT *)ALIGN(p->fts_name + namelen + 2); + p->fts_statp = (struct STRUCT_STAT *)ALIGN(p->fts_name + namelen + 2); p->fts_namelen = namelen; p->fts_path = sp->fts_path; p->fts_errno = 0; @@ -1116,7 +1117,7 @@ fts_safe_changedir (FTSOBJ *sp, FTSENTRY *p, int fd, const char *path) return (0); if (fd < 0 && (newfd = __open(path, O_RDONLY, 0)) < 0) return (-1); - if (__fxstat64(_STAT_VER, newfd, &sb)) { + if (__fstat64(newfd, &sb)) { ret = -1; goto bail; } diff --git a/io/fts64.c b/io/fts64.c index 3d9c779791..466703da37 100644 --- a/io/fts64.c +++ b/io/fts64.c @@ -24,7 +24,8 @@ #define FTSOBJ FTS64 #define FTSENTRY FTSENT64 #define INO_T ino64_t -#define STAT stat64 -#define LSTAT lstat64 +#define STRUCT_STAT stat64 +#define STAT __stat64 +#define LSTAT __lstat64 #include "fts.c" diff --git a/io/ftw.c b/io/ftw.c index 8c79d29a9e..7104816e85 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -135,15 +135,15 @@ int rpl_lstat (const char *, struct stat *); # define NFTW_OLD_NAME __old_nftw # define NFTW_NEW_NAME __new_nftw # define INO_T ino_t -# define STAT stat +# define STRUCT_STAT stat # ifdef _LIBC -# define LXSTAT __lxstat -# define XSTAT __xstat -# define FXSTATAT __fxstatat +# define LSTAT __lstat +# define STAT __stat +# define FSTATAT __fstatat # else -# define LXSTAT(V,f,sb) lstat (f,sb) -# define XSTAT(V,f,sb) stat (f,sb) -# define FXSTATAT(V,d,f,sb,m) fstatat (d, f, sb, m) +# define LSTAT lstat +# define XTAT stat +# define FSTATAT fstatat # endif # define FTW_FUNC_T __ftw_func_t # define NFTW_FUNC_T __nftw_func_t @@ -219,7 +219,7 @@ static const int ftw_arr[] = /* Forward declarations of local functions. */ -static int ftw_dir (struct ftw_data *data, struct STAT *st, +static int ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st, struct dir_data *old_dir); @@ -239,7 +239,7 @@ object_compare (const void *p1, const void *p2) static int -add_object (struct ftw_data *data, struct STAT *st) +add_object (struct ftw_data *data, struct STRUCT_STAT *st) { struct known_object *newp = malloc (sizeof (struct known_object)); if (newp == NULL) @@ -251,7 +251,7 @@ add_object (struct ftw_data *data, struct STAT *st) static inline int -find_object (struct ftw_data *data, struct STAT *st) +find_object (struct ftw_data *data, struct STRUCT_STAT *st) { struct known_object obj; obj.dev = st->st_dev; @@ -378,7 +378,7 @@ static int process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, size_t namlen, int d_type) { - struct STAT st; + struct STRUCT_STAT st; int result = 0; int flag = 0; size_t new_buflen; @@ -405,16 +405,16 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, int statres; if (dir->streamfd != -1) - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st, - (data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0); + statres = FSTATAT (dir->streamfd, name, &st, + (data->flags & FTW_PHYS) ? AT_SYMLINK_NOFOLLOW : 0); else { if ((data->flags & FTW_CHDIR) == 0) name = data->dirbuf; statres = ((data->flags & FTW_PHYS) - ? LXSTAT (_STAT_VER, name, &st) - : XSTAT (_STAT_VER, name, &st)); + ? LSTAT (name, &st) + : STAT (name, &st)); } if (statres < 0) @@ -430,10 +430,10 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, it should contain information about the link (ala lstat). We do our best to fill in what data we can. */ if (dir->streamfd != -1) - statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st, - AT_SYMLINK_NOFOLLOW); + statres = FSTATAT (dir->streamfd, name, &st, + AT_SYMLINK_NOFOLLOW); else - statres = LXSTAT (_STAT_VER, name, &st); + statres = LSTAT (name, &st); if (statres == 0 && S_ISLNK (st.st_mode)) flag = FTW_SLN; else @@ -476,7 +476,7 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, static int __attribute ((noinline)) -ftw_dir (struct ftw_data *data, struct STAT *st, struct dir_data *old_dir) +ftw_dir (struct ftw_data *data, struct STRUCT_STAT *st, struct dir_data *old_dir) { struct dir_data dir; struct dirent64 *d; @@ -630,7 +630,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flags) { struct ftw_data data; - struct STAT st; + struct STRUCT_STAT st; int result = 0; int save_err; int cwdfd = -1; @@ -740,12 +740,12 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, name = data.dirbuf; if (((flags & FTW_PHYS) - ? LXSTAT (_STAT_VER, name, &st) - : XSTAT (_STAT_VER, name, &st)) < 0) + ? LSTAT (name, &st) + : STAT (name, &st)) < 0) { if (!(flags & FTW_PHYS) && errno == ENOENT - && LXSTAT (_STAT_VER, name, &st) == 0 + && LSTAT (name, &st) == 0 && S_ISLNK (st.st_mode)) result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN], &data.ftw); diff --git a/io/ftw64.c b/io/ftw64.c index 20c43d9616..8daf8777cf 100644 --- a/io/ftw64.c +++ b/io/ftw64.c @@ -22,10 +22,10 @@ #define NFTW_OLD_NAME __old_nftw64 #define NFTW_NEW_NAME __new_nftw64 #define INO_T ino64_t -#define STAT stat64 -#define LXSTAT __lxstat64 -#define XSTAT __xstat64 -#define FXSTATAT __fxstatat64 +#define STRUCT_STAT stat64 +#define LSTAT __lstat64 +#define STAT __stat64 +#define FSTATAT __fstatat64 #define FTW_FUNC_T __ftw64_func_t #define NFTW_FUNC_T __nftw64_func_t diff --git a/io/getdirname.c b/io/getdirname.c index dd69e4e281..2465b62ad2 100644 --- a/io/getdirname.c +++ b/io/getdirname.c @@ -32,8 +32,8 @@ get_current_dir_name (void) pwd = getenv ("PWD"); if (pwd != NULL - && stat64 (".", &dotstat) == 0 - && stat64 (pwd, &pwdstat) == 0 + && __stat64 (".", &dotstat) == 0 + && __stat64 (pwd, &pwdstat) == 0 && pwdstat.st_dev == dotstat.st_dev && pwdstat.st_ino == dotstat.st_ino) /* The PWD value is correct. Use it. */ diff --git a/io/mkdirat.c b/io/mkdirat.c index cfe01b5748..094f0d7e0e 100644 --- a/io/mkdirat.c +++ b/io/mkdirat.c @@ -36,7 +36,7 @@ mkdirat (int fd, const char *path, mode_t mode) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/mkfifoat.c b/io/mkfifoat.c index 409f55112c..f2af653399 100644 --- a/io/mkfifoat.c +++ b/io/mkfifoat.c @@ -37,7 +37,7 @@ mkfifoat (int fd, const char *path, mode_t mode) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/openat.c b/io/openat.c index a7ce65bee2..a2e86eddeb 100644 --- a/io/openat.c +++ b/io/openat.c @@ -47,7 +47,7 @@ __openat (int fd, const char *file, int oflag, ...) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/openat64.c b/io/openat64.c index b66979c035..a4bb188eb2 100644 --- a/io/openat64.c +++ b/io/openat64.c @@ -40,7 +40,7 @@ __openat64 (int fd, const char *file, int oflag, ...) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/io/xmknodat.c b/io/xmknodat.c index 0e69db1940..b6c668170b 100644 --- a/io/xmknodat.c +++ b/io/xmknodat.c @@ -44,7 +44,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev) { /* Check FD is associated with a directory. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return -1; if (!S_ISDIR (st.st_mode)) diff --git a/libio/fileops.c b/libio/fileops.c index bc76f3549f..99f06efc10 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -1145,7 +1145,7 @@ libc_hidden_def (_IO_file_seek) int _IO_file_stat (FILE *fp, void *st) { - return __fxstat64 (_STAT_VER, fp->_fileno, (struct stat64 *) st); + return __fstat64 (fp->_fileno, (struct stat64 *) st); } libc_hidden_def (_IO_file_stat) diff --git a/locale/loadarchive.c b/locale/loadarchive.c index ba0fe45648..8de6a327a4 100644 --- a/locale/loadarchive.c +++ b/locale/loadarchive.c @@ -207,7 +207,7 @@ _nl_load_locale_from_archive (int category, const char **namep) /* Cannot open the archive, for whatever reason. */ return NULL; - if (__fxstat64 (_STAT_VER, fd, &archive_stat) == -1) + if (__fstat64 (fd, &archive_stat) == -1) { /* stat failed, very strange. */ close_and_out: @@ -405,7 +405,7 @@ _nl_load_locale_from_archive (int category, const char **namep) /* Now verify we think this is really the same archive file we opened before. If it has been changed we cannot trust the header we read previously. */ - if (__fxstat64 (_STAT_VER, fd, &st) < 0 + if (__fstat64 (fd, &st) < 0 || st.st_size != archive_stat.st_size || st.st_mtime != archive_stat.st_mtime || st.st_dev != archive_stat.st_dev diff --git a/locale/loadlocale.c b/locale/loadlocale.c index 2fcb348d1d..82c745d9a2 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -180,7 +180,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) /* Cannot open the file. */ return; - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0) + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0) { puntfd: __close_nocancel_nostatus (fd); @@ -206,7 +206,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) if (__builtin_expect (fd, 0) < 0) return; - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0) + if (__builtin_expect (__fstat64 (fd, &st), 0) < 0) goto puntfd; } diff --git a/misc/daemon.c b/misc/daemon.c index 21e785966a..0e688f4d74 100644 --- a/misc/daemon.c +++ b/misc/daemon.c @@ -64,7 +64,7 @@ daemon (int nochdir, int noclose) struct stat64 st; if ((fd = __open_nocancel(_PATH_DEVNULL, O_RDWR, 0)) != -1 - && (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) + && (__builtin_expect (__fstat64 (fd, &st), 0) == 0)) { if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0 #if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR diff --git a/misc/getusershell.c b/misc/getusershell.c index fc2c43b771..11f5aa83f8 100644 --- a/misc/getusershell.c +++ b/misc/getusershell.c @@ -106,7 +106,7 @@ initshells (void) strings = NULL; if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL) goto init_okshells_noclose; - if (fstat64(fileno(fp), &statb) == -1) { + if (__fstat64(fileno(fp), &statb) == -1) { init_okshells: (void)fclose(fp); init_okshells_noclose: diff --git a/nptl/sem_open.c b/nptl/sem_open.c index b022cbfd9a..05e286002b 100644 --- a/nptl/sem_open.c +++ b/nptl/sem_open.c @@ -68,7 +68,7 @@ check_add_mapping (const char *name, size_t namelen, int fd, sem_t *existing) /* Get the information about the file. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) == 0) + if (__fstat64 (fd, &st) == 0) { /* Get the lock. */ lll_lock (__sem_mappings_lock, LLL_PRIVATE); diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index a4f3312f90..41c7937fcd 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -325,7 +325,7 @@ __nscd_get_mapping (request_type type, const char *key, if (__glibc_unlikely (n == keylen)) { struct stat64 st; - if (__builtin_expect (fstat64 (mapfd, &st) != 0, 0) + if (__builtin_expect (__fstat64 (mapfd, &st) != 0, 0) || __builtin_expect (st.st_size < sizeof (struct database_pers_head), 0)) goto out_close; diff --git a/posix/glob.c b/posix/glob.c index 4580cefb9f..b4b34945e2 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -49,12 +49,6 @@ # define readdir(str) __readdir64 (str) # define getpwnam_r(name, bufp, buf, len, res) \ __getpwnam_r (name, bufp, buf, len, res) -# ifndef __lstat64 -# define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) -# endif -# ifndef __stat64 -# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) -# endif # define struct_stat64 struct stat64 # define FLEXIBLE_ARRAY_MEMBER # include @@ -63,7 +57,6 @@ # define __getlogin_r(buf, len) getlogin_r (buf, len) # define __lstat64(fname, buf) lstat (fname, buf) # define __stat64(fname, buf) stat (fname, buf) -# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag) # define struct_stat64 struct stat # ifndef __MVS__ # define __alloca alloca diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c index cbd885a3c5..3fcb399a5d 100644 --- a/stdlib/canonicalize.c +++ b/stdlib/canonicalize.c @@ -158,7 +158,7 @@ __realpath (const char *name, char *resolved) dest = __mempcpy (dest, start, end - start); *dest = '\0'; - if (__lxstat64 (_STAT_VER, rpath, &st) < 0) + if (__lstat64 (rpath, &st) < 0) goto error; if (S_ISLNK (st.st_mode)) diff --git a/sysdeps/gnu/glob64-lstat-compat.c b/sysdeps/gnu/glob64-lstat-compat.c index 47b5e88498..ac1fe1496a 100644 --- a/sysdeps/gnu/glob64-lstat-compat.c +++ b/sysdeps/gnu/glob64-lstat-compat.c @@ -32,7 +32,7 @@ #undef stat #define stat stat64 #undef __stat -#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf) +#define __stat(file, buf) __stat64 (file, buf) #define COMPILE_GLOB64 1 diff --git a/sysdeps/gnu/glob64.c b/sysdeps/gnu/glob64.c index 42b5b225ca..32ac018fde 100644 --- a/sysdeps/gnu/glob64.c +++ b/sysdeps/gnu/glob64.c @@ -12,7 +12,7 @@ #undef stat #define stat stat64 #undef __stat -#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf) +#define __stat(file, buf) __stat64 (file, buf) #define COMPILE_GLOB64 1 diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c index 9627f970f9..065ba2a268 100644 --- a/sysdeps/mach/hurd/ptsname.c +++ b/sysdeps/mach/hurd/ptsname.c @@ -63,7 +63,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp) if (stp) { - if (__xstat64 (_STAT_VER, peername, stp) < 0) + if (__stat64 (peername, stp) < 0) return errno; } diff --git a/sysdeps/posix/dl-fileid.h b/sysdeps/posix/dl-fileid.h index 7d1e9e4950..b3c8166701 100644 --- a/sysdeps/posix/dl-fileid.h +++ b/sysdeps/posix/dl-fileid.h @@ -34,7 +34,7 @@ _dl_get_file_id (int fd, struct r_file_id *id) { struct stat64 st; - if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &st) < 0)) + if (__glibc_unlikely (__fstat64 (fd, &st) < 0)) return false; id->dev = st.st_dev; diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c index 8a2776d502..050d370f4c 100644 --- a/sysdeps/posix/euidaccess.c +++ b/sysdeps/posix/euidaccess.c @@ -140,7 +140,7 @@ euidaccess (const char *path, int mode) return access (path, mode); #endif - if (stat64 (path, &stats)) + if (__stat64 (path, &stats)) return -1; mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */ diff --git a/sysdeps/posix/fdopendir.c b/sysdeps/posix/fdopendir.c index b690f7fc88..e424fbdaa2 100644 --- a/sysdeps/posix/fdopendir.c +++ b/sysdeps/posix/fdopendir.c @@ -29,7 +29,7 @@ __fdopendir (int fd) { struct stat64 statbuf; - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0) + if (__builtin_expect (__fstat64 (fd, &statbuf), 0) < 0) return NULL; if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode))) { diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c index 1863be64e0..3a9fb1513f 100644 --- a/sysdeps/posix/fpathconf.c +++ b/sysdeps/posix/fpathconf.c @@ -133,7 +133,7 @@ __fpathconf (int fd, int name) /* AIO is only allowed on regular files and block devices. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) < 0 + if (__fstat64 (fd, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index ed04e564f9..82c898fe35 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1785,7 +1785,7 @@ gaiconf_init (void) if (fp != NULL) { struct stat64 st; - if (__fxstat64 (_STAT_VER, fileno (fp), &st) != 0) + if (__fstat64 (fileno (fp), &st) != 0) { fclose (fp); goto no_file; @@ -2138,7 +2138,7 @@ static void gaiconf_reload (void) { struct stat64 st; - if (__xstat64 (_STAT_VER, GAICONF_FNAME, &st) != 0 + if (stat64 (GAICONF_FNAME, &st) != 0 || !check_gaiconf_mtime (&st)) gaiconf_init (); } diff --git a/sysdeps/posix/isfdtype.c b/sysdeps/posix/isfdtype.c index 20c6309220..3c63a33e88 100644 --- a/sysdeps/posix/isfdtype.c +++ b/sysdeps/posix/isfdtype.c @@ -29,7 +29,7 @@ isfdtype (int fildes, int fdtype) { int save_error = errno; - result = fstat64 (fildes, &st); + result = __fstat64 (fildes, &st); __set_errno (save_error); } diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c index c6ab79246c..e89e09bfc7 100644 --- a/sysdeps/posix/opendir.c +++ b/sysdeps/posix/opendir.c @@ -56,7 +56,7 @@ opendir_tail (int fd) `stat' call. The S_ISDIR check is superfluous if O_DIRECTORY works, but it's cheap and we need the stat call for st_blksize anyway. */ struct stat64 statbuf; - if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, &statbuf) < 0)) + if (__glibc_unlikely (__fstat64 (fd, &statbuf) < 0)) goto lose; if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode))) { diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c index 5819f03aa7..084c5fab59 100644 --- a/sysdeps/posix/pathconf.c +++ b/sysdeps/posix/pathconf.c @@ -131,7 +131,7 @@ __pathconf (const char *path, int name) /* AIO is only allowed on regular files and block devices. */ struct stat64 st; - if (__xstat64 (_STAT_VER, path, &st) < 0 + if (__stat64 (path, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else diff --git a/sysdeps/posix/posix_fallocate.c b/sysdeps/posix/posix_fallocate.c index e7fccfc1c8..c9cf17bc7b 100644 --- a/sysdeps/posix/posix_fallocate.c +++ b/sysdeps/posix/posix_fallocate.c @@ -48,7 +48,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len) } /* We have to make sure that this is really a regular file. */ - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return EBADF; if (S_ISFIFO (st.st_mode)) return ESPIPE; diff --git a/sysdeps/posix/posix_fallocate64.c b/sysdeps/posix/posix_fallocate64.c index f9d4fe5ca3..4f8fe47b18 100644 --- a/sysdeps/posix/posix_fallocate64.c +++ b/sysdeps/posix/posix_fallocate64.c @@ -48,7 +48,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) } /* We have to make sure that this is really a regular file. */ - if (__fxstat64 (_STAT_VER, fd, &st) != 0) + if (__fstat64 (fd, &st) != 0) return EBADF; if (S_ISFIFO (st.st_mode)) return ESPIPE; diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c index 35ba7f8103..8f7c4708df 100644 --- a/sysdeps/posix/sysconf.c +++ b/sysdeps/posix/sysconf.c @@ -1216,7 +1216,7 @@ __sysconf_check_spec (const char *spec) spec, speclen + 1); struct stat64 st; - long int ret = __xstat64 (_STAT_VER, name, &st) >= 0 ? 1 : -1; + long int ret = __stat64 (name, &st) >= 0 ? 1 : -1; __set_errno (save_errno); return ret; diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index cd48385a40..3dd8f1e1ef 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -65,7 +65,6 @@ # define __getpid getpid # define __mkdir mkdir # define __open open -# define __lxstat64(version, file, buf) lstat (file, buf) # define __secure_getenv secure_getenv #endif @@ -96,7 +95,7 @@ static int direxists (const char *dir) { struct_stat64 buf; - return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode); + return __stat64 (dir, &buf) == 0 && S_ISDIR (buf.st_mode); } /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is @@ -254,7 +253,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) succeeds if __xstat fails because the name does not exist. Note the continue to bypass the common logic at the bottom of the loop. */ - if (__lxstat64 (_STAT_VER, tmpl, &st) < 0) + if (__lstat64 (tmpl, &st) < 0) { if (errno == ENOENT) { diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c index e4f18ab2db..5a660f5201 100644 --- a/sysdeps/unix/sysv/linux/faccessat.c +++ b/sysdeps/unix/sysv/linux/faccessat.c @@ -37,7 +37,7 @@ faccessat (int fd, const char *file, int mode, int flag) return INLINE_SYSCALL (faccessat, 3, fd, file, mode); struct stat64 stats; - if (__fxstatat64 (_STAT_VER, fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW)) + if (__fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW)) return -1; mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */ diff --git a/sysdeps/unix/sysv/linux/fexecve.c b/sysdeps/unix/sysv/linux/fexecve.c index 23c9799f5d..1fe3a23333 100644 --- a/sysdeps/unix/sysv/linux/fexecve.c +++ b/sysdeps/unix/sysv/linux/fexecve.c @@ -60,8 +60,8 @@ fexecve (int fd, char *const argv[], char *const envp[]) /* We come here only if the 'execve' call fails. Determine whether /proc is mounted. If not we return ENOSYS. */ - struct stat st; - if (stat ("/proc/self/fd", &st) != 0 && errno == ENOENT) + struct stat64 st; + if (__stat64 ("/proc/self/fd", &st) != 0 && errno == ENOENT) save = ENOSYS; __set_errno (save); diff --git a/sysdeps/unix/sysv/linux/oldglob.c b/sysdeps/unix/sysv/linux/oldglob.c index a034c2d930..59bf89dc1d 100644 --- a/sysdeps/unix/sysv/linux/oldglob.c +++ b/sysdeps/unix/sysv/linux/oldglob.c @@ -31,7 +31,7 @@ libc_hidden_proto (__old_glob64); #undef stat #define stat stat64 #undef __stat -#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf) +#define __stat(file, buf) __stat64 (file, buf) /* Avoid calling gl_lstat with GLOB_ALTDIRFUNC. */ #define GLOB_NO_LSTAT diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c index fec1a142e7..e59b8ab341 100644 --- a/sysdeps/unix/sysv/linux/pathconf.c +++ b/sysdeps/unix/sysv/linux/pathconf.c @@ -67,7 +67,7 @@ distinguish_extX (const struct statfs *fsbuf, const char *file, int fd) char path[PATH_MAX]; struct stat64 st; - if ((file == NULL ? fstat64 (fd, &st) : stat64 (file, &st)) != 0) + if ((file == NULL ? __fstat64 (fd, &st) : __stat64 (file, &st)) != 0) /* Strange. The statfd call worked, but stat fails. Default to the more pessimistic value. */ return EXT2_LINK_MAX; @@ -110,7 +110,7 @@ distinguish_extX (const struct statfs *fsbuf, const char *file, int fd) continue; struct stat64 fsst; - if (stat64 (mntbuf.mnt_dir, &fsst) >= 0 + if (__stat64 (mntbuf.mnt_dir, &fsst) >= 0 && st.st_dev == fsst.st_dev) { if (strcmp (mntbuf.mnt_type, "ext4") == 0) diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c index 81d9d26f1e..4c569bf264 100644 --- a/sysdeps/unix/sysv/linux/ptsname.c +++ b/sysdeps/unix/sysv/linux/ptsname.c @@ -114,7 +114,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp) return ERANGE; } - if (__fxstat64 (_STAT_VER, fd, stp) < 0) + if (__fstat64 (fd, stp) < 0) return errno; /* Check if FD really is a master pseudo terminal. */ @@ -138,7 +138,7 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp) p[2] = '\0'; } - if (__xstat64 (_STAT_VER, buf, stp) < 0) + if (__stat64 (buf, stp) < 0) return errno; /* Check if the name we're about to return really corresponds to a diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c index c05ca687f5..5fa6645353 100644 --- a/sysdeps/unix/sysv/linux/ttyname.c +++ b/sysdeps/unix/sysv/linux/ttyname.c @@ -84,7 +84,7 @@ getttyname (const char *dev, const struct stat64 *mytty, int save, int *dostat) *((char *) __mempcpy (getttyname_name, dev, devlen - 1)) = '/'; } memcpy (&getttyname_name[devlen], d->d_name, dlen); - if (__xstat64 (_STAT_VER, getttyname_name, &st) == 0 + if (__stat64 (getttyname_name, &st) == 0 && is_mytty (mytty, &st)) { (void) __closedir (dirstream); @@ -125,7 +125,7 @@ ttyname (int fd) if (__glibc_unlikely (__tcgetattr (fd, &term) < 0)) return NULL; - if (__fxstat64 (_STAT_VER, fd, &st) < 0) + if (__fstat64 (fd, &st) < 0) return NULL; /* We try using the /proc filesystem. */ @@ -162,14 +162,14 @@ ttyname (int fd) /* Verify readlink result, fall back on iterating through devices. */ if (ttyname_buf[0] == '/' - && __xstat64 (_STAT_VER, ttyname_buf, &st1) == 0 + && __stat64 (ttyname_buf, &st1) == 0 && is_mytty (&st, &st1)) return ttyname_buf; doispty = 1; } - if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode)) + if (__stat64 ("/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode)) { name = getttyname ("/dev/pts", &st, save, &dostat); } diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c index 4a1ae40bb2..ad8cd28158 100644 --- a/sysdeps/unix/sysv/linux/ttyname_r.c +++ b/sysdeps/unix/sysv/linux/ttyname_r.c @@ -71,7 +71,7 @@ getttyname_r (char *buf, size_t buflen, const struct stat64 *mytty, cp = __stpncpy (buf + devlen, d->d_name, needed); cp[0] = '\0'; - if (__xstat64 (_STAT_VER, buf, &st) == 0 + if (__stat64 (buf, &st) == 0 && is_mytty (mytty, &st)) { (void) __closedir (dirstream); @@ -118,7 +118,7 @@ __ttyname_r (int fd, char *buf, size_t buflen) if (__glibc_unlikely (__tcgetattr (fd, &term) < 0)) return errno; - if (__fxstat64 (_STAT_VER, fd, &st) < 0) + if (__fstat64 (fd, &st) < 0) return errno; /* We try using the /proc filesystem. */ @@ -146,7 +146,7 @@ __ttyname_r (int fd, char *buf, size_t buflen) /* Verify readlink result, fall back on iterating through devices. */ if (buf[0] == '/' - && __xstat64 (_STAT_VER, buf, &st1) == 0 + && __stat64 (buf, &st1) == 0 && is_mytty (&st, &st1)) return 0; @@ -157,7 +157,7 @@ __ttyname_r (int fd, char *buf, size_t buflen) memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/")); buflen -= sizeof ("/dev/pts/") - 1; - if (__xstat64 (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode)) + if (__stat64 (buf, &st1) == 0 && S_ISDIR (st1.st_mode)) { ret = getttyname_r (buf, buflen, &st, save, &dostat); diff --git a/sysvipc/ftok.c b/sysvipc/ftok.c index 0b6dab403f..a65dbd520a 100644 --- a/sysvipc/ftok.c +++ b/sysvipc/ftok.c @@ -25,7 +25,7 @@ ftok (const char *pathname, int proj_id) struct stat64 st; key_t key; - if (__xstat64 (_STAT_VER, pathname, &st) < 0) + if (__stat64 (pathname, &st) < 0) return (key_t) -1; key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) diff --git a/time/getdate.c b/time/getdate.c index d5c01b8446..ddd97ba277 100644 --- a/time/getdate.c +++ b/time/getdate.c @@ -121,7 +121,7 @@ __getdate_r (const char *string, struct tm *tp) if (datemsk == NULL || *datemsk == '\0') return 1; - if (stat64 (datemsk, &st) < 0) + if (__stat64 (datemsk, &st) < 0) return 3; if (!S_ISREG (st.st_mode)) diff --git a/time/tzfile.c b/time/tzfile.c index af6da1bf00..e8084a86e8 100644 --- a/time/tzfile.c +++ b/time/tzfile.c @@ -152,7 +152,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap) /* If we were already using tzfile, check whether the file changed. */ struct stat64 st; if (was_using_tzfile - && stat64 (file, &st) == 0 + && __stat64 (file, &st) == 0 && tzfile_ino == st.st_ino && tzfile_dev == st.st_dev && tzfile_mtime == st.st_mtime) goto done; /* Nothing to do. */ @@ -164,7 +164,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap) goto ret_free_transitions; /* Get information about the file we are actually using. */ - if (fstat64 (__fileno (f), &st) != 0) + if (__fstat64 (__fileno (f), &st) != 0) goto lose; free ((void *) transitions); From patchwork Thu Jul 23 19:46:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40164 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 433F33846405; Thu, 23 Jul 2020 19:47:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 433F33846405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533634; bh=aN1p93T4oOA7eFnaBFh2ZyX8RPx92+Bs+HYLrBb71TA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jvYxGjeuKgiCD9FeIukXQXHg5Ahf6GbN5j10VH3mIV4RKA4lqKmV9vp447XJUGl51 dYswgGVnab+zLpaUfvuhMSms+WmvymuxfvCIgNoi0F1nyR+BUZd2iMoZEgH9+ZZWDi a8iIwUHvmHaDTiNs+kaCnOsVGlLgBK8CqndrQfnY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by sourceware.org (Postfix) with ESMTPS id 571333858D38 for ; Thu, 23 Jul 2020 19:47:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 571333858D38 Received: by mail-qt1-x82c.google.com with SMTP id g13so5285490qtv.8 for ; Thu, 23 Jul 2020 12:47:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aN1p93T4oOA7eFnaBFh2ZyX8RPx92+Bs+HYLrBb71TA=; b=CL7Yxe8LrJcymhMdR8EOVmkSrJD25bWdeOZesQqVx3MpxrGxyPAwXZ4xZFiBDH3Xb7 CRwcx9tWRznnLS+35hUrgovd10Qsxo1gNh/dYCXCy9XcPAold03ZO2/GFFO7KNBytVnk FkrwOdHYUIfU6Wwfr5zXbAPByZdJ2Pj+6/Gpz85jchUwUI4fxpZyUoBfhTx9FoKYi0uX boVrGzFFYITKhhQ+drdK5vCTsUycyVZHmpjOYdGxPFAHtT16nCW5Q5SsxdNSKiZuCcg2 dcJtxdZTvIkegn8B355BR+Q42dhff+uyuzyFIxo8skWbnxCl3XfjYcmgzuqQcQWfTD09 W34g== X-Gm-Message-State: AOAM531v09FOj6Mk+zgvpAKnRwC89OMCULQtiH/TjSYERB4k3ye0CjF3 CwYkszKjJn9r2NNsr4yG/wa7whW/1KY= X-Google-Smtp-Source: ABdhPJxHf8HewPGNNc5jZ+ZOiI050HuFBpc6F4BA9v9Un9v1yFDKooGXwdrFy+GMxuRzbt3iVRrU/w== X-Received: by 2002:ac8:4247:: with SMTP id r7mr5518921qtm.213.1595533623883; Thu, 23 Jul 2020 12:47:03 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:03 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 09/16] Remove stat wrapper functions, move them to exported symbols Date: Thu, 23 Jul 2020 16:46:34 -0300 Message-Id: <20200723194641.1949404-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64, fstatat, and fstatat64 static wrapper and add the symbol on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license is also change from LGPL to GPL. Internally the _STAT_VER* definitions are moved to a arch-specific xstatver.h file. The internal defines that redirects internals {f}stat{at} to their {f}xstat{at} counterparts are removed for Linux (!NO_RTLD_HIDDEN). Hurd still requires them since {f}stat{at} pulls extra objects that makes the loader build fail otherwise (I haven't dig into why exactly). Checked with a build for all affected Linux ABIs and Hurd. I checked also on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- include/sys/stat.h | 94 ++++++++----- io/Makefile | 4 +- io/Versions | 4 + io/fstat.c | 33 +---- io/fstat64.c | 36 +---- io/fstatat.c | 36 +---- io/fstatat64.c | 36 +---- io/lstat.c | 33 +---- io/lstat64.c | 36 +---- io/stat.c | 34 +---- io/stat64.c | 36 +---- io/sys/stat.h | 129 ------------------ nscd/gai.c | 5 + sysdeps/generic/xstatver.h | 3 + sysdeps/mach/hurd/i386/libc.abilist | 8 ++ sysdeps/posix/getaddrinfo.c | 2 +- sysdeps/unix/sysv/linux/aarch64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/alpha/bits/stat.h | 9 -- sysdeps/unix/sysv/linux/alpha/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/alpha/xstatver.h | 9 ++ sysdeps/unix/sysv/linux/arc/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/arm/le/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/bits/stat.h | 6 - sysdeps/unix/sysv/linux/csky/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/generic/bits/stat.h | 11 -- sysdeps/unix/sysv/linux/generic/xstatver.h | 5 + sysdeps/unix/sysv/linux/hppa/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/i386/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/ia64/bits/stat.h | 5 - sysdeps/unix/sysv/linux/ia64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/ia64/xstatver.h | 5 + sysdeps/unix/sysv/linux/m68k/bits/stat.h | 7 - .../unix/sysv/linux/m68k/m680x0/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/m68k/xstatver.h | 7 + .../sysv/linux/microblaze/be/libc.abilist | 8 ++ .../unix/sysv/linux/microblaze/bits/stat.h | 7 - sysdeps/unix/sysv/linux/microblaze/xstatver.h | 7 + sysdeps/unix/sysv/linux/mips/bits/stat.h | 7 - .../sysv/linux/mips/mips32/fpu/libc.abilist | 8 ++ .../sysv/linux/mips/mips64/n32/libc.abilist | 8 ++ .../sysv/linux/mips/mips64/n64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/mips/xstatver.h | 7 + sysdeps/unix/sysv/linux/nios2/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/powerpc/bits/stat.h | 11 -- .../linux/powerpc/powerpc32/fpu/libc.abilist | 8 ++ .../linux/powerpc/powerpc64/be/libc.abilist | 8 ++ .../linux/powerpc/powerpc64/le/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/powerpc/xstatver.h | 11 ++ .../unix/sysv/linux/riscv/rv64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/s390/bits/stat.h | 12 -- .../unix/sysv/linux/s390/s390-32/libc.abilist | 8 ++ .../unix/sysv/linux/s390/s390-64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/s390/xstatver.h | 16 +++ sysdeps/unix/sysv/linux/sh/le/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/sparc/bits/stat.h | 7 - .../sysv/linux/sparc/sparc32/libc.abilist | 8 ++ .../sysv/linux/sparc/sparc64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/sparc/xstatver.h | 7 + sysdeps/unix/sysv/linux/x86/bits/stat.h | 10 -- sysdeps/unix/sysv/linux/x86/xstatver.h | 13 ++ .../unix/sysv/linux/x86_64/64/libc.abilist | 8 ++ .../unix/sysv/linux/x86_64/x32/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/xstatver.h | 7 + 63 files changed, 414 insertions(+), 501 deletions(-) create mode 100644 sysdeps/generic/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/alpha/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/generic/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/ia64/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/m68k/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/microblaze/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/mips/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/powerpc/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/s390/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/sparc/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/x86/xstatver.h create mode 100644 sysdeps/unix/sysv/linux/xstatver.h diff --git a/include/sys/stat.h b/include/sys/stat.h index f8847cf73e..0be918a7a7 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -2,10 +2,26 @@ #include #ifndef _ISOMAC +# include + /* Now define the internal interfaces. */ extern int __stat (const char *__file, struct stat *__buf); +extern int __stat64 (const char *__file, struct stat64 *__buf); extern int __fstat (int __fd, struct stat *__buf); +extern int __fstat64 (int __fd, struct stat64 *__buf); extern int __lstat (const char *__file, struct stat *__buf); +extern int __lstat64 (const char *__file, struct stat64 *__buf); +extern int __fstatat (int dirfd, const char *pathname, struct stat *buf, + int flags); +extern int __fstatat64 (int dirfd, const char *pathname, struct stat64 *buf, + int flags); +# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN) +hidden_proto (__stat64) +hidden_proto (__fstat64) +hidden_proto (__lstat64) +hidden_proto (__fstatat64) +# endif + extern int __chmod (const char *__file, __mode_t __mode); libc_hidden_proto (__chmod) extern int __fchmod (int __fd, __mode_t __mode); @@ -13,20 +29,9 @@ libc_hidden_proto (fchmodat) extern __mode_t __umask (__mode_t __mask); extern int __mkdir (const char *__path, __mode_t __mode); libc_hidden_proto (__mkdir) + extern int __mknod (const char *__path, __mode_t __mode, __dev_t __dev); -#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN) -hidden_proto (__fxstat) -hidden_proto (__fxstat64) -hidden_proto (__lxstat) -hidden_proto (__lxstat64) -hidden_proto (__xstat) -hidden_proto (__xstat64) -#endif -extern __inline__ int __stat (const char *__path, struct stat *__statbuf) -{ - return __xstat (_STAT_VER, __path, __statbuf); -} libc_hidden_proto (__xmknod) extern __inline__ int __mknod (const char *__path, __mode_t __mode, __dev_t __dev) @@ -35,32 +40,47 @@ extern __inline__ int __mknod (const char *__path, __mode_t __mode, } libc_hidden_proto (__xmknodat) -libc_hidden_proto (__fxstatat) -libc_hidden_proto (__fxstatat64) - -# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN -extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden; +int __fxstat (int __ver, int __fildes, struct stat *__stat_buf); +int __xstat (int __ver, const char *__filename, + struct stat *__stat_buf); +int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf); +int __fxstatat (int __ver, int __fildes, const char *__filename, + struct stat *__stat_buf, int __flag); +int __fxstat64 (int ver, int __fildes, struct stat64 *__stat_buf); +int __xstat64 (int ver, const char *__filename, struct stat64 *__stat_buf); +int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf); +int __fxstatat64 (int ver, int __fildes, const char *__filename, + struct stat64 *__stat_buf, int __flag); +libc_hidden_proto (__fxstat); +libc_hidden_proto (__xstat); +libc_hidden_proto (__lxstat); +libc_hidden_proto (__fxstatat); +# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN) +hidden_proto (__fxstat64); +hidden_proto (__xstat64); +hidden_proto (__lxstat64); +hidden_proto (__fxstatat64); # endif -/* The `stat', `fstat', `lstat' functions have to be handled special since - even while not compiling the library with optimization calls to these - functions in the shared library must reference the `xstat' etc functions. - We have to use macros but we cannot define them in the normal headers - since on user level we must use real functions. */ -#define stat(fname, buf) __xstat (_STAT_VER, fname, buf) -#define lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) -#define __lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) -#define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) -#define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) -#define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) -#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) -#define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) -#define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) -#define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) -#define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) -#define __fstatat(dfd, fname, buf, flag) \ - __fxstatat (_STAT_VER, dfd, fname, buf, flag) -#define __fstatat64(dfd, fname, buf, flag) \ - __fxstatat64 (_STAT_VER, dfd, fname, buf, flag) +# ifdef NO_RTLD_HIDDEN +/* These are still required for Hurd. */ +# define stat(fname, buf) __xstat (_STAT_VER, fname, buf) +# define lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) +# define __lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) +# define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) +# define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf) +# define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) +# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) +# define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) +# define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) +# define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) +# define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) +# define __fstatat(dfd, fname, buf, flag) \ + __fxstatat (_STAT_VER, dfd, fname, buf, flag) +# define __fstatat64(dfd, fname, buf, flag) \ + __fxstatat64 (_STAT_VER, dfd, fname, buf, flag) +# endif /* NO_RTLD_HIDDEN */ + #endif + #endif diff --git a/io/Makefile b/io/Makefile index cf380f3516..cee356b666 100644 --- a/io/Makefile +++ b/io/Makefile @@ -60,8 +60,7 @@ routines := \ # These routines will be omitted from the libc shared object. # Instead the static object files will be included in a special archive # linked against when the shared library will be used. -static-only-routines = stat fstat lstat stat64 fstat64 lstat64 \ - fstatat fstatat64 mknod mknodat +static-only-routines = mknod mknodat others := pwd test-srcs := ftwtest @@ -78,6 +77,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ # Likewise for statx, but we do not need static linking here. tests-internal += tst-statx +tests-static += tst-statx ifeq ($(run-built-tests),yes) tests-special += $(objpfx)ftwtest.out diff --git a/io/Versions b/io/Versions index ee468055ff..f6db0e84ad 100644 --- a/io/Versions +++ b/io/Versions @@ -132,6 +132,9 @@ libc { fcntl64; statx; } + GLIBC_2.33 { + stat; stat64; fstat; fstat64; lstat; lstat64; fstatat; fstatat64; + } GLIBC_PRIVATE { __libc_fcntl64; __fcntl_nocancel; @@ -141,5 +144,6 @@ libc { __file_change_detection_for_stat; __file_change_detection_for_path; __file_change_detection_for_fp; + __fstat64; } } diff --git a/io/fstat.c b/io/fstat.c index 6ce077dc4a..faadd75e31 100644 --- a/io/fstat.c +++ b/io/fstat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 1996-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,22 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef fstat #undef __fstat int -attribute_hidden __fstat (int fd, struct stat *buf) { return __fxstat (_STAT_VER, fd, buf); } -weak_hidden_alias (__fstat, fstat) +weak_alias (__fstat, fstat) diff --git a/io/fstat64.c b/io/fstat64.c index c4dd3acd60..b1fc17e5bf 100644 --- a/io/fstat64.c +++ b/io/fstat64.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 1996-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,19 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef fstat64 +#undef __fstat64 int -attribute_hidden -fstat64 (int fd, struct stat64 *buf) +__fstat64 (int fd, struct stat64 *buf) { return __fxstat64 (_STAT_VER, fd, buf); } +hidden_def (__fstat64) +weak_alias (__fstat64, fstat64) diff --git a/io/fstatat.c b/io/fstatat.c index edc773487a..12443c2ff4 100644 --- a/io/fstatat.c +++ b/io/fstatat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 2005-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,19 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef fstatat +#undef __fstatat int -attribute_hidden -fstatat (int fd, const char *file, struct stat *buf, int flag) +__fstatat (int fd, const char *file, struct stat *buf, int flag) { return __fxstatat (_STAT_VER, fd, file, buf, flag); } + +weak_alias (__fstatat, fstatat) diff --git a/io/fstatat64.c b/io/fstatat64.c index b57133bd90..5ba4cdf68a 100644 --- a/io/fstatat64.c +++ b/io/fstatat64.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 2005-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,19 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef fstatat64 +#undef __fstatat64 int -attribute_hidden -fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) +__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) { return __fxstatat64 (_STAT_VER, fd, file, buf, flag); } +hidden_def (__fstatat64) +weak_alias (__fstatat64, fstatat64) diff --git a/io/lstat.c b/io/lstat.c index 7134741106..2a046c05e1 100644 --- a/io/lstat.c +++ b/io/lstat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 1996-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,22 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef lstat #undef __lstat int -attribute_hidden __lstat (const char *file, struct stat *buf) { return __lxstat (_STAT_VER, file, buf); } -weak_hidden_alias (__lstat, lstat) +weak_alias (__lstat, lstat) diff --git a/io/lstat64.c b/io/lstat64.c index a890da71a8..a73c5a2541 100644 --- a/io/lstat64.c +++ b/io/lstat64.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 1996-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,19 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef lstat64 +#undef __lstat64 int -attribute_hidden -lstat64 (const char *file, struct stat64 *buf) +__lstat64 (const char *file, struct stat64 *buf) { return __lxstat64 (_STAT_VER, file, buf); } +hidden_def (__lstat64) +weak_alias (__lstat64, lstat64) diff --git a/io/stat.c b/io/stat.c index 8c3cd877c8..b3d06107e3 100644 --- a/io/stat.c +++ b/io/stat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 1996-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,21 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef stat +#undef __stat int -attribute_hidden __stat (const char *file, struct stat *buf) { return __xstat (_STAT_VER, file, buf); } -weak_hidden_alias (__stat, stat) +weak_alias (__stat, stat) diff --git a/io/stat64.c b/io/stat64.c index 8b6b662f3a..41e8905c4e 100644 --- a/io/stat64.c +++ b/io/stat64.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Get file status. + Copyright (C) 1996-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -34,19 +18,11 @@ #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - -#undef stat64 +#undef __stat64 int -attribute_hidden -stat64 (const char *file, struct stat64 *buf) +__stat64 (const char *file, struct stat64 *buf) { return __xstat64 (_STAT_VER, file, buf); } +hidden_def (__stat64) +weak_alias (__stat64, stat64) diff --git a/io/sys/stat.h b/io/sys/stat.h index ce014d03a5..83cf253c72 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -368,73 +368,10 @@ extern int utimensat (int __fd, const char *__path, extern int futimens (int __fd, const struct timespec __times[2]) __THROW; #endif -/* To allow the `struct stat' structure and the file type `mode_t' - bits to vary without changing shared library major version number, - the `stat' family of functions and `mknod' are in fact inline - wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', - which all take a leading version-number argument designating the - data structure and bits used. defines _STAT_VER with - the version number corresponding to `struct stat' as defined in - that file; and _MKNOD_VER with the version number corresponding to - the S_IF* macros defined therein. It is arranged that when not - inlined these function are always statically linked; that way a - dynamically-linked executable always encodes the version number - corresponding to the data structures it uses, so the `x' functions - in the shared library can adapt without needing to recompile all - callers. */ - -#ifndef _STAT_VER -# define _STAT_VER 0 -#endif #ifndef _MKNOD_VER # define _MKNOD_VER 0 #endif -/* Wrappers for stat and mknod system calls. */ -#ifndef __USE_FILE_OFFSET64 -extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat (int __ver, int __fildes, const char *__filename, - struct stat *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, - struct stat *__stat_buf), __fxstat64) - __nonnull ((3)); -extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __xstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __lxstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, - const char *__filename, - struct stat *__stat_buf, int __flag), - __fxstatat64) __nonnull ((3, 4)); - -# else -# define __fxstat __fxstat64 -# define __xstat __xstat64 -# define __lxstat __lxstat64 -# endif -#endif - -#ifdef __USE_LARGEFILE64 -extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat64 (int __ver, int __fildes, const char *__filename, - struct stat64 *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#endif extern int __xmknod (int __ver, const char *__path, __mode_t __mode, __dev_t *__dev) __THROW __nonnull ((2, 4)); @@ -447,37 +384,6 @@ extern int __xmknodat (int __ver, int __fd, const char *__path, #endif #ifdef __USE_EXTERN_INLINES -/* Inlined versions of the real stat and mknod functions. */ - -__extern_inline int -__NTH (stat (const char *__path, struct stat *__statbuf)) -{ - return __xstat (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -__extern_inline int -__NTH (lstat (const char *__path, struct stat *__statbuf)) -{ - return __lxstat (_STAT_VER, __path, __statbuf); -} -# endif - -__extern_inline int -__NTH (fstat (int __fd, struct stat *__statbuf)) -{ - return __fxstat (_STAT_VER, __fd, __statbuf); -} - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf, - int __flag)) -{ - return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - # ifdef __USE_MISC __extern_inline int __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) @@ -494,41 +400,6 @@ __NTH (mknodat (int __fd, const char *__path, __mode_t __mode, return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); } # endif - -# if defined __USE_LARGEFILE64 \ - && (! defined __USE_FILE_OFFSET64 \ - || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) -__extern_inline int -__NTH (stat64 (const char *__path, struct stat64 *__statbuf)) -{ - return __xstat64 (_STAT_VER, __path, __statbuf); -} - -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED -__extern_inline int -__NTH (lstat64 (const char *__path, struct stat64 *__statbuf)) -{ - return __lxstat64 (_STAT_VER, __path, __statbuf); -} -# endif - -__extern_inline int -__NTH (fstat64 (int __fd, struct stat64 *__statbuf)) -{ - return __fxstat64 (_STAT_VER, __fd, __statbuf); -} - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf, - int __flag)) -{ - return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag); -} -# endif - -# endif - #endif __END_DECLS diff --git a/nscd/gai.c b/nscd/gai.c index 2e19530102..b0058bc873 100644 --- a/nscd/gai.c +++ b/nscd/gai.c @@ -16,6 +16,7 @@ along with this program; if not, see . */ #include +#include /* This file uses the getaddrinfo code but it compiles it without NSCD support. We just need a few symbol renames. */ @@ -32,6 +33,10 @@ #define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF) #define __getifaddrs getifaddrs #define __freeifaddrs freeifaddrs +#undef __fstat64 +#define __fstat64 fstat64 +#undef __stat64 +#define __stat64 stat64 /* We are nscd, so we don't want to be talking to ourselves. */ #undef USE_NSCD diff --git a/sysdeps/generic/xstatver.h b/sysdeps/generic/xstatver.h new file mode 100644 index 0000000000..d727c98a16 --- /dev/null +++ b/sysdeps/generic/xstatver.h @@ -0,0 +1,3 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER 0 diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 5f6154d518..74a4ed5c1d 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -2192,6 +2192,14 @@ GLIBC_2.32 thrd_current F GLIBC_2.32 thrd_equal F GLIBC_2.32 thrd_sleep F GLIBC_2.32 thrd_yield F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 82c898fe35..ad4923ddbc 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -2138,7 +2138,7 @@ static void gaiconf_reload (void) { struct stat64 st; - if (stat64 (GAICONF_FNAME, &st) != 0 + if (__stat64 (GAICONF_FNAME, &st) != 0 || !check_gaiconf_mtime (&st)) gaiconf_init (); } diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index 6cd61988b4..03e4ae9296 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2160,3 +2160,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h index 0064ca09ff..1fc27936b9 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h @@ -22,15 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_GLIBC2 1 -#define _STAT_VER_GLIBC2_1 2 -#define _STAT_VER_KERNEL64 3 -#define _STAT_VER_GLIBC2_3_4 3 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 0 diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 8edb5deea1..5b752ef4a8 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -2242,6 +2242,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F GLIBC_2.4 _IO_printf F GLIBC_2.4 _IO_sprintf F diff --git a/sysdeps/unix/sysv/linux/alpha/xstatver.h b/sysdeps/unix/sysv/linux/alpha/xstatver.h new file mode 100644 index 0000000000..bbb9469617 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/xstatver.h @@ -0,0 +1,9 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_KERNEL 0 +#define _STAT_VER_GLIBC2 1 +#define _STAT_VER_GLIBC2_1 2 +#define _STAT_VER_KERNEL64 3 +#define _STAT_VER_GLIBC2_3_4 3 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist index df13f49e15..925b532383 100644 --- a/sysdeps/unix/sysv/linux/arc/libc.abilist +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist @@ -1920,3 +1920,11 @@ GLIBC_2.32 wprintf F GLIBC_2.32 write F GLIBC_2.32 writev F GLIBC_2.32 wscanf F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist index a83cc81958..a4c1a7c03c 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist @@ -141,6 +141,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 _Exit F GLIBC_2.4 _IO_2_1_stderr_ D 0xa0 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0 diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h index 240628a6f4..b542623208 100644 --- a/sysdeps/unix/sysv/linux/bits/stat.h +++ b/sysdeps/unix/sysv/linux/bits/stat.h @@ -23,12 +23,6 @@ #define _BITS_STAT_H 1 /* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist index 32887b1c58..799873e189 100644 --- a/sysdeps/unix/sysv/linux/csky/libc.abilist +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist @@ -2104,3 +2104,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h index 8d0980f0f5..35e14a47c6 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h @@ -26,17 +26,6 @@ #include #include -/* 64-bit libc uses the kernel's 'struct stat', accessed via the - stat() syscall; 32-bit libc uses the kernel's 'struct stat64' - and accesses it via the stat64() syscall. All the various - APIs offered by libc use the kernel shape for their struct stat - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (specifically st_ino, st_size, and st_blocks). */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_LINUX 0 -#define _STAT_VER _STAT_VER_KERNEL - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 0 diff --git a/sysdeps/unix/sysv/linux/generic/xstatver.h b/sysdeps/unix/sysv/linux/generic/xstatver.h new file mode 100644 index 0000000000..8675db494c --- /dev/null +++ b/sysdeps/unix/sysv/linux/generic/xstatver.h @@ -0,0 +1,5 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_KERNEL 0 +#define _STAT_VER_LINUX 0 +#define _STAT_VER _STAT_VER_KERNEL diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist index baf425072b..95c7bf4f06 100644 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -2063,6 +2063,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist index 8b0242a9b1..e7cf5cdb98 100644 --- a/sysdeps/unix/sysv/linux/i386/libc.abilist +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -2229,6 +2229,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/sysdeps/unix/sysv/linux/ia64/bits/stat.h index 608e988ae6..8ec2e4c81f 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/stat.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/stat.h @@ -22,11 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_LINUX 1 -#define _STAT_VER _STAT_VER_LINUX - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 0 diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist index b6ba86dbe9..beeb905efd 100644 --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist @@ -2095,6 +2095,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/ia64/xstatver.h b/sysdeps/unix/sysv/linux/ia64/xstatver.h new file mode 100644 index 0000000000..4f02f697ad --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/xstatver.h @@ -0,0 +1,5 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_KERNEL 0 +#define _STAT_VER_LINUX 1 +#define _STAT_VER _STAT_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/sysdeps/unix/sysv/linux/m68k/bits/stat.h index 453dcac709..bf41776e6c 100644 --- a/sysdeps/unix/sysv/linux/m68k/bits/stat.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/stat.h @@ -22,13 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index 2d726097ca..ed34e1fc82 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -2175,6 +2175,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/m68k/xstatver.h b/sysdeps/unix/sysv/linux/m68k/xstatver.h new file mode 100644 index 0000000000..59dba71dd1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/m68k/xstatver.h @@ -0,0 +1,7 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist index 7c78649e03..e00f5115b2 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist @@ -2155,3 +2155,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h index c5817e5b77..51316a8c1b 100644 --- a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h +++ b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h @@ -23,13 +23,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 diff --git a/sysdeps/unix/sysv/linux/microblaze/xstatver.h b/sysdeps/unix/sysv/linux/microblaze/xstatver.h new file mode 100644 index 0000000000..bddaa0d5ec --- /dev/null +++ b/sysdeps/unix/sysv/linux/microblaze/xstatver.h @@ -0,0 +1,7 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h index b0e6726655..cfeb4ce6a4 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/stat.h +++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h @@ -24,13 +24,6 @@ #include -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index 9fa655b3a5..fe9ba4e982 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -2146,6 +2146,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index de990933cf..e67591e710 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -2152,6 +2152,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist index 754491f209..e4eb9e6bbf 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist @@ -2146,6 +2146,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/mips/xstatver.h b/sysdeps/unix/sysv/linux/mips/xstatver.h new file mode 100644 index 0000000000..59dba71dd1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/xstatver.h @@ -0,0 +1,7 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist index 36a875115c..0878998441 100644 --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist @@ -2193,3 +2193,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h index 61781bd902..40ea9a96d4 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h @@ -24,17 +24,6 @@ #include -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#if __WORDSIZE == 32 -# define _STAT_VER _STAT_VER_LINUX -#else -# define _STAT_VER _STAT_VER_KERNEL -#endif - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index 6de9bed51d..993c957e8e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@ -2202,6 +2202,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F GLIBC_2.4 _IO_printf F GLIBC_2.4 _IO_sprintf F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist index 92114806ac..25a8e828e9 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist @@ -2065,6 +2065,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F GLIBC_2.4 _IO_printf F GLIBC_2.4 _IO_sprintf F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist index b01fdcfae1..46ae28e552 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist @@ -2355,3 +2355,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/powerpc/xstatver.h b/sysdeps/unix/sysv/linux/powerpc/xstatver.h new file mode 100644 index 0000000000..1656e2f7e4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/xstatver.h @@ -0,0 +1,11 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#if __WORDSIZE == 32 +# define _STAT_VER _STAT_VER_LINUX +#else +# define _STAT_VER _STAT_VER_KERNEL +#endif diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist index 45cbeb1d98..1044aa6be2 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist @@ -2122,3 +2122,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/s390/bits/stat.h b/sysdeps/unix/sysv/linux/s390/bits/stat.h index b383a98692..d12055529a 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/stat.h +++ b/sysdeps/unix/sysv/linux/s390/bits/stat.h @@ -25,21 +25,9 @@ #include #if __WORDSIZE == 64 -/* Versions of the `struct stat' data structure. */ -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 -# define _STAT_VER _STAT_VER_LINUX - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 0 #else -/* Versions of the `struct stat' data structure. */ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 -# define _STAT_VER _STAT_VER_LINUX - /* Versions of the `xmknod' interface. */ # define _MKNOD_VER_LINUX 1 # define _MKNOD_VER_SVR4 2 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist index d0752dba6c..6b1fa7e67f 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -2200,6 +2200,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F GLIBC_2.4 _IO_printf F GLIBC_2.4 _IO_sprintf F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist index af5f14d1c6..0aec094e7b 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist @@ -2101,6 +2101,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F GLIBC_2.4 _IO_printf F GLIBC_2.4 _IO_sprintf F diff --git a/sysdeps/unix/sysv/linux/s390/xstatver.h b/sysdeps/unix/sysv/linux/s390/xstatver.h new file mode 100644 index 0000000000..5ad0db2797 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/xstatver.h @@ -0,0 +1,16 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ + +#include + +#if __WORDSIZE == 64 +# define _STAT_VER_KERNEL 0 +# define _STAT_VER_LINUX 1 +# define _STAT_VER _STAT_VER_LINUX +#else +# define _STAT_VER_LINUX_OLD 1 +# define _STAT_VER_KERNEL 1 +# define _STAT_VER_SVR4 2 +# define _STAT_VER_LINUX 3 +# define _STAT_VER _STAT_VER_LINUX +#endif diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index 182970a708..e2ae13d4fa 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -2067,6 +2067,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/sysdeps/unix/sysv/linux/sparc/bits/stat.h index 7379f2232d..7af17b5c40 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/stat.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/stat.h @@ -22,13 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index a2521c3ee3..886e01960f 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -2191,6 +2191,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F GLIBC_2.4 _IO_printf F GLIBC_2.4 _IO_sprintf F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist index d8188903f9..33b068201a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist @@ -2118,6 +2118,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/sparc/xstatver.h b/sysdeps/unix/sysv/linux/sparc/xstatver.h new file mode 100644 index 0000000000..ae92b530e7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/xstatver.h @@ -0,0 +1,7 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ diff --git a/sysdeps/unix/sysv/linux/x86/bits/stat.h b/sysdeps/unix/sysv/linux/x86/bits/stat.h index 25dec69dda..f132569e9d 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/stat.h +++ b/sysdeps/unix/sysv/linux/x86/bits/stat.h @@ -24,25 +24,15 @@ /* Versions of the `struct stat' data structure. */ #ifndef __x86_64__ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 - /* i386 versions of the `xmknod' interface. */ # define _MKNOD_VER_LINUX 1 # define _MKNOD_VER_SVR4 2 # define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ #else -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 - /* x86-64 versions of the `xmknod' interface. */ # define _MKNOD_VER_LINUX 0 #endif -#define _STAT_VER _STAT_VER_LINUX - struct stat { __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/x86/xstatver.h b/sysdeps/unix/sysv/linux/x86/xstatver.h new file mode 100644 index 0000000000..6f047a346d --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86/xstatver.h @@ -0,0 +1,13 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#ifndef __x86_64__ +# define _STAT_VER_LINUX_OLD 1 +# define _STAT_VER_KERNEL 1 +# define _STAT_VER_SVR4 2 +# define _STAT_VER_LINUX 3 +#else +# define _STAT_VER_KERNEL 0 +# define _STAT_VER_LINUX 1 +#endif +#define _STAT_VER _STAT_VER_LINUX + diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist index 1a96103c68..f767bdde24 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist @@ -2076,6 +2076,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist index 35745a75b6..535862a51e 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist @@ -2173,3 +2173,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F +GLIBC_2.33 fstat F +GLIBC_2.33 fstat64 F +GLIBC_2.33 fstatat F +GLIBC_2.33 fstatat64 F +GLIBC_2.33 lstat F +GLIBC_2.33 lstat64 F +GLIBC_2.33 stat F +GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/xstatver.h b/sysdeps/unix/sysv/linux/xstatver.h new file mode 100644 index 0000000000..59dba71dd1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/xstatver.h @@ -0,0 +1,7 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX From patchwork Thu Jul 23 19:46:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40162 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AB653858D38; Thu, 23 Jul 2020 19:47:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AB653858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533632; bh=WnC4Pieyrihw+WSAu4+dESafGmw7T6CnHE4JjwkW+LE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=rMta6gaV6jXs5wxJhln6SXXh7qDHvQ5J1+tu0FpU4x4JjQyUrr0xmATH97eOqsBGR 8m1v9UGlNDiuft1NuCUyU6lzCeOFR+FAxtlXLiaqDoz58oBuu4SKq6YiwuEFvSktbn JtVVA1y9J0EgFdvt2j0P/Eh3wMyC+KG5zFRIE68w= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by sourceware.org (Postfix) with ESMTPS id A0748384404D for ; Thu, 23 Jul 2020 19:47:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A0748384404D Received: by mail-qv1-xf34.google.com with SMTP id t7so3114070qvl.8 for ; Thu, 23 Jul 2020 12:47:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WnC4Pieyrihw+WSAu4+dESafGmw7T6CnHE4JjwkW+LE=; b=YqgRcIjIxXNk0DIGo96Er7cWXxk01Q/jGLJMBCCuE+C9F/TFWUDANGhMDZaGkUg/m/ +2DxZ50O/To2cn5jFXZOTkejOwCgIJ1YxhTR1TFT/1ZAYz786h6qFZBh0Tvta3wm9zld WklovwErpg6yrRU/Sr8M1fbVLWKm/SER86ptWJa0LgalrUvaHWPiQaSWOJtg8U4ceY/4 UlWxqrF15UFP9UpnVKyrpup8GoNYpnWmnm4V0MVTuSsa52qemd9kVTZOgD3xODK9coZ1 My/Y83brqkXfWG4/B6N7RPjBokDaFq+9cVxeI1zuwbIVcTUIe/NXSLJLG02cArbIA1Et /+Kw== X-Gm-Message-State: AOAM533U4TqWGg3lVlqxKaNpNMPcFw/Ut2Ovc6wFrgDebcqrhtsyJIvO v5lScokCG6p+EIHX1pUH38/oMHQ3BXU= X-Google-Smtp-Source: ABdhPJw5q6hBB8/v06UQbei4r0FKm/jOd7gJFUWVLV83lnWMV/4PoRQ1NV4gEUCgqAMFUV/5VCmmVQ== X-Received: by 2002:ad4:4bb0:: with SMTP id i16mr6514797qvw.42.1595533625548; Thu, 23 Jul 2020 12:47:05 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:05 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 10/16] Remove mknod wrapper functions, move them to symbols Date: Thu, 23 Jul 2020 16:46:35 -0300 Message-Id: <20200723194641.1949404-11-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This patch removes the mknod and mknodat static wrapper and add the symbols on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license is also change from LGPL to GPL. Internally the _STAT_VER* definitions are moved to the arch-specific xstatver.h file. Checked with a build for all affected Linux ABIs and Hurd. I checked also on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- include/sys/stat.h | 13 ++++--- io/Makefile | 5 --- io/Versions | 1 + io/mknod.c | 35 +++---------------- io/mknodat.c | 35 +++---------------- io/sys/stat.h | 30 ---------------- sysdeps/generic/xstatver.h | 1 + sysdeps/mach/hurd/i386/libc.abilist | 2 ++ sysdeps/posix/mkfifo.c | 3 +- sysdeps/posix/mkfifoat.c | 3 +- sysdeps/unix/sysv/linux/aarch64/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/alpha/bits/stat.h | 4 --- sysdeps/unix/sysv/linux/alpha/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/alpha/xstatver.h | 5 +++ sysdeps/unix/sysv/linux/arc/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/arm/le/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/bits/stat.h | 7 ---- sysdeps/unix/sysv/linux/csky/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/generic/bits/stat.h | 3 -- sysdeps/unix/sysv/linux/generic/xstatver.h | 5 +++ sysdeps/unix/sysv/linux/hppa/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/i386/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/ia64/bits/stat.h | 3 -- sysdeps/unix/sysv/linux/ia64/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/ia64/xstatver.h | 5 +++ sysdeps/unix/sysv/linux/m68k/bits/stat.h | 6 ---- .../unix/sysv/linux/m68k/m680x0/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/m68k/xstatver.h | 6 ++++ .../sysv/linux/microblaze/be/libc.abilist | 2 ++ .../unix/sysv/linux/microblaze/bits/stat.h | 5 --- sysdeps/unix/sysv/linux/microblaze/xstatver.h | 6 ++++ sysdeps/unix/sysv/linux/mips/bits/stat.h | 5 --- .../sysv/linux/mips/mips32/fpu/libc.abilist | 2 ++ .../sysv/linux/mips/mips64/n32/libc.abilist | 2 ++ .../sysv/linux/mips/mips64/n64/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/mips/xstatver.h | 6 ++++ sysdeps/unix/sysv/linux/nios2/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/powerpc/bits/stat.h | 5 --- .../linux/powerpc/powerpc32/fpu/libc.abilist | 2 ++ .../linux/powerpc/powerpc64/be/libc.abilist | 2 ++ .../linux/powerpc/powerpc64/le/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/powerpc/xstatver.h | 6 ++++ .../unix/sysv/linux/riscv/rv64/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/s390/bits/stat.h | 10 ------ .../unix/sysv/linux/s390/s390-32/libc.abilist | 2 ++ .../unix/sysv/linux/s390/s390-64/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/s390/xstatver.h | 6 +++- sysdeps/unix/sysv/linux/sh/le/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/sparc/bits/stat.h | 6 ---- .../sysv/linux/sparc/sparc32/libc.abilist | 2 ++ .../sysv/linux/sparc/sparc64/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/sparc/xstatver.h | 6 ++++ sysdeps/unix/sysv/linux/x86/bits/stat.h | 11 ------ sysdeps/unix/sysv/linux/x86/xstatver.h | 5 ++- .../unix/sysv/linux/x86_64/64/libc.abilist | 2 ++ .../unix/sysv/linux/x86_64/x32/libc.abilist | 2 ++ sysdeps/unix/sysv/linux/xstatver.h | 6 ++++ 57 files changed, 133 insertions(+), 172 deletions(-) diff --git a/include/sys/stat.h b/include/sys/stat.h index 0be918a7a7..04b825df4a 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -30,14 +30,17 @@ extern __mode_t __umask (__mode_t __mask); extern int __mkdir (const char *__path, __mode_t __mode); libc_hidden_proto (__mkdir) +extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev); +libc_hidden_proto (__mknodat); extern int __mknod (const char *__path, __mode_t __mode, __dev_t __dev); +libc_hidden_proto (__mknod); + +extern int __xmknod (int __ver, const char *__path, __mode_t __mode, + __dev_t *__dev); libc_hidden_proto (__xmknod) -extern __inline__ int __mknod (const char *__path, __mode_t __mode, - __dev_t __dev) -{ - return __xmknod (_MKNOD_VER, __path, __mode, &__dev); -} +extern int __xmknodat (int __ver, int __fd, const char *__path, + __mode_t __mode, __dev_t *__dev); libc_hidden_proto (__xmknodat) int __fxstat (int __ver, int __fildes, struct stat *__stat_buf); diff --git a/io/Makefile b/io/Makefile index cee356b666..2ed86c530e 100644 --- a/io/Makefile +++ b/io/Makefile @@ -57,11 +57,6 @@ routines := \ sendfile sendfile64 copy_file_range \ utimensat futimens file_change_detection -# These routines will be omitted from the libc shared object. -# Instead the static object files will be included in a special archive -# linked against when the shared library will be used. -static-only-routines = mknod mknodat - others := pwd test-srcs := ftwtest tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \ diff --git a/io/Versions b/io/Versions index f6db0e84ad..49c4d2d40a 100644 --- a/io/Versions +++ b/io/Versions @@ -134,6 +134,7 @@ libc { } GLIBC_2.33 { stat; stat64; fstat; fstat64; lstat; lstat64; fstatat; fstatat64; + mknod; mknodat; } GLIBC_PRIVATE { __libc_fcntl64; diff --git a/io/mknod.c b/io/mknod.c index ac96829230..7f88633198 100644 --- a/io/mknod.c +++ b/io/mknod.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Create a special or ordinary file. + Copyright (C) 1995-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -32,24 +16,13 @@ License along with the GNU C Library; if not, see . */ - #include #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - int -attribute_hidden __mknod (const char *path, mode_t mode, dev_t dev) { return __xmknod (_MKNOD_VER, path, mode, &dev); } - -weak_hidden_alias (__mknod, mknod) +libc_hidden_def (__mknod) +weak_alias (__mknod, mknod) diff --git a/io/mknodat.c b/io/mknodat.c index 65c9f1aa9c..6ec1c1648c 100644 --- a/io/mknodat.c +++ b/io/mknodat.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Create a special or ordinary file. + Copyright (C) 1995-2020 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 @@ -6,23 +7,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - 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 @@ -32,22 +16,13 @@ License along with the GNU C Library; if not, see . */ - #include #include -/* This definition is only used if inlining fails for this function; see - the last page of . The real work is done by the `x' - function which is passed a version number argument. We arrange in the - makefile that when not inlined this function is always statically - linked; that way a dynamically-linked executable always encodes the - version number corresponding to the data structures it uses, so the `x' - functions in the shared library can adapt without needing to recompile - all callers. */ - int -attribute_hidden -mknodat (int fd, const char *path, mode_t mode, dev_t dev) +__mknodat (int fd, const char *path, mode_t mode, dev_t dev) { return __xmknodat (_MKNOD_VER, fd, path, mode, &dev); } +libc_hidden_def (__mknodat) +weak_alias (__mknodat, mknodat) diff --git a/io/sys/stat.h b/io/sys/stat.h index 83cf253c72..58c3770622 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -367,41 +367,11 @@ extern int utimensat (int __fd, const char *__path, /* Set file access and modification times of the file associated with FD. */ extern int futimens (int __fd, const struct timespec __times[2]) __THROW; #endif - -#ifndef _MKNOD_VER -# define _MKNOD_VER 0 -#endif - -extern int __xmknod (int __ver, const char *__path, __mode_t __mode, - __dev_t *__dev) __THROW __nonnull ((2, 4)); - -extern int __xmknodat (int __ver, int __fd, const char *__path, - __mode_t __mode, __dev_t *__dev) - __THROW __nonnull ((3, 5)); #ifdef __USE_GNU # include #endif -#ifdef __USE_EXTERN_INLINES -# ifdef __USE_MISC -__extern_inline int -__NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) -{ - return __xmknod (_MKNOD_VER, __path, __mode, &__dev); -} -# endif - -# ifdef __USE_ATFILE -__extern_inline int -__NTH (mknodat (int __fd, const char *__path, __mode_t __mode, - __dev_t __dev)) -{ - return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); -} -# endif -#endif - __END_DECLS diff --git a/sysdeps/generic/xstatver.h b/sysdeps/generic/xstatver.h index d727c98a16..281013b2f1 100644 --- a/sysdeps/generic/xstatver.h +++ b/sysdeps/generic/xstatver.h @@ -1,3 +1,4 @@ /* Versions of the 'struct stat' data structure used in compatibility xstat functions. */ #define _STAT_VER 0 +#define _MKNOD_VER 0 diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 74a4ed5c1d..b4e39285d0 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -2198,6 +2198,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/posix/mkfifo.c b/sysdeps/posix/mkfifo.c index 61f62e2e96..0b89f6c291 100644 --- a/sysdeps/posix/mkfifo.c +++ b/sysdeps/posix/mkfifo.c @@ -24,6 +24,5 @@ int mkfifo (const char *path, mode_t mode) { - dev_t dev = 0; - return __xmknod (_MKNOD_VER, path, mode | S_IFIFO, &dev); + return __mknod (path, mode | S_IFIFO, 0); } diff --git a/sysdeps/posix/mkfifoat.c b/sysdeps/posix/mkfifoat.c index 5287fe8782..d1e0977ba1 100644 --- a/sysdeps/posix/mkfifoat.c +++ b/sysdeps/posix/mkfifoat.c @@ -23,6 +23,5 @@ int mkfifoat (int fd, const char *file, mode_t mode) { - dev_t dev = 0; - return __xmknodat (_MKNOD_VER, fd, file, mode | S_IFIFO, &dev); + return __mknodat (fd, file, mode | S_IFIFO, 0); } diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index 03e4ae9296..54b707b9cc 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2166,5 +2166,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h index 1fc27936b9..d20fb5a4b0 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h @@ -22,10 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - - /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the identifier 'timespec' to appear diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 5b752ef4a8..9b429fd28f 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -2248,6 +2248,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F diff --git a/sysdeps/unix/sysv/linux/alpha/xstatver.h b/sysdeps/unix/sysv/linux/alpha/xstatver.h index bbb9469617..1cb5d26bb1 100644 --- a/sysdeps/unix/sysv/linux/alpha/xstatver.h +++ b/sysdeps/unix/sysv/linux/alpha/xstatver.h @@ -7,3 +7,8 @@ #define _STAT_VER_GLIBC2_3_4 3 #define _STAT_VER_LINUX 3 #define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 0 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist index 925b532383..7ed5340364 100644 --- a/sysdeps/unix/sysv/linux/arc/libc.abilist +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist @@ -1926,5 +1926,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist index a4c1a7c03c..3ec1cbdfbc 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist @@ -147,6 +147,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 _Exit F diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h index b542623208..0669451f69 100644 --- a/sysdeps/unix/sysv/linux/bits/stat.h +++ b/sysdeps/unix/sysv/linux/bits/stat.h @@ -22,13 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - struct stat { __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist index 799873e189..301fd728d7 100644 --- a/sysdeps/unix/sysv/linux/csky/libc.abilist +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist @@ -2110,5 +2110,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h index 35e14a47c6..1b586d72fa 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h @@ -26,9 +26,6 @@ #include #include -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - #if defined __USE_FILE_OFFSET64 # define __field64(type, type64, name) type64 name #elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T diff --git a/sysdeps/unix/sysv/linux/generic/xstatver.h b/sysdeps/unix/sysv/linux/generic/xstatver.h index 8675db494c..d8fd35beb6 100644 --- a/sysdeps/unix/sysv/linux/generic/xstatver.h +++ b/sysdeps/unix/sysv/linux/generic/xstatver.h @@ -3,3 +3,8 @@ #define _STAT_VER_KERNEL 0 #define _STAT_VER_LINUX 0 #define _STAT_VER _STAT_VER_KERNEL + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 0 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist index 95c7bf4f06..84834052e1 100644 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -2069,6 +2069,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist index e7cf5cdb98..b82debaba4 100644 --- a/sysdeps/unix/sysv/linux/i386/libc.abilist +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -2235,6 +2235,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/sysdeps/unix/sysv/linux/ia64/bits/stat.h index 8ec2e4c81f..6937f3227a 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/stat.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/stat.h @@ -22,9 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - struct stat { __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist index beeb905efd..475b7af1a5 100644 --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist @@ -2101,6 +2101,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/ia64/xstatver.h b/sysdeps/unix/sysv/linux/ia64/xstatver.h index 4f02f697ad..f24ab4a9ee 100644 --- a/sysdeps/unix/sysv/linux/ia64/xstatver.h +++ b/sysdeps/unix/sysv/linux/ia64/xstatver.h @@ -3,3 +3,8 @@ #define _STAT_VER_KERNEL 0 #define _STAT_VER_LINUX 1 #define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 0 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/sysdeps/unix/sysv/linux/m68k/bits/stat.h index bf41776e6c..c6f761fcc0 100644 --- a/sysdeps/unix/sysv/linux/m68k/bits/stat.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/stat.h @@ -22,12 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - struct stat { __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index ed34e1fc82..29127e1341 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -2181,6 +2181,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/m68k/xstatver.h b/sysdeps/unix/sysv/linux/m68k/xstatver.h index 59dba71dd1..8e1801b603 100644 --- a/sysdeps/unix/sysv/linux/m68k/xstatver.h +++ b/sysdeps/unix/sysv/linux/m68k/xstatver.h @@ -5,3 +5,9 @@ #define _STAT_VER_SVR4 2 #define _STAT_VER_LINUX 3 #define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist index e00f5115b2..e5b4cecacd 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist @@ -2161,5 +2161,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h index 51316a8c1b..b3068e5c98 100644 --- a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h +++ b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h @@ -23,11 +23,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - #ifndef __USE_FILE_OFFSET64 struct stat { diff --git a/sysdeps/unix/sysv/linux/microblaze/xstatver.h b/sysdeps/unix/sysv/linux/microblaze/xstatver.h index bddaa0d5ec..790cc834d2 100644 --- a/sysdeps/unix/sysv/linux/microblaze/xstatver.h +++ b/sysdeps/unix/sysv/linux/microblaze/xstatver.h @@ -5,3 +5,9 @@ #define _STAT_VER_SVR4 2 #define _STAT_VER_LINUX 3 #define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h index cfeb4ce6a4..f229c58013 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/stat.h +++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h @@ -24,11 +24,6 @@ #include -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - #if _MIPS_SIM == _ABIO32 /* Structure describing file characteristics. */ diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index fe9ba4e982..b9f56007a2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -2152,6 +2152,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index e67591e710..c161ef11b5 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -2158,6 +2158,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist index e4eb9e6bbf..d4b1528e7a 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist @@ -2152,6 +2152,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/mips/xstatver.h b/sysdeps/unix/sysv/linux/mips/xstatver.h index 59dba71dd1..8e1801b603 100644 --- a/sysdeps/unix/sysv/linux/mips/xstatver.h +++ b/sysdeps/unix/sysv/linux/mips/xstatver.h @@ -5,3 +5,9 @@ #define _STAT_VER_SVR4 2 #define _STAT_VER_LINUX 3 #define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist index 0878998441..68fca4e650 100644 --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist @@ -2199,5 +2199,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h index 40ea9a96d4..80c9dc23ac 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h @@ -24,11 +24,6 @@ #include -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - #if __WORDSIZE == 32 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index 993c957e8e..bec34b2128 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@ -2208,6 +2208,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist index 25a8e828e9..35bd161c79 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist @@ -2071,6 +2071,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist index 46ae28e552..f1c8ad9cc5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist @@ -2361,5 +2361,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/powerpc/xstatver.h b/sysdeps/unix/sysv/linux/powerpc/xstatver.h index 1656e2f7e4..aa61dfd678 100644 --- a/sysdeps/unix/sysv/linux/powerpc/xstatver.h +++ b/sysdeps/unix/sysv/linux/powerpc/xstatver.h @@ -9,3 +9,9 @@ #else # define _STAT_VER _STAT_VER_KERNEL #endif + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist index 1044aa6be2..fdfc373871 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist @@ -2128,5 +2128,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/s390/bits/stat.h b/sysdeps/unix/sysv/linux/s390/bits/stat.h index d12055529a..75fa871a1d 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/stat.h +++ b/sysdeps/unix/sysv/linux/s390/bits/stat.h @@ -24,16 +24,6 @@ #include -#if __WORDSIZE == 64 -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 -#else -/* Versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX -#endif - #if __WORDSIZE == 64 struct stat { diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist index 6b1fa7e67f..47591dc5b5 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -2206,6 +2206,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist index 0aec094e7b..bd96aeaff7 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist @@ -2107,6 +2107,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F diff --git a/sysdeps/unix/sysv/linux/s390/xstatver.h b/sysdeps/unix/sysv/linux/s390/xstatver.h index 5ad0db2797..aeaf852ee5 100644 --- a/sysdeps/unix/sysv/linux/s390/xstatver.h +++ b/sysdeps/unix/sysv/linux/s390/xstatver.h @@ -7,10 +7,14 @@ # define _STAT_VER_KERNEL 0 # define _STAT_VER_LINUX 1 # define _STAT_VER _STAT_VER_LINUX +# define _MKNOD_VER_LINUX 0 #else # define _STAT_VER_LINUX_OLD 1 # define _STAT_VER_KERNEL 1 # define _STAT_VER_SVR4 2 # define _STAT_VER_LINUX 3 -# define _STAT_VER _STAT_VER_LINUX +# define _MKNOD_VER_LINUX 1 +# define _MKNOD_VER_SVR4 2 #endif +#define _STAT_VER _STAT_VER_LINUX +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index e2ae13d4fa..b4cebb11dd 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -2073,6 +2073,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/sysdeps/unix/sysv/linux/sparc/bits/stat.h index 7af17b5c40..d10ebb1a9a 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/stat.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/stat.h @@ -22,12 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - struct stat { __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index 886e01960f..f208405859 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -2197,6 +2197,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 _IO_fprintf F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist index 33b068201a..44e68aded2 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist @@ -2124,6 +2124,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/sparc/xstatver.h b/sysdeps/unix/sysv/linux/sparc/xstatver.h index ae92b530e7..693b41c3ac 100644 --- a/sysdeps/unix/sysv/linux/sparc/xstatver.h +++ b/sysdeps/unix/sysv/linux/sparc/xstatver.h @@ -5,3 +5,9 @@ #define _STAT_VER_SVR4 2 #define _STAT_VER_LINUX 3 #define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/x86/bits/stat.h b/sysdeps/unix/sysv/linux/x86/bits/stat.h index f132569e9d..2c0a3f120b 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/stat.h +++ b/sysdeps/unix/sysv/linux/x86/bits/stat.h @@ -22,17 +22,6 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -#ifndef __x86_64__ -/* i386 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -#else -/* x86-64 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 0 -#endif - struct stat { __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/x86/xstatver.h b/sysdeps/unix/sysv/linux/x86/xstatver.h index 6f047a346d..678d5bc022 100644 --- a/sysdeps/unix/sysv/linux/x86/xstatver.h +++ b/sysdeps/unix/sysv/linux/x86/xstatver.h @@ -5,9 +5,12 @@ # define _STAT_VER_KERNEL 1 # define _STAT_VER_SVR4 2 # define _STAT_VER_LINUX 3 +# define _MKNOD_VER_LINUX 1 +# define _MKNOD_VER_SVR4 2 #else # define _STAT_VER_KERNEL 0 # define _STAT_VER_LINUX 1 +# define _MKNOD_VER_LINUX 0 #endif #define _STAT_VER _STAT_VER_LINUX - +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist index f767bdde24..51e76861f6 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist @@ -2082,6 +2082,8 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.4 __confstr_chk F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist index 535862a51e..f83473c11f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist @@ -2179,5 +2179,7 @@ GLIBC_2.33 fstatat F GLIBC_2.33 fstatat64 F GLIBC_2.33 lstat F GLIBC_2.33 lstat64 F +GLIBC_2.33 mknod F +GLIBC_2.33 mknodat F GLIBC_2.33 stat F GLIBC_2.33 stat64 F diff --git a/sysdeps/unix/sysv/linux/xstatver.h b/sysdeps/unix/sysv/linux/xstatver.h index 59dba71dd1..8e1801b603 100644 --- a/sysdeps/unix/sysv/linux/xstatver.h +++ b/sysdeps/unix/sysv/linux/xstatver.h @@ -5,3 +5,9 @@ #define _STAT_VER_SVR4 2 #define _STAT_VER_LINUX 3 #define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX From patchwork Thu Jul 23 19:46:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40165 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB9C8386F812; Thu, 23 Jul 2020 19:47:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB9C8386F812 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533634; bh=NR8ycilmXY/LxtIz0a32RwkJU8tvPci2Ub3ogwKhNEU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ayUHY6Vz96zWqShnE054df7LDH2b7ulIN19Dz5pLgv/sIOz/LHhfkpILNbdP75Anx R/jClFgQRWmbkO7QIFnCwAwMqKXe+rvJlffS1SWxwBt7/57Z0uKHx+uEYWJHbum3kW YTUOsAxzIHDg7lRcwwLMG5e3/Jtz+XgAlp+rOdGM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by sourceware.org (Postfix) with ESMTPS id 0D7DA3861968 for ; Thu, 23 Jul 2020 19:47:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0D7DA3861968 Received: by mail-qk1-x743.google.com with SMTP id d4so3166911qkk.8 for ; Thu, 23 Jul 2020 12:47:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NR8ycilmXY/LxtIz0a32RwkJU8tvPci2Ub3ogwKhNEU=; b=rd38iTU0gEeRU9YVIkz0VV1J/03hDToHrYFbFKwcAhkrPrPr2BqTp+2WLpFBtCPoib rIbxgGCno7shwRHZPSfMx7gEUZp27/8rTyO6F39Rik+lj2Xc36cA6CBd+yas90Sgevmj LbR8KJrDYfvirs9Pnvi5HG4y8UgfxqtTC2wKV//T2oGyGI1MwvowQDHlC0oU9wXhqQoK Tw1JZkEcWH99nTxddrJa4TwwrTMujLs0vFOiYw3WBMWtk/D0Cl0sNYqNvcq9TZRNhEk6 MYj+2JvThUkD9LKnUanzR112QvJJby87OpwC1SiQ+vHSeWj+Jw6PkIe47lwveNMt2XBI Bp/Q== X-Gm-Message-State: AOAM531JVy/qgwK6RP2iIPy7/ZC5vnfamcJGWMQkPDJKbY20blQtF1hs GZacJZPm+OwteRZ3T1DJpsSEGMME+hw= X-Google-Smtp-Source: ABdhPJyiamug6JlWBv2N6c6ZYTRL+gObEMEjw2xduDTfLLjOoUe4Ml3RSjSQnSTFOjNn8iySlD+7OA== X-Received: by 2002:a37:4f01:: with SMTP id d1mr6451793qkb.261.1595533627233; Thu, 23 Jul 2020 12:47:07 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:06 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 11/16] linux: Move the struct stat{64} to struct_stat.h Date: Thu, 23 Jul 2020 16:46:36 -0300 Message-Id: <20200723194641.1949404-12-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The common definitions are moved to a Linux generic stat.h while the struct stat{64} definition are moved to a arch-specific struct_stat.h header. Checked with a build for all affected Linux ABIs. I checked also on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/Makefile | 3 +- .../alpha/bits/{stat.h => struct_stat.h} | 43 +----- sysdeps/unix/sysv/linux/bits/stat.h | 101 +------------- sysdeps/unix/sysv/linux/bits/struct_stat.h | 131 ++++++++++++++++++ .../generic/bits/{stat.h => struct_stat.h} | 45 +----- .../linux/ia64/bits/{stat.h => struct_stat.h} | 45 +----- .../linux/m68k/bits/{stat.h => struct_stat.h} | 44 +----- .../microblaze/bits/{stat.h => struct_stat.h} | 53 ++----- .../linux/mips/bits/{stat.h => struct_stat.h} | 45 +----- .../powerpc/bits/{stat.h => struct_stat.h} | 48 +------ .../linux/s390/bits/{stat.h => struct_stat.h} | 46 +----- .../sparc/bits/{stat.h => struct_stat.h} | 49 ++----- .../linux/x86/bits/{stat.h => struct_stat.h} | 46 +----- 13 files changed, 206 insertions(+), 493 deletions(-) rename sysdeps/unix/sysv/linux/alpha/bits/{stat.h => struct_stat.h} (72%) create mode 100644 sysdeps/unix/sysv/linux/bits/struct_stat.h rename sysdeps/unix/sysv/linux/generic/bits/{stat.h => struct_stat.h} (77%) rename sysdeps/unix/sysv/linux/ia64/bits/{stat.h => struct_stat.h} (75%) rename sysdeps/unix/sysv/linux/m68k/bits/{stat.h => struct_stat.h} (77%) rename sysdeps/unix/sysv/linux/microblaze/bits/{stat.h => struct_stat.h} (81%) rename sysdeps/unix/sysv/linux/mips/bits/{stat.h => struct_stat.h} (85%) rename sysdeps/unix/sysv/linux/powerpc/bits/{stat.h => struct_stat.h} (85%) rename sysdeps/unix/sysv/linux/s390/bits/{stat.h => struct_stat.h} (85%) rename sysdeps/unix/sysv/linux/sparc/bits/{stat.h => struct_stat.h} (77%) rename sysdeps/unix/sysv/linux/x86/bits/{stat.h => struct_stat.h} (79%) diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 3c28adae0d..f189f65daf 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -94,7 +94,8 @@ sysdep_headers += sys/mount.h sys/acct.h \ bits/types/struct_semid_ds.h \ bits/types/struct_msqid_ds.h \ bits/types/struct_shmid_ds.h \ - bits/ipc-perm.h + bits/ipc-perm.h \ + bits/struct_stat.h tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h similarity index 72% rename from sysdeps/unix/sysv/linux/alpha/bits/stat.h rename to sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h index d20fb5a4b0..1c9b4248b8 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -16,11 +17,11 @@ . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the @@ -111,37 +112,5 @@ struct stat64 #define _STATBUF_ST_RDEV #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h index 0669451f69..85c4c7769e 100644 --- a/sysdeps/unix/sysv/linux/bits/stat.h +++ b/sysdeps/unix/sysv/linux/bits/stat.h @@ -22,106 +22,7 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; - - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __ino64_t st_ino; /* File serial number. */ - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC +#include /* Encoding of the file mode. */ diff --git a/sysdeps/unix/sysv/linux/bits/struct_stat.h b/sysdeps/unix/sysv/linux/bits/struct_stat.h new file mode 100644 index 0000000000..344bffece6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/struct_stat.h @@ -0,0 +1,131 @@ +/* Definition for struct stat. + Copyright (C) 2020 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 + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 + +#include +#include + +struct stat + { + __dev_t st_dev; /* Device. */ + unsigned short int __pad1; +#ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +#else + __ino_t __st_ino; /* 32bit file serial number. */ +#endif + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; +#ifndef __USE_FILE_OFFSET64 + __off_t st_size; /* Size of file, in bytes. */ +#else + __off64_t st_size; /* Size of file, in bytes. */ +#endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + +#ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +#else + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#endif +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif +#ifndef __USE_FILE_OFFSET64 + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +#else + __ino64_t st_ino; /* File serial number. */ +#endif + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + unsigned int __pad1; + + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + __ino64_t st_ino; /* File serial number. */ + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +/* Nanosecond resolution time values are supported. */ +#define _STATBUF_ST_NSEC + + +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h similarity index 77% rename from sysdeps/unix/sysv/linux/generic/bits/stat.h rename to sysdeps/unix/sysv/linux/generic/bits/struct_stat.h index 1b586d72fa..5049956030 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h +++ b/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,11 +17,11 @@ . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include #include @@ -124,37 +124,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/sysdeps/unix/sysv/linux/ia64/bits/struct_stat.h similarity index 75% rename from sysdeps/unix/sysv/linux/ia64/bits/stat.h rename to sysdeps/unix/sysv/linux/ia64/bits/struct_stat.h index 6937f3227a..b2272a55b1 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/stat.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -12,15 +13,15 @@ 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 + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 struct stat { @@ -105,37 +106,5 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits//stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h similarity index 77% rename from sysdeps/unix/sysv/linux/m68k/bits/stat.h rename to sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h index c6f761fcc0..bf457a0db7 100644 --- a/sysdeps/unix/sysv/linux/m68k/bits/stat.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -16,11 +17,11 @@ . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 struct stat { @@ -123,37 +124,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h similarity index 81% rename from sysdeps/unix/sysv/linux/microblaze/bits/stat.h rename to sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h index b3068e5c98..db81543b23 100644 --- a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h +++ b/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h @@ -1,11 +1,11 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. - +/* Definition for struct stat. + Copyright (C) 2020 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. + 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 @@ -13,15 +13,15 @@ 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 + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #ifndef __USE_FILE_OFFSET64 struct stat @@ -155,37 +155,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h. */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h similarity index 85% rename from sysdeps/unix/sysv/linux/mips/bits/stat.h rename to sysdeps/unix/sysv/linux/mips/bits/struct_stat.h index f229c58013..5abd71fc23 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/stat.h +++ b/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -16,15 +17,14 @@ . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include - #if _MIPS_SIM == _ABIO32 /* Structure describing file characteristics. */ struct stat @@ -215,37 +215,4 @@ struct stat64 #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h b/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h similarity index 85% rename from sysdeps/unix/sysv/linux/powerpc/bits/stat.h rename to sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h index 80c9dc23ac..cb41adc7c0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -12,19 +13,18 @@ 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 + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include - #if __WORDSIZE == 32 struct stat @@ -216,44 +216,10 @@ struct stat64 # endif /* __USE_LARGEFILE64 */ #endif - /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/s390/bits/stat.h b/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h similarity index 85% rename from sysdeps/unix/sysv/linux/s390/bits/stat.h rename to sysdeps/unix/sysv/linux/s390/bits/struct_stat.h index 75fa871a1d..10e7eb0221 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/stat.h +++ b/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -12,15 +13,15 @@ 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 + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include @@ -207,37 +208,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h similarity index 77% rename from sysdeps/unix/sysv/linux/sparc/bits/stat.h rename to sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h index d10ebb1a9a..546811539a 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/stat.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -12,15 +13,18 @@ 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 + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 + +#include +#include struct stat { @@ -124,37 +128,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/x86/bits/stat.h b/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h similarity index 79% rename from sysdeps/unix/sysv/linux/x86/bits/stat.h rename to sysdeps/unix/sysv/linux/x86/bits/struct_stat.h index 2c0a3f120b..dae7aa46b3 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/stat.h +++ b/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020 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 @@ -12,15 +13,15 @@ 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 + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 struct stat { @@ -153,37 +154,4 @@ struct stat64 /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ From patchwork Thu Jul 23 19:46:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40163 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25446386F442; Thu, 23 Jul 2020 19:47:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25446386F442 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533633; bh=mY/YqVAI6jaYZjcL7vMzR3MvHwvBuI923L4zge/7JgM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=l3WDjaFNcXuIBL/UtsnFzve3PkKOMQW0aOgyrcOmERfrSBIKgqN+OtdoZykU0bLFA UEY6uKFAC6YZsE1apexpdOlPlhUblbytWWQZRSeMTi41t6puqUyATpWlyTa21HzIKs nK5uVZqBFBaxi6C7GJ26+HLzx1L1XeG/ZquGJdx0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by sourceware.org (Postfix) with ESMTPS id EB972384C002 for ; Thu, 23 Jul 2020 19:47:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EB972384C002 Received: by mail-qv1-xf42.google.com with SMTP id u15so1813062qvx.7 for ; Thu, 23 Jul 2020 12:47:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mY/YqVAI6jaYZjcL7vMzR3MvHwvBuI923L4zge/7JgM=; b=I1mDzT1+RvwLevdjRxjflnn7X5E49hq2bnelitBlI8Vkj1Zs+xqMFdzzkrmLae8Qoc fxsu5q0XyyVdJwgKEF9L12zujV6OVPd0Wp2UIrAokmwqPwQ9oI1XBE8rqok3xWiJibZ9 o3QceIZFuFxwswcewnV+MPVkBppqP99B0v3cDPFC02U4Fkp1LW1dVnbYp9afksff47rs avSvGsTQ58QiCeiAD2zoz9e6uKuh/2YcAkm9YxXUT3cXlSisBiOFHbomSsRAWBzBszg7 v2cIMa8r2kLbMuLK3hMGgpzmKY4FD03gQDSW6SeafGfyYcHZI4lzr8lBLmg2LSzk5jGL g4FA== X-Gm-Message-State: AOAM530MthFuV18DRFArcO4yChI4U89pCEj6mQebI1xD4rFK5+v6IoW0 2+YwELA+ZCs7pwYd0pbrShS8x+7lImE= X-Google-Smtp-Source: ABdhPJy8tUkvuSTWQfgaV0t+5XhxaZBIdWLj0UTYgrde9RHbTZaW7jkX+Tn946Qj+Cy0HNlIdcl/VQ== X-Received: by 2002:a0c:e1c3:: with SMTP id v3mr6163901qvl.209.1595533628823; Thu, 23 Jul 2020 12:47:08 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:08 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 12/16] linux: Implement {l}fstat{at} in terms of fstatat Date: Thu, 23 Jul 2020 16:46:37 -0300 Message-Id: <20200723194641.1949404-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Both fstatat and fstata64 calls the old fxstatat and fxstatat64 repectivelly with _STAT_VER, the one currently exported as default for all ABIs. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/fstat.c | 31 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/fstat64.c | 38 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/fstatat.c | 30 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/fstatat64.c | 38 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/lstat.c | 31 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/lstat64.c | 38 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/stat.c | 31 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/stat64.c | 38 +++++++++++++++++++++++++++++ 8 files changed, 275 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/fstat.c create mode 100644 sysdeps/unix/sysv/linux/fstat64.c create mode 100644 sysdeps/unix/sysv/linux/fstatat.c create mode 100644 sysdeps/unix/sysv/linux/fstatat64.c create mode 100644 sysdeps/unix/sysv/linux/lstat.c create mode 100644 sysdeps/unix/sysv/linux/lstat64.c create mode 100644 sysdeps/unix/sysv/linux/stat.c create mode 100644 sysdeps/unix/sysv/linux/stat64.c diff --git a/sysdeps/unix/sysv/linux/fstat.c b/sysdeps/unix/sysv/linux/fstat.c new file mode 100644 index 0000000000..bdbeded956 --- /dev/null +++ b/sysdeps/unix/sysv/linux/fstat.c @@ -0,0 +1,31 @@ +/* Get file status. Linux version. + Copyright (C) 2020 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 + +#if !XSTAT_IS_XSTAT64 +int +__fstat (int fd, struct stat *buf) +{ + return __fstatat (fd, "", buf, AT_EMPTY_PATH); +} + +weak_alias (__fstat, fstat) +#endif diff --git a/sysdeps/unix/sysv/linux/fstat64.c b/sysdeps/unix/sysv/linux/fstat64.c new file mode 100644 index 0000000000..c2ff1ff577 --- /dev/null +++ b/sysdeps/unix/sysv/linux/fstat64.c @@ -0,0 +1,38 @@ +/* Get file status. Linux version. + Copyright (C) 2020 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 + . */ + +#define __fstat __redirect___fstat +#define fstat __redirect_fstat +#include +#undef __fstat +#undef fstat +#include +#include + +int +__fstat64 (int fd, struct stat64 *buf) +{ + return __fstatat64 (fd, "", buf, AT_EMPTY_PATH); +} +hidden_def (__fstat64) +weak_alias (__fstat64, fstat64) + +#if XSTAT_IS_XSTAT64 +strong_alias (__fstat64, __fstat) +weak_alias (__fstat64, fstat) +#endif diff --git a/sysdeps/unix/sysv/linux/fstatat.c b/sysdeps/unix/sysv/linux/fstatat.c new file mode 100644 index 0000000000..457496605c --- /dev/null +++ b/sysdeps/unix/sysv/linux/fstatat.c @@ -0,0 +1,30 @@ +/* Get file status. Linux version. + Copyright (C) 2020 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 + +#if !XSTAT_IS_XSTAT64 +int +__fstatat (int fd, const char *file, struct stat *buf, int flag) +{ + return __fxstatat (_STAT_VER, fd, file, buf, flag); +} + +weak_alias (__fstatat, fstatat) +#endif diff --git a/sysdeps/unix/sysv/linux/fstatat64.c b/sysdeps/unix/sysv/linux/fstatat64.c new file mode 100644 index 0000000000..46487919e6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/fstatat64.c @@ -0,0 +1,38 @@ +/* Get file status. Linux version. + Copyright (C) 2020 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 + . */ + +#define __fstatat __redirect___fstatat +#define fstatat __redirect_fstatat +#include +#undef __fstatat +#undef fstatat +#include + +int +__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) +{ + return __fxstatat64 (_STAT_VER, fd, file, buf, flag); +} +hidden_def (__fstatat64) +weak_alias (__fstatat64, fstatat64) + +#if XSTAT_IS_XSTAT64 +strong_alias (__fstatat64, __fstatat) +weak_alias (__fstatat64, fstatat) +strong_alias (__fstatat64, __GI___fstatat); +#endif diff --git a/sysdeps/unix/sysv/linux/lstat.c b/sysdeps/unix/sysv/linux/lstat.c new file mode 100644 index 0000000000..b0bdeee9e9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/lstat.c @@ -0,0 +1,31 @@ +/* Get file status. Linux version. + Copyright (C) 2020 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 + +#if !XSTAT_IS_XSTAT64 +int +__lstat (const char *file, struct stat *buf) +{ + return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); +} + +weak_alias (__lstat, lstat) +#endif diff --git a/sysdeps/unix/sysv/linux/lstat64.c b/sysdeps/unix/sysv/linux/lstat64.c new file mode 100644 index 0000000000..e5f02e9822 --- /dev/null +++ b/sysdeps/unix/sysv/linux/lstat64.c @@ -0,0 +1,38 @@ +/* Get file status. + Copyright (C) 1996-2020 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 + . */ + +#define __lstat __redirect___lstat +#define lstat __redirect_lstat +#include +#undef __lstat +#undef lstat +#include +#include + +int +__lstat64 (const char *file, struct stat64 *buf) +{ + return __fstatat64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); +} +hidden_def (__lstat64) +weak_alias (__lstat64, lstat64) + +#if XSTAT_IS_XSTAT64 +strong_alias (__lstat64, __lstat) +weak_alias (__lstat64, lstat) +#endif diff --git a/sysdeps/unix/sysv/linux/stat.c b/sysdeps/unix/sysv/linux/stat.c new file mode 100644 index 0000000000..a77502eb95 --- /dev/null +++ b/sysdeps/unix/sysv/linux/stat.c @@ -0,0 +1,31 @@ +/* Get file status. Linux version. + Copyright (C) 2020 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 + +#if !XSTAT_IS_XSTAT64 +int +__stat (const char *file, struct stat *buf) +{ + return __fstatat (AT_FDCWD, file, buf, 0); +} + +weak_alias (__stat, stat) +#endif diff --git a/sysdeps/unix/sysv/linux/stat64.c b/sysdeps/unix/sysv/linux/stat64.c new file mode 100644 index 0000000000..2f40037c2c --- /dev/null +++ b/sysdeps/unix/sysv/linux/stat64.c @@ -0,0 +1,38 @@ +/* Get file status. Linux version. + Copyright (C) 2020 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 + . */ + +#define __stat __redirect___stat +#define stat __redirect_stat +#include +#undef __stat +#undef stat +#include +#include + +int +__stat64 (const char *file, struct stat64 *buf) +{ + return __fstatat64 (AT_FDCWD, file, buf, 0); +} +hidden_def (__stat64) +weak_alias (__stat64, stat64) + +#if XSTAT_IS_XSTAT64 +strong_alias (__stat64, __stat) +weak_alias (__stat64, stat) +#endif From patchwork Thu Jul 23 19:46:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40166 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D69D384242C; Thu, 23 Jul 2020 19:47:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D69D384242C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533636; bh=CikCkSjYoeSsLMNmn77vLV0G6zJXAlQ7Gm7THOy+xGs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=juCpkB9DknzeHOzx311Y/ArAx8zlGMtNOEzN7GV6g8F0U9RZiEufuIzrTGkmXfL32 f9ihWjbkGlSm9E7Yv2MkWxqeTMzpgPTMVsGNadZlv1wdiG5So5nSQu+StXuVagg5TZ 5eEZ63uIUs1SQb7cq9CkHP2oA90VK67G8qUHYcRI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by sourceware.org (Postfix) with ESMTPS id EAC49386188D for ; Thu, 23 Jul 2020 19:47:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EAC49386188D Received: by mail-qv1-xf43.google.com with SMTP id u15so1813109qvx.7 for ; Thu, 23 Jul 2020 12:47:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CikCkSjYoeSsLMNmn77vLV0G6zJXAlQ7Gm7THOy+xGs=; b=Qb0ShRBNFUzXq0qb76Ghu/B0P2MwryMzMhNZmQRvBJzXLuGVEAz/5iVcYhSDGv+OHb 2ry+SgAfThdxKXKlNDRUrsBsLpqsqdBvY4iWQJj2LjgBqkRD7D9cgqiou0A23O+MMhlL fehOKNe4GfRe5heANdqW1qaTOoYz/I60rQkb7b0UmpCucJaqqknr/RayKWRaH2tsgzYu E3RK2+ERJ4zLXsF7a+X6c0aubM/xk1B+GCyeyQnzff6pYKSOoGVgmkzRAOYoPJLDK6iK GhEuKqu7d0QXu44kM266MuxYHeNBtSSvay737NNUZ3+wJ4hU+sxOyGQEhbet75k//j7c G96A== X-Gm-Message-State: AOAM532KqHo37t0LvdSBcTXW8KZo6XemhMDxGc2ectUtFwKJSScys0Gk oVWgSm4DRQfgBEb3R+CW0LPuxe43mXI= X-Google-Smtp-Source: ABdhPJxUquT9eI4PclDxQAQymRaWXYG3FqygYx5TlbUVkUz6kJHJ+J9J+sBzxg2FKgxkLQzMdzUJrw== X-Received: by 2002:a0c:d7c9:: with SMTP id g9mr6603819qvj.83.1595533630440; Thu, 23 Jul 2020 12:47:10 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:10 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 13/16] linux: Disentangle fstatat from fxstatat Date: Thu, 23 Jul 2020 16:46:38 -0300 Message-Id: <20200723194641.1949404-14-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It implements all the requires syscall for the all Linux kABIS on fstatat{64} itself instead of calling fxstatat{64}. On non-LFS implementation, it handles 3 cases: 1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issues __NR_fstat64 plus handle the overflow on st_ino, st_size, or st_blocks. 2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, mips32, s390, sh, powerpc, and sparc32): it issues __NR_fstatat64 and convert the result to struct stat. 3. 64-bit kABI outliers (mips64 and mips64-n32): it issues __NR_newfstatat and convert the result to struct stat. The generic LFS implementation handles multiple cases: 1. XSTAT_IS_XSTAT64 being 1: 1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and x86_64): it issues __NR_newfstatat. 1.2. 64-bit kABI outlier (alpha): it issues __NR_fstatat64. 1.3. 64-bit kABI outlier where struct stat64 does not match kernel one (sparc64): it issues __NR_fstatat64 and convert the result to struct stat64. 1.4. 32-bit kABI with default 64-bit time_t (arc, riscv32): it issues __NR_statx and convert the result to struct stat64. 2. Old ABIs with XSTAT_IS_XSTAT64 being 0: 2.1. All kABIs with non-LFS support (arm, csky, i386, hppa, m68k, microblaze, nios2, sh, powerpc32, and sparc32): it issues __NR_fstatat64. 2.2. 64-bit kABI outliers (mips64 and mips64-n32): it issues __NR_newfstatat and convert the result to struct stat64. It allows to remove all the hidden definitions from the {f,l}xstat{64} (some are still kept because Hurd requires it). Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski --- include/sys/stat.h | 32 ++++++-- sysdeps/unix/sysv/linux/alpha/fxstat64.c | 2 - sysdeps/unix/sysv/linux/alpha/fxstatat64.c | 4 - sysdeps/unix/sysv/linux/alpha/lxstat64.c | 3 - sysdeps/unix/sysv/linux/alpha/xstat64.c | 3 - sysdeps/unix/sysv/linux/fstatat.c | 56 ++++++++++++- sysdeps/unix/sysv/linux/fstatat64.c | 45 ++++++++++- sysdeps/unix/sysv/linux/fxstat.c | 1 - sysdeps/unix/sysv/linux/fxstat64.c | 3 - sysdeps/unix/sysv/linux/fxstatat.c | 2 - sysdeps/unix/sysv/linux/fxstatat64.c | 4 +- sysdeps/unix/sysv/linux/kstat_cp.h | 2 + sysdeps/unix/sysv/linux/lxstat.c | 1 - sysdeps/unix/sysv/linux/lxstat64.c | 2 - sysdeps/unix/sysv/linux/mips/fxstat.c | 1 - sysdeps/unix/sysv/linux/mips/lxstat.c | 1 - .../unix/sysv/linux/mips/mips64/fxstat64.c | 2 - .../unix/sysv/linux/mips/mips64/fxstatat.c | 1 - .../unix/sysv/linux/mips/mips64/fxstatat64.c | 1 - .../unix/sysv/linux/mips/mips64/kstat_cp.h | 80 +++++++++++++++++++ .../unix/sysv/linux/mips/mips64/lxstat64.c | 2 - sysdeps/unix/sysv/linux/mips/mips64/xstat64.c | 2 - sysdeps/unix/sysv/linux/mips/xstat.c | 1 - .../unix/sysv/linux/sparc/sparc64/kstat_cp.h | 46 +++++++++++ sysdeps/unix/sysv/linux/xstat.c | 1 - sysdeps/unix/sysv/linux/xstat64.c | 2 - 26 files changed, 253 insertions(+), 47 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/kstat_cp.h create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h diff --git a/include/sys/stat.h b/include/sys/stat.h index 04b825df4a..199173b007 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -3,6 +3,28 @@ #ifndef _ISOMAC # include +# include + +static inline bool +in_ino_t_range (__ino64_t v) +{ + __ino_t s = v; + return s == v; +} + +static inline bool +in_off_t_range (__off64_t v) +{ + __off_t s = v; + return s == v; +} + +static inline bool +in_blkcnt_t_range (__blkcnt64_t v) +{ + __blkcnt_t s = v; + return s == v; +} /* Now define the internal interfaces. */ extern int __stat (const char *__file, struct stat *__buf); @@ -54,19 +76,19 @@ int __xstat64 (int ver, const char *__filename, struct stat64 *__stat_buf); int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf); int __fxstatat64 (int ver, int __fildes, const char *__filename, struct stat64 *__stat_buf, int __flag); + +# ifdef NO_RTLD_HIDDEN +/* These are still required for Hurd. */ libc_hidden_proto (__fxstat); libc_hidden_proto (__xstat); libc_hidden_proto (__lxstat); libc_hidden_proto (__fxstatat); -# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN) +# if IS_IN (libc) hidden_proto (__fxstat64); hidden_proto (__xstat64); hidden_proto (__lxstat64); hidden_proto (__fxstatat64); -# endif - -# ifdef NO_RTLD_HIDDEN -/* These are still required for Hurd. */ +# endif # define stat(fname, buf) __xstat (_STAT_VER, fname, buf) # define lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) # define __lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat64.c b/sysdeps/unix/sysv/linux/alpha/fxstat64.c index 286a2f0a6c..9d6b8eca32 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstat64.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstat64.c @@ -42,6 +42,4 @@ __fxstat64 (int vers, int fd, struct stat64 *buf) } } } -hidden_def (__fxstat64) strong_alias (__fxstat64, __fxstat); -hidden_ver (__fxstat64, __fxstat) diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat64.c b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c index f10c1d31e8..997fb87ac6 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c @@ -29,8 +29,4 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) { return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); } -libc_hidden_def (__fxstatat64) -#if IS_IN(libc) strong_alias (__fxstatat64, __fxstatat); -hidden_ver (__fxstatat64, __fxstatat) -#endif diff --git a/sysdeps/unix/sysv/linux/alpha/lxstat64.c b/sysdeps/unix/sysv/linux/alpha/lxstat64.c index 90dc0c7ce7..38f132f15e 100644 --- a/sysdeps/unix/sysv/linux/alpha/lxstat64.c +++ b/sysdeps/unix/sysv/linux/alpha/lxstat64.c @@ -44,6 +44,3 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf) } } weak_alias (__lxstat64, __lxstat); -weak_alias (__lxstat64, __GI___lxstat); - -hidden_def (__lxstat64) diff --git a/sysdeps/unix/sysv/linux/alpha/xstat64.c b/sysdeps/unix/sysv/linux/alpha/xstat64.c index ac1af53780..c856c95dc5 100644 --- a/sysdeps/unix/sysv/linux/alpha/xstat64.c +++ b/sysdeps/unix/sysv/linux/alpha/xstat64.c @@ -44,6 +44,3 @@ __xstat64 (int vers, const char *name, struct stat64 *buf) } } weak_alias (__xstat64, __xstat); -weak_alias (__xstat64, __GI___xstat); - -hidden_def (__xstat64) diff --git a/sysdeps/unix/sysv/linux/fstatat.c b/sysdeps/unix/sysv/linux/fstatat.c index 457496605c..03ddb3f493 100644 --- a/sysdeps/unix/sysv/linux/fstatat.c +++ b/sysdeps/unix/sysv/linux/fstatat.c @@ -18,12 +18,64 @@ #include #include +#include #if !XSTAT_IS_XSTAT64 +# include + int -__fstatat (int fd, const char *file, struct stat *buf, int flag) +__fstatat (int fd, const char *file, struct stat *st, int flag) { - return __fxstatat (_STAT_VER, fd, file, buf, flag); +# if STAT_IS_KERNEL_STAT + /* New kABIs which uses generic pre 64-bit time Linux ABI, e.g. + csky, nios2 */ + int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); + if (r == 0 && (st->__st_ino_pad != 0 + || st->__st_size_pad != 0 + || st->__st_blocks_pad != 0)) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); + return r; +# else +# ifdef __NR_fstatat64 + /* Old KABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, mips32, + microblaze, s390, sh, powerpc, and sparc. */ + struct stat64 st64; + int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); + if (r == 0) + { + if (! in_ino_t_range (st64.st_ino) + || ! in_off_t_range (st64.st_size) + || ! in_blkcnt_t_range (st64.st_blocks)) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); + + /* Clear internal pad and reserved fields. */ + memset (st, 0, sizeof (*st)); + + st->st_dev = st64.st_dev, + st->st_ino = st64.st_ino; + st->st_mode = st64.st_mode; + st->st_nlink = st64.st_nlink; + st->st_uid = st64.st_uid; + st->st_gid = st64.st_gid; + st->st_rdev = st64.st_rdev; + st->st_size = st64.st_size; + st->st_blksize = st64.st_blksize; + st->st_blocks = st64.st_blocks; + st->st_atim.tv_sec = st64.st_atim.tv_sec; + st->st_atim.tv_nsec = st64.st_atim.tv_nsec; + st->st_mtim.tv_sec = st64.st_mtim.tv_sec; + st->st_mtim.tv_nsec = st64.st_mtim.tv_nsec; + st->st_ctim.tv_sec = st64.st_ctim.tv_sec; + st->st_ctim.tv_nsec = st64.st_ctim.tv_nsec; + } + return r; +# else + /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */ + struct kernel_stat kst; + int r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + return r ?: __cp_kstat_stat (&kst, st); +# endif /* __nr_fstatat64 */ +# endif /* STAT_IS_KERNEL_STAT */ } weak_alias (__fstatat, fstatat) diff --git a/sysdeps/unix/sysv/linux/fstatat64.c b/sysdeps/unix/sysv/linux/fstatat64.c index 46487919e6..82fab107a5 100644 --- a/sysdeps/unix/sysv/linux/fstatat64.c +++ b/sysdeps/unix/sysv/linux/fstatat64.c @@ -21,12 +21,53 @@ #include #undef __fstatat #undef fstatat +#include + #include +#include + +#include +#include int -__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag) +__fstatat64 (int fd, const char *file, struct stat64 *st, int flag) { - return __fxstatat64 (_STAT_VER, fd, file, buf, flag); +#if XSTAT_IS_XSTAT64 +# ifdef __NR_newfstatat + /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and + x86_64. */ + return INLINE_SYSCALL_CALL (newfstatat, fd, file, st, flag); +# elif defined __NR_fstatat64 +# if STAT64_IS_KERNEL_STAT64 + /* 64-bit kABI outlier, e.g. alpha. */ + return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); +# else + /* 64-bit kABI outlier, e.g. sparc64. */ + struct kernel_stat64 kst64; + int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &kst64, flag); + return r ?: __cp_stat64_kstat64 (st, &kst64); +# endif +# else + /* 32-bit kABI with default 64-bit time_t, e.g. arc, riscv32. */ + struct statx tmp; + int r = INLINE_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, + STATX_BASIC_STATS, &tmp); + if (r == 0) + __cp_stat64_statx (st, &tmp); + return r; +# endif +#else +# ifdef __NR_fstatat64 + /* All kABIs with non-LFS support, e.g. arm, csky, i386, hppa, m68k, + microblaze, nios2, sh, powerpc32, and sparc32. */ + return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); +# else + /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */ + struct kernel_stat kst; + int r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + return r ?: __cp_kstat_stat64 (&kst, st); +# endif +#endif } hidden_def (__fstatat64) weak_alias (__fstatat64, fstatat64) diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c index b46e344d0e..f78497ea92 100644 --- a/sysdeps/unix/sysv/linux/fxstat.c +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -57,5 +57,4 @@ __fxstat (int vers, int fd, struct stat *buf) } } } -hidden_def (__fxstat) #endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c index d3834f1ce2..6ae7babccc 100644 --- a/sysdeps/unix/sysv/linux/fxstat64.c +++ b/sysdeps/unix/sysv/linux/fxstat64.c @@ -59,13 +59,10 @@ ___fxstat64 (int vers, int fd, struct stat64 *buf) versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2); strong_alias (___fxstat64, __old__fxstat64) compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1); -hidden_ver (___fxstat64, __fxstat64) #else strong_alias (___fxstat64, __fxstat64) -hidden_def (__fxstat64) #endif #if XSTAT_IS_XSTAT64 strong_alias (__fxstat64, __fxstat); -hidden_ver (__fxstat64, __fxstat) #endif diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c index 0291a2c598..1a60fc10e3 100644 --- a/sysdeps/unix/sysv/linux/fxstatat.c +++ b/sysdeps/unix/sysv/linux/fxstatat.c @@ -46,6 +46,4 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) return r ?: __xstat32_conv (vers, &st64, st); #endif } -libc_hidden_def (__fxstatat) - #endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c index ac33ab4fc9..7fe034809c 100644 --- a/sysdeps/unix/sysv/linux/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/fxstatat64.c @@ -61,8 +61,6 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) #endif return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } -libc_hidden_def (__fxstatat64) -#if XSTAT_IS_XSTAT64 && IS_IN(libc) +#if XSTAT_IS_XSTAT64 strong_alias (__fxstatat64, __fxstatat); -hidden_ver (__fxstatat64, __fxstatat) #endif diff --git a/sysdeps/unix/sysv/linux/kstat_cp.h b/sysdeps/unix/sysv/linux/kstat_cp.h new file mode 100644 index 0000000000..8fa43ed2e1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/kstat_cp.h @@ -0,0 +1,2 @@ +/* Empty, it is overridden by an architecture which might require copy to ro + from a kernel_stat stat struct to glibc export stat{64}. */ diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c index dc63d20061..156173a4e1 100644 --- a/sysdeps/unix/sysv/linux/lxstat.c +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -58,5 +58,4 @@ __lxstat (int vers, const char *name, struct stat *buf) } } } -hidden_def (__lxstat) #endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c index 375013e9b1..29bd1cdf72 100644 --- a/sysdeps/unix/sysv/linux/lxstat64.c +++ b/sysdeps/unix/sysv/linux/lxstat64.c @@ -81,8 +81,6 @@ weak_alias (___lxstat64, __GI___lxstat); versioned_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2); strong_alias (___lxstat64, __old__lxstat64) compat_symbol (libc, __old__lxstat64, __lxstat64, GLIBC_2_1); -hidden_ver (___lxstat64, __lxstat64) #else strong_alias (___lxstat64, __lxstat64); -hidden_def (__lxstat64) #endif diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c index 16c3cefee2..4585c2362b 100644 --- a/sysdeps/unix/sysv/linux/mips/fxstat.c +++ b/sysdeps/unix/sysv/linux/mips/fxstat.c @@ -39,4 +39,3 @@ __fxstat (int vers, int fd, struct stat *buf) } } } -hidden_def (__fxstat) diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c index eb07549adf..62a3b15b32 100644 --- a/sysdeps/unix/sysv/linux/mips/lxstat.c +++ b/sysdeps/unix/sysv/linux/mips/lxstat.c @@ -39,4 +39,3 @@ __lxstat (int vers, const char *name, struct stat *buf) } } } -hidden_def (__lxstat) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c index 3fcdd9f1ee..e6c1cacd4b 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c @@ -31,5 +31,3 @@ __fxstat64 (int vers, int fd, struct stat64 *buf) return r ?: __xstat64_conv (vers, &kbuf, buf); } - -hidden_def (__fxstat64) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c index 58410a1441..e384dbab8b 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c @@ -30,4 +30,3 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); return r ?: __xstat_conv (vers, &kst, st); } -libc_hidden_def (__fxstatat) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c index e5416d8971..cfd172d301 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c @@ -33,4 +33,3 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) } return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } -libc_hidden_def (__fxstatat64) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h b/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h new file mode 100644 index 0000000000..7f226416f9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h @@ -0,0 +1,80 @@ +/* Struct stat/stat64 to stat/stat64 conversion for Linux. + Copyright (C) 2020 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 + +static inline int +__cp_kstat_stat (const struct kernel_stat *kst, struct stat *st) +{ + st->st_dev = kst->st_dev; + memset (&st->st_pad1, 0, sizeof (st->st_pad1)); + st->st_ino = kst->st_ino; + if (st->st_ino != kst->st_ino) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); + st->st_mode = kst->st_mode; + st->st_nlink = kst->st_nlink; + st->st_uid = kst->st_uid; + st->st_gid = kst->st_gid; + st->st_rdev = kst->st_rdev; + memset (&st->st_pad2, 0, sizeof (st->st_pad2)); + st->st_size = kst->st_size; + if (st->st_size != kst->st_size) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); + st->st_pad3 = 0; + st->st_atim.tv_sec = kst->st_atime_sec; + st->st_atim.tv_nsec = kst->st_atime_nsec; + st->st_mtim.tv_sec = kst->st_mtime_sec; + st->st_mtim.tv_nsec = kst->st_mtime_nsec; + st->st_ctim.tv_sec = kst->st_ctime_sec; + st->st_ctim.tv_nsec = kst->st_ctime_nsec; + st->st_blksize = kst->st_blksize; + st->st_blocks = kst->st_blocks; + if (st->st_blocks != kst->st_blocks) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); + memset (&st->st_pad5, 0, sizeof (st->st_pad5)); + + return 0; +} + +static inline int +__cp_kstat_stat64 (const struct kernel_stat *kst, struct stat64 *st) +{ + st->st_dev = kst->st_dev; + memset (&st->st_pad1, 0, sizeof (st->st_pad1)); + st->st_ino = kst->st_ino; + st->st_mode = kst->st_mode; + st->st_nlink = kst->st_nlink; + st->st_uid = kst->st_uid; + st->st_gid = kst->st_gid; + st->st_rdev = kst->st_rdev; + memset (&st->st_pad2, 0, sizeof (st->st_pad2)); + st->st_pad3 = 0; + st->st_size = kst->st_size; + st->st_blksize = kst->st_blksize; + st->st_blocks = kst->st_blocks; + st->st_atim.tv_sec = kst->st_atime_sec; + st->st_atim.tv_nsec = kst->st_atime_nsec; + st->st_mtim.tv_sec = kst->st_mtime_sec; + st->st_mtim.tv_nsec = kst->st_mtime_nsec; + st->st_ctim.tv_sec = kst->st_ctime_sec; + st->st_ctim.tv_nsec = kst->st_ctime_nsec; + memset (&st->st_pad4, 0, sizeof (st->st_pad4)); + + return 0; +} diff --git a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c index 28bac57e58..0f3934f8c8 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c @@ -29,5 +29,3 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf) int r = INLINE_SYSCALL_CALL (lstat, name, &kbuf); return r ?: __xstat64_conv (vers, &kbuf, buf); } - -hidden_def (__lxstat64) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c index 99b03c7593..64d2952276 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c @@ -30,5 +30,3 @@ __xstat64 (int vers, const char *name, struct stat64 *buf) int r = INLINE_SYSCALL_CALL (stat, name, &kbuf); return r ?: __xstat64_conv (vers, &kbuf, buf); } - -hidden_def (__xstat64) diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c index 835691cf89..d6ff5ccbe0 100644 --- a/sysdeps/unix/sysv/linux/mips/xstat.c +++ b/sysdeps/unix/sysv/linux/mips/xstat.c @@ -39,4 +39,3 @@ __xstat (int vers, const char *name, struct stat *buf) } } } -hidden_def (__xstat) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h new file mode 100644 index 0000000000..0599b6a49e --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h @@ -0,0 +1,46 @@ +/* Struct kernel_stat64 to stat64. Linux/SPARC version. + Copyright (C) 2020 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 + +static inline int +__cp_stat64_kstat64 (struct stat64 *st64, const struct kernel_stat64 *kst64) +{ + st64->st_dev = kst64->st_dev; + st64->__pad1 = 0; + st64->st_ino = kst64->st_ino; + st64->st_mode = kst64->st_mode; + st64->st_nlink = kst64->st_nlink; + st64->st_uid = kst64->st_uid; + st64->st_gid = kst64->st_gid; + st64->st_rdev = kst64->st_rdev; + st64->__pad2 = 0; + st64->st_size = kst64->st_size; + st64->st_blksize = kst64->st_blksize; + st64->st_blocks = kst64->st_blocks; + st64->st_atim.tv_sec = kst64->st_atime_sec; + st64->st_atim.tv_nsec = kst64->st_atime_nsec; + st64->st_mtim.tv_sec = kst64->st_mtime_sec; + st64->st_mtim.tv_nsec = kst64->st_mtime_nsec; + st64->st_ctim.tv_sec = kst64->st_ctime_sec; + st64->st_ctim.tv_nsec = kst64->st_ctime_nsec; + st64->__glibc_reserved4 = 0; + st64->__glibc_reserved5 = 0; + + return 0; +} diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c index 0ae52b1901..a971e8cf6a 100644 --- a/sysdeps/unix/sysv/linux/xstat.c +++ b/sysdeps/unix/sysv/linux/xstat.c @@ -57,5 +57,4 @@ __xstat (int vers, const char *name, struct stat *buf) } } } -hidden_def (__xstat) #endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c index 4feb55f429..e3a42966f5 100644 --- a/sysdeps/unix/sysv/linux/xstat64.c +++ b/sysdeps/unix/sysv/linux/xstat64.c @@ -78,8 +78,6 @@ weak_alias (___xstat64, __GI___xstat); versioned_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2); strong_alias (___xstat64, __old__xstat64) compat_symbol (libc, __old__xstat64, __xstat64, GLIBC_2_1); -hidden_ver (___xstat64, __xstat64) #else strong_alias (___xstat64, __xstat64) -hidden_def (__xstat64) #endif From patchwork Thu Jul 23 19:46:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40167 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB55C38708DC; Thu, 23 Jul 2020 19:47:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB55C38708DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533636; bh=kzwsBsws+v3Bg6sOfGG4VOSYhSbHx/6/25wQx202z9g=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ZqmMuMKYShCYwjOKDdDusPv4niQVckkfsayrO/b9GWqefFQi6epDyDkU35JwbXDpR lyrtASQBC64dd4e5Mbz55n9Sy90q1qHPO3Ok7rT5ITjLXlaNUm4ze064qSMy8GmJpy Pp/5uVAd0GAkOQ1WtHhpL7BsBHUznc4JGxASacxM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by sourceware.org (Postfix) with ESMTPS id 35B4C386F44A for ; Thu, 23 Jul 2020 19:47:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 35B4C386F44A Received: by mail-qk1-x741.google.com with SMTP id g26so6578541qka.3 for ; Thu, 23 Jul 2020 12:47:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kzwsBsws+v3Bg6sOfGG4VOSYhSbHx/6/25wQx202z9g=; b=iUAS3l42zoMqDWmxrU4l7pRq/5gk/pNsB0DgllilW/HBk0fzYeRWM0ASxuR5wZKfsS hXqqNOQlrhb+mF1ExgXhA9lrx3XErIAoan/ZzihnMKwYRxKEQV75pgV7wfh+ygi9FcV3 IDVgMQ2d4RJ83o5eaInXq2VYu6FDpSX0Tg8hXEyjEZwHjPGld8VFS5Uenahap6vLnEM5 niJeeSR6Y873tvfuIetM5fTg09fSrYiIHv0eeExtjOFVFf9eOHPJ0H5QcIS48wyDR0TL I/fr4tguSplHpJcmm8WRcb5zztg9DaUF/CZUCjlYvoq8Zhj5CfZX0ipKgXXyqCSKQUCg wpdw== X-Gm-Message-State: AOAM530h9gts1j02YEakZ6Ww1l9VRbZ5zTYga4Ety69ID7Yf/IECwBnY /XjCD5A08lDIZZshjzdqLGoZSO4f17k= X-Google-Smtp-Source: ABdhPJyfYsGBgludKo/7JBex6yAIyybjDSuNU4R5VQGgGd6Fp7mtvgBc2FllSiprzxX3fJIp01+8JQ== X-Received: by 2002:a37:93c1:: with SMTP id v184mr6747313qkd.480.1595533632087; Thu, 23 Jul 2020 12:47:12 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:11 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 14/16] linux: Move {f}xstat{at} to compat symbols Date: Thu, 23 Jul 2020 16:46:39 -0300 Message-Id: <20200723194641.1949404-15-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" They are not used internally anymore. Checked with a build for all affected Linux ABIs. I checked also on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/alpha/fxstat64.c | 12 ++++++++++- sysdeps/unix/sysv/linux/alpha/fxstatat64.c | 9 +++++++- sysdeps/unix/sysv/linux/alpha/lxstat64.c | 12 ++++++++++- sysdeps/unix/sysv/linux/alpha/xstat64.c | 12 ++++++++++- sysdeps/unix/sysv/linux/fxstat.c | 8 +++++++ sysdeps/unix/sysv/linux/fxstat64.c | 14 +++++++++---- sysdeps/unix/sysv/linux/fxstatat.c | 8 +++++++ sysdeps/unix/sysv/linux/fxstatat64.c | 12 ++++++++++- sysdeps/unix/sysv/linux/lxstat.c | 8 +++++++ sysdeps/unix/sysv/linux/lxstat64.c | 21 ++++++++++++------- sysdeps/unix/sysv/linux/mips/fxstat.c | 8 +++++++ sysdeps/unix/sysv/linux/mips/lxstat.c | 8 +++++++ .../unix/sysv/linux/mips/mips64/fxstat64.c | 8 +++++++ .../unix/sysv/linux/mips/mips64/fxstatat.c | 8 +++++++ .../unix/sysv/linux/mips/mips64/fxstatat64.c | 8 +++++++ .../unix/sysv/linux/mips/mips64/lxstat64.c | 8 +++++++ sysdeps/unix/sysv/linux/mips/mips64/xstat64.c | 9 +++++++- sysdeps/unix/sysv/linux/mips/xstat.c | 8 +++++++ sysdeps/unix/sysv/linux/xstat.c | 9 ++++++++ sysdeps/unix/sysv/linux/xstat64.c | 15 ++++++++----- 20 files changed, 182 insertions(+), 23 deletions(-) diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat64.c b/sysdeps/unix/sysv/linux/alpha/fxstat64.c index 9d6b8eca32..bcfb55050c 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstat64.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstat64.c @@ -22,9 +22,11 @@ #include #include #include +#include /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __fxstat64 (int vers, int fd, struct stat64 *buf) { switch (vers) @@ -42,4 +44,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf) } } } -strong_alias (__fxstat64, __fxstat); + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) +strong_alias (__fxstat64, __fxstat_compat) +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_0); +#endif + +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33) +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_1); +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat64.c b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c index 997fb87ac6..fa3074eeca 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c @@ -22,11 +22,18 @@ #include #include #include +#include +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) { return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); } -strong_alias (__fxstatat64, __fxstatat); +strong_alias (__fxstatat64, __fxstatat_compat) +compat_symbol (libc, __fxstatat_compat, __fxstatat, GLIBC_2_4); + +compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4); +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/lxstat64.c b/sysdeps/unix/sysv/linux/alpha/lxstat64.c index 38f132f15e..7424b2f621 100644 --- a/sysdeps/unix/sysv/linux/alpha/lxstat64.c +++ b/sysdeps/unix/sysv/linux/alpha/lxstat64.c @@ -23,9 +23,11 @@ #include #include #include +#include /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __lxstat64 (int vers, const char *name, struct stat64 *buf) { switch (vers) @@ -43,4 +45,12 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf) } } } -weak_alias (__lxstat64, __lxstat); + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) +strong_alias (__lxstat64, __lxstat_compat) +compat_symbol (libc, __lxstat_compat, __lxstat, GLIBC_2_0); +#endif + +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33) +compat_symbol (libc, __lxstat64, __lxstat64, GLIBC_2_1); +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/xstat64.c b/sysdeps/unix/sysv/linux/alpha/xstat64.c index c856c95dc5..59f7ddae7f 100644 --- a/sysdeps/unix/sysv/linux/alpha/xstat64.c +++ b/sysdeps/unix/sysv/linux/alpha/xstat64.c @@ -23,9 +23,11 @@ #include #include #include +#include /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __xstat64 (int vers, const char *name, struct stat64 *buf) { switch (vers) @@ -43,4 +45,12 @@ __xstat64 (int vers, const char *name, struct stat64 *buf) } } } -weak_alias (__xstat64, __xstat); + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) +strong_alias (__xstat64, __xstat_compat) +compat_symbol (libc, __xstat_compat, __xstat, GLIBC_2_0); +#endif + +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33) +compat_symbol (libc, __xstat64, __xstat64, GLIBC_2_1); +#endif diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c index f78497ea92..649bb95252 100644 --- a/sysdeps/unix/sysv/linux/fxstat.c +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -24,9 +24,13 @@ #if !XSTAT_IS_XSTAT64 # include # include +# include + +# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) /* Get information about the file FD in BUF. */ int +attribute_compat_text_section __fxstat (int vers, int fd, struct stat *buf) { switch (vers) @@ -57,4 +61,8 @@ __fxstat (int vers, int fd, struct stat *buf) } } } + +compat_symbol (libc, __fxstat, __fxstat, GLIBC_2_0); +# endif /* SHLIB_COMPAT */ + #endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c index 6ae7babccc..726dfd0ad6 100644 --- a/sysdeps/unix/sysv/linux/fxstat64.c +++ b/sysdeps/unix/sysv/linux/fxstat64.c @@ -24,10 +24,14 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) /* Get information about the file FD in BUF. */ int +attribute_compat_text_section ___fxstat64 (int vers, int fd, struct stat64 *buf) { #if XSTAT_IS_XSTAT64 @@ -53,16 +57,18 @@ ___fxstat64 (int vers, int fd, struct stat64 *buf) #endif /* XSTAT_IS_XSTAT64 */ } -#include - #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) -versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2); +compat_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2); strong_alias (___fxstat64, __old__fxstat64) compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1); #else strong_alias (___fxstat64, __fxstat64) +compat_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2); #endif #if XSTAT_IS_XSTAT64 -strong_alias (__fxstat64, __fxstat); +strong_alias (___fxstat64, __fxstat_compat) +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_2); #endif + +#endif /* SHLIB_COMPAT */ diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c index 1a60fc10e3..2083e18eac 100644 --- a/sysdeps/unix/sysv/linux/fxstatat.c +++ b/sysdeps/unix/sysv/linux/fxstatat.c @@ -24,9 +24,13 @@ #if !XSTAT_IS_XSTAT64 # include # include +# include + +# if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) /* Get information about the file FD in BUF. */ int +attribute_compat_text_section __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { #if STAT_IS_KERNEL_STAT @@ -46,4 +50,8 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) return r ?: __xstat32_conv (vers, &st64, st); #endif } + +compat_symbol (libc, __fxstatat, __fxstatat, GLIBC_2_4); +# endif /* SHLIB_COMPAT */ + #endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c index 7fe034809c..8a505451d9 100644 --- a/sysdeps/unix/sysv/linux/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/fxstatat64.c @@ -24,10 +24,14 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) /* Get information about the file FD in BUF. */ int +attribute_compat_text_section __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) { #if XSTAT_IS_XSTAT64 @@ -61,6 +65,12 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) #endif return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } + +compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4); + #if XSTAT_IS_XSTAT64 -strong_alias (__fxstatat64, __fxstatat); +strong_alias (__fxstatat64, __fxstatat_compat) +compat_symbol (libc, __fxstatat_compat, __fxstatat, GLIBC_2_4); #endif + +#endif /* SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) */ diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c index 156173a4e1..f307aa4942 100644 --- a/sysdeps/unix/sysv/linux/lxstat.c +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -20,13 +20,17 @@ #include #include #include +#include #if !XSTAT_IS_XSTAT64 # include # include +# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) + /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __lxstat (int vers, const char *name, struct stat *buf) { switch (vers) @@ -58,4 +62,8 @@ __lxstat (int vers, const char *name, struct stat *buf) } } } + +compat_symbol (libc, __lxstat, __lxstat, GLIBC_2_0); +# endif /* SHLIB_COMPAT */ + #endif /* XSTAT_IS_XSTAT64 */ diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c index 29bd1cdf72..660d59aea3 100644 --- a/sysdeps/unix/sysv/linux/lxstat64.c +++ b/sysdeps/unix/sysv/linux/lxstat64.c @@ -24,10 +24,14 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section ___lxstat64 (int vers, const char *name, struct stat64 *buf) { #if XSTAT_IS_XSTAT64 @@ -70,17 +74,18 @@ ___lxstat64 (int vers, const char *name, struct stat64 *buf) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } -#if XSTAT_IS_XSTAT64 -weak_alias (___lxstat64, __lxstat); -weak_alias (___lxstat64, __GI___lxstat); -#endif - -#include - #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) -versioned_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2); +compat_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2); strong_alias (___lxstat64, __old__lxstat64) compat_symbol (libc, __old__lxstat64, __lxstat64, GLIBC_2_1); #else strong_alias (___lxstat64, __lxstat64); +compat_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2); #endif + +#if XSTAT_IS_XSTAT64 +strong_alias (___lxstat64,__lxstat_compat) +compat_symbol (libc, __lxstat_compat, __lxstat, GLIBC_2_2); +#endif + +#endif /* SHLIB_COMPAT */ diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c index 4585c2362b..cb9f656628 100644 --- a/sysdeps/unix/sysv/linux/mips/fxstat.c +++ b/sysdeps/unix/sysv/linux/mips/fxstat.c @@ -21,9 +21,13 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __fxstat (int vers, int fd, struct stat *buf) { switch (vers) @@ -39,3 +43,7 @@ __fxstat (int vers, int fd, struct stat *buf) } } } + +compat_symbol (libc, __fxstat, __fxstat, GLIBC_2_0); + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c index 62a3b15b32..ebd05cca50 100644 --- a/sysdeps/unix/sysv/linux/mips/lxstat.c +++ b/sysdeps/unix/sysv/linux/mips/lxstat.c @@ -21,9 +21,13 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __lxstat (int vers, const char *name, struct stat *buf) { switch (vers) @@ -39,3 +43,7 @@ __lxstat (int vers, const char *name, struct stat *buf) } } } + +compat_symbol (libc, __lxstat, __lxstat, GLIBC_2_0); + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c index e6c1cacd4b..855c650814 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c @@ -20,10 +20,14 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33) /* Get information about the file FD in BUF. */ int +attribute_compat_text_section __fxstat64 (int vers, int fd, struct stat64 *buf) { struct kernel_stat kbuf; @@ -31,3 +35,7 @@ __fxstat64 (int vers, int fd, struct stat64 *buf) return r ?: __xstat64_conv (vers, &kbuf, buf); } + +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_2); + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c index e384dbab8b..1c1fbb02c2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c @@ -21,12 +21,20 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) /* Get information about the file FD in BUF. */ int +attribute_compat_text_section __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { struct kernel_stat kst; int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); return r ?: __xstat_conv (vers, &kst, st); } + +compat_symbol (libc, __fxstatat, __fxstatat, GLIBC_2_4); + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c index cfd172d301..f40a2c5aa8 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c @@ -19,10 +19,14 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) { if (vers == _STAT_VER_LINUX) @@ -33,3 +37,7 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) } return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); } + +compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4); + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c index 0f3934f8c8..752c5284a7 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c @@ -20,12 +20,20 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __lxstat64 (int vers, const char *name, struct stat64 *buf) { struct kernel_stat kbuf; int r = INLINE_SYSCALL_CALL (lstat, name, &kbuf); return r ?: __xstat64_conv (vers, &kbuf, buf); } + +compat_symbol (libc, __lxstat64, __lxstat64, GLIBC_2_2); + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c index 64d2952276..a620ba2f1f 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c @@ -20,13 +20,20 @@ #include #include #include +#include -/* Get information about the file NAME in BUF. */ +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33) +/* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __xstat64 (int vers, const char *name, struct stat64 *buf) { struct kernel_stat kbuf; int r = INLINE_SYSCALL_CALL (stat, name, &kbuf); return r ?: __xstat64_conv (vers, &kbuf, buf); } + +compat_symbol (libc, __xstat64, __xstat64, GLIBC_2_2); + +#endif diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c index d6ff5ccbe0..0748a3422d 100644 --- a/sysdeps/unix/sysv/linux/mips/xstat.c +++ b/sysdeps/unix/sysv/linux/mips/xstat.c @@ -21,9 +21,13 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __xstat (int vers, const char *name, struct stat *buf) { switch (vers) @@ -39,3 +43,7 @@ __xstat (int vers, const char *name, struct stat *buf) } } } + +compat_symbol (libc, __xstat, __xstat, GLIBC_2_0); + +#endif diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c index a971e8cf6a..51329831b0 100644 --- a/sysdeps/unix/sysv/linux/xstat.c +++ b/sysdeps/unix/sysv/linux/xstat.c @@ -20,13 +20,17 @@ #include #include #include +#include #if !XSTAT_IS_XSTAT64 # include # include +# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) + /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section __xstat (int vers, const char *name, struct stat *buf) { switch (vers) @@ -57,4 +61,9 @@ __xstat (int vers, const char *name, struct stat *buf) } } } + +compat_symbol (libc, __xstat, __xstat, GLIBC_2_0); +# endif /* SHLIB_COMPAT */ + #endif /* XSTAT_IS_XSTAT64 */ + diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c index e3a42966f5..4872d24694 100644 --- a/sysdeps/unix/sysv/linux/xstat64.c +++ b/sysdeps/unix/sysv/linux/xstat64.c @@ -24,10 +24,14 @@ #include #include #include +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) /* Get information about the file NAME in BUF. */ int +attribute_compat_text_section ___xstat64 (int vers, const char *name, struct stat64 *buf) { #if XSTAT_IS_XSTAT64 @@ -68,16 +72,17 @@ ___xstat64 (int vers, const char *name, struct stat64 *buf) } #if XSTAT_IS_XSTAT64 -weak_alias (___xstat64, __xstat); -weak_alias (___xstat64, __GI___xstat); +strong_alias (___xstat64, __xstat_compat) +compat_symbol (libc, __xstat_compat, __xstat, GLIBC_2_2); #endif -#include - #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) -versioned_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2); +compat_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2); strong_alias (___xstat64, __old__xstat64) compat_symbol (libc, __old__xstat64, __xstat64, GLIBC_2_1); #else strong_alias (___xstat64, __xstat64) +compat_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2); #endif + +#endif /* SHLIB_COMPAT */ From patchwork Thu Jul 23 19:46:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40169 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A20163861968; Thu, 23 Jul 2020 19:47:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A20163861968 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533640; bh=LMKx8T5jkCS2CYBhctvvO6DzLWAj1yUtlWDQSLGrWPU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=UWAFOF4Zo4mQdwRsdId60Ew+EBCk0uSGKIeeUVIDUmVxO7csVG5KIl4prV+hOLdUy 9ZURGhAuRXObw8nNEtmdt1gAvUNZPDEQ7FCBF4SCnDC7m4kGNpjrqVs3ZGuhGhPE9i qFSwsa9+50yRpnJY7wQqz7td610e/hEa58q9ZkGg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by sourceware.org (Postfix) with ESMTPS id 0320B387086F for ; Thu, 23 Jul 2020 19:47:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0320B387086F Received: by mail-qk1-x744.google.com with SMTP id x69so6582641qkb.1 for ; Thu, 23 Jul 2020 12:47:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LMKx8T5jkCS2CYBhctvvO6DzLWAj1yUtlWDQSLGrWPU=; b=J0/PwNgyg7lyLf4uOWEEw0k2zgDIKfgOPg7xcwwLK0AgG2SJDZifJdowLc62Ewn75t us92MoxCbvUcG+nuKsbBdH6JBVjFyCyKpZsPCMHTKf/vFu7Hz1s4KuxywvZRDOmuVYBY xSGm0gyeg7ZdRr84YzxOf92WAPjfltrImVV2DB6E/7U8sf7oKCoe+pH4I6UCU3Z30aCb Hf4XOL6T0RYkAXi8DB8HjsfoT1hlKg/+z8VQs2+Lij0t3bYijZsgIKcaXiKQ7Q65j7Ms 8wKLHTgdlaZ8B15dPJ3MEzrssOPiPyvXKG1uSCXPUmCWQ5vudjYvn4aYda88r9Z0Ilgj Wx9Q== X-Gm-Message-State: AOAM530spcuk09PDz/I9rRNyFKlsXr4KjBTdptCFb2EuX9xD1/Ys0iE/ 2C1SIvHgqzKJeasOZfOqTnA536kmL2o= X-Google-Smtp-Source: ABdhPJwtaozj5m+0lTXk0P0qs0AMPwquUPWr2prNGKAniIX5JKpTeYDM4zYB4f5/PQX2d8iSIKpxbA== X-Received: by 2002:a05:620a:20dd:: with SMTP id f29mr6677316qka.484.1595533633772; Thu, 23 Jul 2020 12:47:13 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:13 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 15/16] linux: Add {f}stat{at} y2038 support Date: Thu, 23 Jul 2020 16:46:40 -0300 Message-Id: <20200723194641.1949404-16-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" A new struct __stat{64}_t64 type is added with the required __timespec64 time definition. Both non-LFS and LFS support were done with an extra __NR_statx call plus a conversion to the new __stat{64}_t64 type. The statx call is done only for architectures with support for 32-bit time_t ABI. Internally some extra routines to copy from/to struct stat{64} to struct __stat{64} used on multiple implementations (stat, fstat, lstat, and fstatat) are added on a extra file (stat_t64_cp.c). Aslo some extra routines to copy from statx to __stat{64} is added on statx_cp.c. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Acked-by: Lukasz Majewski --- include/sys/stat.h | 32 +++++ sysdeps/generic/struct_stat_time64.h | 7 + sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/fstat.c | 13 +- sysdeps/unix/sysv/linux/fstat64.c | 20 ++- sysdeps/unix/sysv/linux/fstatat.c | 64 +++++---- sysdeps/unix/sysv/linux/fstatat64.c | 88 ++++++++++--- sysdeps/unix/sysv/linux/lstat.c | 13 +- sysdeps/unix/sysv/linux/lstat64.c | 19 ++- .../unix/sysv/linux/mips/mips64/kstat_cp.h | 23 +--- .../unix/sysv/linux/mips/mips64/statx_cp.c | 3 - sysdeps/unix/sysv/linux/stat.c | 13 +- sysdeps/unix/sysv/linux/stat64.c | 20 ++- sysdeps/unix/sysv/linux/stat_t64_cp.c | 92 +++++++++++++ sysdeps/unix/sysv/linux/stat_t64_cp.h | 28 ++++ sysdeps/unix/sysv/linux/statx_cp.c | 54 ++++++++ sysdeps/unix/sysv/linux/statx_cp.h | 6 + sysdeps/unix/sysv/linux/struct_stat_time64.h | 122 ++++++++++++++++++ 18 files changed, 539 insertions(+), 80 deletions(-) create mode 100644 sysdeps/generic/struct_stat_time64.h delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/statx_cp.c create mode 100644 sysdeps/unix/sysv/linux/stat_t64_cp.c create mode 100644 sysdeps/unix/sysv/linux/stat_t64_cp.h create mode 100644 sysdeps/unix/sysv/linux/struct_stat_time64.h diff --git a/include/sys/stat.h b/include/sys/stat.h index 199173b007..87d4a5ec4f 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -3,6 +3,8 @@ #ifndef _ISOMAC # include +# include +# include # include static inline bool @@ -44,6 +46,36 @@ hidden_proto (__lstat64) hidden_proto (__fstatat64) # endif +# if __TIMESIZE == 64 +# define __stat_time64 __stat +# define __stat64_time64 __stat64 +# define __fstat_time64 __fstat +# define __fstat64_time64 __fstat64 +# define __lstat_time64 __lstat +# define __lstat64_time64 __lstat64 +# define __fstatat_time64 __fstatat +# define __fstatat64_time64 __fstatat64 +# else +extern int __stat_time64 (const char *file, struct __stat_t64 *buf); +libc_hidden_proto (__stat_time64); +extern int __stat64_time64 (const char *file, struct __stat64_t64 *buf); +hidden_proto (__stat64_time64); +extern int __lstat_time64 (const char *file, struct __stat_t64 *buf); +libc_hidden_proto (__lstat_time64); +extern int __lstat64_time64 (const char *file, struct __stat64_t64 *buf); +hidden_proto (__lstat64_time64); +extern int __fstat_time64 (int fd, struct __stat_t64 *buf); +libc_hidden_proto (__fstat_time64); +extern int __fstat64_time64 (int fd, struct __stat64_t64 *buf); +hidden_proto (__fstat64_time64); +extern int __fstatat_time64 (int dirfd, const char *pathname, + struct __stat_t64 *buf, int flags); +libc_hidden_proto (__fstatat_time64); +extern int __fstatat64_time64 (int dirfd, const char *pathname, + struct __stat64_t64 *buf, int flags); +hidden_proto (__fstatat64_time64); +# endif + extern int __chmod (const char *__file, __mode_t __mode); libc_hidden_proto (__chmod) extern int __fchmod (int __fd, __mode_t __mode); diff --git a/sysdeps/generic/struct_stat_time64.h b/sysdeps/generic/struct_stat_time64.h new file mode 100644 index 0000000000..24bb9f75cb --- /dev/null +++ b/sysdeps/generic/struct_stat_time64.h @@ -0,0 +1,7 @@ +#ifndef _BITS_STRUCT_STAT_TIME64_H +#define _BITS_STRUCT_STAT_TIME64_H 1 + +#define __stat_t64 stat +#define __stat64_t64 stat64 + +#endif diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index f189f65daf..95a51ee4f2 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -273,7 +273,7 @@ sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \ open_nocancel open64_nocancel \ openat_nocancel openat64_nocancel \ read_nocancel pread64_nocancel \ - write_nocancel statx_cp + write_nocancel statx_cp stat_t64_cp sysdep_headers += bits/fcntl-linux.h diff --git a/sysdeps/unix/sysv/linux/fstat.c b/sysdeps/unix/sysv/linux/fstat.c index bdbeded956..0981dbaa95 100644 --- a/sysdeps/unix/sysv/linux/fstat.c +++ b/sysdeps/unix/sysv/linux/fstat.c @@ -19,13 +19,24 @@ #include #include #include +#include #if !XSTAT_IS_XSTAT64 +int +__fstat_time64 (int fd, struct __stat_t64 *buf) +{ + return __fstatat_time64 (fd, "", buf, AT_EMPTY_PATH); +} +# if __TIMESIZE != 64 +libc_hidden_def (__fstat_time64) + int __fstat (int fd, struct stat *buf) { - return __fstatat (fd, "", buf, AT_EMPTY_PATH); + struct __stat_t64 st_t64; + return __fstat_time64 (fd, &st_t64) ?: __cp_stat_t64_stat (&st_t64, buf); } +# endif weak_alias (__fstat, fstat) #endif diff --git a/sysdeps/unix/sysv/linux/fstat64.c b/sysdeps/unix/sysv/linux/fstat64.c index c2ff1ff577..67667e79d8 100644 --- a/sysdeps/unix/sysv/linux/fstat64.c +++ b/sysdeps/unix/sysv/linux/fstat64.c @@ -19,16 +19,30 @@ #define __fstat __redirect___fstat #define fstat __redirect_fstat #include -#undef __fstat -#undef fstat #include #include +#include + +int +__fstat64_time64 (int fd, struct __stat64_t64 *buf) +{ + return __fstatat64_time64 (fd, "", buf, AT_EMPTY_PATH); +} +#if __TIMESIZE != 64 +hidden_def (__fstat64_time64) int __fstat64 (int fd, struct stat64 *buf) { - return __fstatat64 (fd, "", buf, AT_EMPTY_PATH); + struct __stat64_t64 st_t64; + return __fstat64_time64 (fd, &st_t64) + ?: __cp_stat64_t64_stat64 (&st_t64, buf); } +#endif + +#undef __fstat +#undef fstat + hidden_def (__fstat64) weak_alias (__fstat64, fstat64) diff --git a/sysdeps/unix/sysv/linux/fstatat.c b/sysdeps/unix/sysv/linux/fstatat.c index 03ddb3f493..f65d3b74a6 100644 --- a/sysdeps/unix/sysv/linux/fstatat.c +++ b/sysdeps/unix/sysv/linux/fstatat.c @@ -22,25 +22,28 @@ #if !XSTAT_IS_XSTAT64 # include +# include +# include int -__fstatat (int fd, const char *file, struct stat *st, int flag) +__fstatat_time64 (int fd, const char *file, struct __stat_t64 *st, int flag) { -# if STAT_IS_KERNEL_STAT - /* New kABIs which uses generic pre 64-bit time Linux ABI, e.g. - csky, nios2 */ - int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); - if (r == 0 && (st->__st_ino_pad != 0 - || st->__st_size_pad != 0 - || st->__st_blocks_pad != 0)) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); - return r; -# else -# ifdef __NR_fstatat64 - /* Old KABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, mips32, - microblaze, s390, sh, powerpc, and sparc. */ + struct statx stx; + int r = INLINE_SYSCALL_CALL (statx, fd, file, flag, STATX_BASIC_STATS, + &stx); + if (r == 0 || errno != ENOSYS) + { + if (r == 0) + __cp_stat_t64_statx (st, &stx); + return r; + } + +# ifdef __NR_fstatat64 + /* Both new kABI which uses generic pre 64-bit time Linux ABI (e.g. csky + and nios) and old kABI with non-LFS support (e.g. arm, i386, hppa, m68k, + mips32, microblaze, s390, sh, powerpc, and sparc32). */ struct stat64 st64; - int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); + r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); if (r == 0) { if (! in_ino_t_range (st64.st_ino) @@ -48,7 +51,7 @@ __fstatat (int fd, const char *file, struct stat *st, int flag) || ! in_blkcnt_t_range (st64.st_blocks)) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); - /* Clear internal pad and reserved fields. */ + /* Clear both pad and reserved fields. */ memset (st, 0, sizeof (*st)); st->st_dev = st64.st_dev, @@ -61,22 +64,29 @@ __fstatat (int fd, const char *file, struct stat *st, int flag) st->st_size = st64.st_size; st->st_blksize = st64.st_blksize; st->st_blocks = st64.st_blocks; - st->st_atim.tv_sec = st64.st_atim.tv_sec; - st->st_atim.tv_nsec = st64.st_atim.tv_nsec; - st->st_mtim.tv_sec = st64.st_mtim.tv_sec; - st->st_mtim.tv_nsec = st64.st_mtim.tv_nsec; - st->st_ctim.tv_sec = st64.st_ctim.tv_sec; - st->st_ctim.tv_nsec = st64.st_ctim.tv_nsec; + st->st_atim = valid_timespec_to_timespec64 (st64.st_atim); + st->st_mtim = valid_timespec_to_timespec64 (st64.st_mtim); + st->st_ctim = valid_timespec_to_timespec64 (st64.st_ctim); } return r; -# else +# else /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */ struct kernel_stat kst; - int r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); - return r ?: __cp_kstat_stat (&kst, st); -# endif /* __nr_fstatat64 */ -# endif /* STAT_IS_KERNEL_STAT */ + r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + return r ?: __cp_kstat_stat_t64 (&kst, st); +# endif /* __NR_fstatat64 */ +} +# if __TIMESIZE != 64 +libc_hidden_def (__fstatat_time64) + +int +__fstatat (int fd, const char *file, struct stat *buf, int flags) +{ + struct __stat_t64 st_t64; + return __fstatat_time64 (fd, file, &st_t64, flags) + ?: __cp_stat_t64_stat (&st_t64, buf); } +# endif weak_alias (__fstatat, fstatat) #endif diff --git a/sysdeps/unix/sysv/linux/fstatat64.c b/sysdeps/unix/sysv/linux/fstatat64.c index 82fab107a5..b3940f0d20 100644 --- a/sysdeps/unix/sysv/linux/fstatat64.c +++ b/sysdeps/unix/sysv/linux/fstatat64.c @@ -19,56 +19,102 @@ #define __fstatat __redirect___fstatat #define fstatat __redirect_fstatat #include -#undef __fstatat -#undef fstatat #include - +#include #include #include - +#include #include #include +#include int -__fstatat64 (int fd, const char *file, struct stat64 *st, int flag) +__fstatat64_time64 (int fd, const char *file, struct __stat64_t64 *st, + int flag) { + int r; + +#if (__WORDSIZE == 32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) + struct statx tmp; + r = INLINE_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, + STATX_BASIC_STATS, &tmp); + if (r == 0 || errno != ENOSYS) + { + if (r == 0) + __cp_stat64_t64_statx (st, &tmp); + return r; + } +#endif + #if XSTAT_IS_XSTAT64 # ifdef __NR_newfstatat /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and x86_64. */ - return INLINE_SYSCALL_CALL (newfstatat, fd, file, st, flag); + r = INLINE_SYSCALL_CALL (newfstatat, fd, file, st, flag); # elif defined __NR_fstatat64 # if STAT64_IS_KERNEL_STAT64 - /* 64-bit kABI outlier, e.g. alpha. */ - return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); + /* 64-bit kABI outlier, e.g. alpha */ + r = INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); # else /* 64-bit kABI outlier, e.g. sparc64. */ struct kernel_stat64 kst64; - int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &kst64, flag); - return r ?: __cp_stat64_kstat64 (st, &kst64); -# endif -# else - /* 32-bit kABI with default 64-bit time_t, e.g. arc, riscv32. */ - struct statx tmp; - int r = INLINE_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, - STATX_BASIC_STATS, &tmp); + r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &kst64, flag); if (r == 0) - __cp_stat64_statx (st, &tmp); - return r; + r = __cp_stat64_kstat64 (st, &kst64); +# endif # endif #else # ifdef __NR_fstatat64 /* All kABIs with non-LFS support, e.g. arm, csky, i386, hppa, m68k, microblaze, nios2, sh, powerpc32, and sparc32. */ - return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); + struct stat64 st64; + r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); + if (r == 0) + { + /* Clear both pad and reserved fields. */ + memset (st, 0, sizeof (*st)); + + st->st_dev = st64.st_dev, + st->st_ino = st64.st_ino; + st->st_mode = st64.st_mode; + st->st_nlink = st64.st_nlink; + st->st_uid = st64.st_uid; + st->st_gid = st64.st_gid; + st->st_rdev = st64.st_rdev; + st->st_size = st64.st_size; + st->st_blksize = st64.st_blksize; + st->st_blocks = st64.st_blocks; + st->st_atim = valid_timespec_to_timespec64 (st64.st_atim); + st->st_mtim = valid_timespec_to_timespec64 (st64.st_mtim); + st->st_ctim = valid_timespec_to_timespec64 (st64.st_ctim); + } # else /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */ struct kernel_stat kst; - int r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); - return r ?: __cp_kstat_stat64 (&kst, st); + r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + if (r == 0) + r = __cp_kstat_stat64_t64 (&kst, st); # endif #endif + + return r; } +#if __TIMESIZE != 64 +hidden_def (__fstatat64_time64) + +int +__fstatat64 (int fd, const char *file, struct stat64 *st, int flags) +{ + struct __stat64_t64 st_t64; + return __fstatat64_time64 (fd, file, &st_t64, flags) + ?: __cp_stat64_t64_stat64 (&st_t64, st); +} +#endif + +#undef __fstatat +#undef fstatat + hidden_def (__fstatat64) weak_alias (__fstatat64, fstatat64) diff --git a/sysdeps/unix/sysv/linux/lstat.c b/sysdeps/unix/sysv/linux/lstat.c index b0bdeee9e9..803ad78171 100644 --- a/sysdeps/unix/sysv/linux/lstat.c +++ b/sysdeps/unix/sysv/linux/lstat.c @@ -19,13 +19,24 @@ #include #include #include +#include #if !XSTAT_IS_XSTAT64 +int +__lstat_time64 (const char *file, struct __stat_t64 *buf) +{ + return __fstatat_time64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); +} +# if __TIMESIZE != 64 +libc_hidden_def (__lstat_time64) + int __lstat (const char *file, struct stat *buf) { - return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); + struct __stat_t64 st_t64; + return __lstat_time64 (file, &st_t64) ?: __cp_stat_t64_stat (&st_t64, buf); } +# endif weak_alias (__lstat, lstat) #endif diff --git a/sysdeps/unix/sysv/linux/lstat64.c b/sysdeps/unix/sysv/linux/lstat64.c index e5f02e9822..971ab8469d 100644 --- a/sysdeps/unix/sysv/linux/lstat64.c +++ b/sysdeps/unix/sysv/linux/lstat64.c @@ -19,19 +19,32 @@ #define __lstat __redirect___lstat #define lstat __redirect_lstat #include -#undef __lstat -#undef lstat #include #include +#include + +int +__lstat64_time64 (const char *file, struct __stat64_t64 *buf) +{ + return __fstatat64_time64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); +} +#if __TIMESIZE != 64 +hidden_def (__lstat64_time64) int __lstat64 (const char *file, struct stat64 *buf) { - return __fstatat64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); + struct __stat64_t64 st_t64; + return __lstat64_time64 (file, &st_t64) + ?: __cp_stat64_t64_stat64 (&st_t64, buf); } +#endif hidden_def (__lstat64) weak_alias (__lstat64, lstat64) +#undef __lstat +#undef lstat + #if XSTAT_IS_XSTAT64 strong_alias (__lstat64, __lstat) weak_alias (__lstat64, lstat) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h b/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h index 7f226416f9..553f4226bc 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h @@ -20,23 +20,21 @@ #include static inline int -__cp_kstat_stat (const struct kernel_stat *kst, struct stat *st) +__cp_kstat_stat_t64 (const struct kernel_stat *kst, struct __stat_t64 *st) { + if (! in_ino_t_range (kst->st_ino) + || ! in_off_t_range (kst->st_size) + || ! in_blkcnt_t_range (kst->st_blocks)) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); + st->st_dev = kst->st_dev; - memset (&st->st_pad1, 0, sizeof (st->st_pad1)); st->st_ino = kst->st_ino; - if (st->st_ino != kst->st_ino) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); st->st_mode = kst->st_mode; st->st_nlink = kst->st_nlink; st->st_uid = kst->st_uid; st->st_gid = kst->st_gid; st->st_rdev = kst->st_rdev; - memset (&st->st_pad2, 0, sizeof (st->st_pad2)); st->st_size = kst->st_size; - if (st->st_size != kst->st_size) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); - st->st_pad3 = 0; st->st_atim.tv_sec = kst->st_atime_sec; st->st_atim.tv_nsec = kst->st_atime_nsec; st->st_mtim.tv_sec = kst->st_mtime_sec; @@ -45,26 +43,20 @@ __cp_kstat_stat (const struct kernel_stat *kst, struct stat *st) st->st_ctim.tv_nsec = kst->st_ctime_nsec; st->st_blksize = kst->st_blksize; st->st_blocks = kst->st_blocks; - if (st->st_blocks != kst->st_blocks) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); - memset (&st->st_pad5, 0, sizeof (st->st_pad5)); return 0; } static inline int -__cp_kstat_stat64 (const struct kernel_stat *kst, struct stat64 *st) +__cp_kstat_stat64_t64 (const struct kernel_stat *kst, struct __stat64_t64 *st) { st->st_dev = kst->st_dev; - memset (&st->st_pad1, 0, sizeof (st->st_pad1)); st->st_ino = kst->st_ino; st->st_mode = kst->st_mode; st->st_nlink = kst->st_nlink; st->st_uid = kst->st_uid; st->st_gid = kst->st_gid; st->st_rdev = kst->st_rdev; - memset (&st->st_pad2, 0, sizeof (st->st_pad2)); - st->st_pad3 = 0; st->st_size = kst->st_size; st->st_blksize = kst->st_blksize; st->st_blocks = kst->st_blocks; @@ -74,7 +66,6 @@ __cp_kstat_stat64 (const struct kernel_stat *kst, struct stat64 *st) st->st_mtim.tv_nsec = kst->st_mtime_nsec; st->st_ctim.tv_sec = kst->st_ctime_sec; st->st_ctim.tv_nsec = kst->st_ctime_nsec; - memset (&st->st_pad4, 0, sizeof (st->st_pad4)); return 0; } diff --git a/sysdeps/unix/sysv/linux/mips/mips64/statx_cp.c b/sysdeps/unix/sysv/linux/mips/mips64/statx_cp.c deleted file mode 100644 index 260cda987e..0000000000 --- a/sysdeps/unix/sysv/linux/mips/mips64/statx_cp.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Override the generic statx_cp.c which is only needed for new 32-bit arch - without stat64 family support. - */ diff --git a/sysdeps/unix/sysv/linux/stat.c b/sysdeps/unix/sysv/linux/stat.c index a77502eb95..dcbc22da29 100644 --- a/sysdeps/unix/sysv/linux/stat.c +++ b/sysdeps/unix/sysv/linux/stat.c @@ -19,13 +19,24 @@ #include #include #include +#include #if !XSTAT_IS_XSTAT64 +int +__stat_time64 (const char *file, struct __stat_t64 *buf) +{ + return __fstatat_time64 (AT_FDCWD, file, buf, 0); +} +# if __TIMESIZE != 64 +libc_hidden_def (__stat_time64); + int __stat (const char *file, struct stat *buf) { - return __fstatat (AT_FDCWD, file, buf, 0); + struct __stat_t64 st_t64; + return __stat_time64 (file, &st_t64) ?: __cp_stat_t64_stat (&st_t64, buf); } +# endif weak_alias (__stat, stat) #endif diff --git a/sysdeps/unix/sysv/linux/stat64.c b/sysdeps/unix/sysv/linux/stat64.c index 2f40037c2c..bd8b17ac49 100644 --- a/sysdeps/unix/sysv/linux/stat64.c +++ b/sysdeps/unix/sysv/linux/stat64.c @@ -19,16 +19,30 @@ #define __stat __redirect___stat #define stat __redirect_stat #include -#undef __stat -#undef stat #include #include +#include + +int +__stat64_time64 (const char *file, struct __stat64_t64 *buf) +{ + return __fstatat64_time64 (AT_FDCWD, file, buf, 0); +} +#if __TIMESIZE != 64 +hidden_def (__stat64_time64) int __stat64 (const char *file, struct stat64 *buf) { - return __fstatat64 (AT_FDCWD, file, buf, 0); + struct __stat64_t64 st_t64; + return __stat64_time64 (file, &st_t64) + ?: __cp_stat64_t64_stat64 (&st_t64, buf); } +#endif + +#undef __stat +#undef stat + hidden_def (__stat64) weak_alias (__stat64, stat64) diff --git a/sysdeps/unix/sysv/linux/stat_t64_cp.c b/sysdeps/unix/sysv/linux/stat_t64_cp.c new file mode 100644 index 0000000000..56459b6266 --- /dev/null +++ b/sysdeps/unix/sysv/linux/stat_t64_cp.c @@ -0,0 +1,92 @@ +/* Struct stat/stat64 to stat/stat64 conversion for Linux. + Copyright (C) 2020 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 + +#if __TIMESIZE != 64 +/* Convert the 64-bit time_t stat ST_T64 to the non-LFS ST stat and returns + EOVERFLOW if any of time (access, modification, status) is larger than + 32-bit time_t. It is used on non-LFS stat, fstat, lstat, and fstatat to + convert from the the 64-bit time_t call. */ +int +__cp_stat_t64_stat (const struct __stat_t64 *st_t64, struct stat *st) +{ + if (! in_time_t_range (st_t64->st_atim.tv_sec) + || ! in_time_t_range (st_t64->st_mtim.tv_sec) + || ! in_time_t_range (st_t64->st_ctim.tv_sec)) + { + __set_errno (EOVERFLOW); + return -1; + } + + /* Clear both pad and reserved fields. */ + memset (st, 0, sizeof (*st)); + + st->st_dev = st_t64->st_dev, + st->st_ino = st_t64->st_ino; + st->st_mode = st_t64->st_mode; + st->st_nlink = st_t64->st_nlink; + st->st_uid = st_t64->st_uid; + st->st_gid = st_t64->st_gid; + st->st_rdev = st_t64->st_rdev; + st->st_size = st_t64->st_size; + st->st_blksize = st_t64->st_blksize; + st->st_blocks = st_t64->st_blocks; + st->st_atim = valid_timespec64_to_timespec (st_t64->st_atim); + st->st_mtim = valid_timespec64_to_timespec (st_t64->st_mtim); + st->st_ctim = valid_timespec64_to_timespec (st_t64->st_ctim); + + return 0; +} + +int +__cp_stat64_t64_stat64 (const struct __stat64_t64 *st64_t64, + struct stat64 *st64) +{ + if (! in_time_t_range (st64_t64->st_atim.tv_sec) + || ! in_time_t_range (st64_t64->st_mtim.tv_sec) + || ! in_time_t_range (st64_t64->st_ctim.tv_sec)) + { + __set_errno (EOVERFLOW); + return -1; + } + + /* Clear both pad and reserved fields. */ + memset (st64, 0, sizeof (*st64)); + + st64->st_dev = st64_t64->st_dev, + st64->st_ino = st64_t64->st_ino; + st64->st_mode = st64_t64->st_mode; + st64->st_nlink = st64_t64->st_nlink; + st64->st_uid = st64_t64->st_uid; + st64->st_gid = st64_t64->st_gid; + st64->st_rdev = st64_t64->st_rdev; + st64->st_size = st64_t64->st_size; + st64->st_blksize = st64_t64->st_blksize; + st64->st_blocks = st64_t64->st_blocks; + st64->st_atim = valid_timespec64_to_timespec (st64_t64->st_atim); + st64->st_mtim = valid_timespec64_to_timespec (st64_t64->st_mtim); + st64->st_ctim = valid_timespec64_to_timespec (st64_t64->st_ctim); + + return 0; +} + +#endif diff --git a/sysdeps/unix/sysv/linux/stat_t64_cp.h b/sysdeps/unix/sysv/linux/stat_t64_cp.h new file mode 100644 index 0000000000..ad2bcc7a04 --- /dev/null +++ b/sysdeps/unix/sysv/linux/stat_t64_cp.h @@ -0,0 +1,28 @@ +/* Copy to/from struct stat with and without 64-bit time_t support. + Copyright (C) 2020 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 + +#if __TIMESIZE != 64 +extern int __cp_stat_t64_stat (const struct __stat_t64 *st_t64, + struct stat *st) + attribute_hidden; +extern int __cp_stat64_t64_stat64 (const struct __stat64_t64 *st64_t64, + struct stat64 *st64) + attribute_hidden; +#endif diff --git a/sysdeps/unix/sysv/linux/statx_cp.c b/sysdeps/unix/sysv/linux/statx_cp.c index cc6e17929e..4b35e86f8d 100644 --- a/sysdeps/unix/sysv/linux/statx_cp.c +++ b/sysdeps/unix/sysv/linux/statx_cp.c @@ -47,3 +47,57 @@ __cp_stat64_statx (struct stat64 *to, struct statx *from) to->st_blksize = from->stx_blksize; } #endif + +void +__cp_stat_t64_statx (struct __stat_t64 *to, const struct statx *from) +{ + /* Clear both pad and reserved fields. */ + memset (to, 0, sizeof (*to)); + + to->st_dev = ((from->stx_dev_minor & 0xff) | (from->stx_dev_major << 8) + | ((from->stx_dev_minor & ~0xff) << 12)); + to->st_ino = from->stx_ino; + to->st_mode = from->stx_mode; + to->st_nlink = from->stx_nlink; + to->st_uid = from->stx_uid; + to->st_gid = from->stx_gid; + to->st_rdev = ((from->stx_rdev_minor & 0xff) | (from->stx_rdev_major << 8) + | ((from->stx_rdev_minor & ~0xff) << 12)); + to->st_size = from->stx_size; + to->st_blksize = from->stx_blksize; + to->st_blocks = from->stx_blocks; + + to->st_atime = from->stx_atime.tv_sec; + to->st_atim.tv_nsec = from->stx_atime.tv_nsec; + to->st_mtime = from->stx_mtime.tv_sec; + to->st_mtim.tv_nsec = from->stx_mtime.tv_nsec; + to->st_ctime = from->stx_ctime.tv_sec; + to->st_ctim.tv_nsec = from->stx_ctime.tv_nsec; +} + +void +__cp_stat64_t64_statx (struct __stat64_t64 *to, const struct statx *from) +{ + /* Clear both pad and reserved fields. */ + memset (to, 0, sizeof (*to)); + + to->st_dev = ((from->stx_dev_minor & 0xff) | (from->stx_dev_major << 8) + | ((from->stx_dev_minor & ~0xff) << 12)); + to->st_ino = from->stx_ino; + to->st_mode = from->stx_mode; + to->st_nlink = from->stx_nlink; + to->st_uid = from->stx_uid; + to->st_gid = from->stx_gid; + to->st_rdev = ((from->stx_rdev_minor & 0xff) | (from->stx_rdev_major << 8) + | ((from->stx_rdev_minor & ~0xff) << 12)); + to->st_size = from->stx_size; + to->st_blksize = from->stx_blksize; + to->st_blocks = from->stx_blocks; + + to->st_atime = from->stx_atime.tv_sec; + to->st_atim.tv_nsec = from->stx_atime.tv_nsec; + to->st_mtime = from->stx_mtime.tv_sec; + to->st_mtim.tv_nsec = from->stx_mtime.tv_nsec; + to->st_ctime = from->stx_ctime.tv_sec; + to->st_ctim.tv_nsec = from->stx_ctime.tv_nsec; +} diff --git a/sysdeps/unix/sysv/linux/statx_cp.h b/sysdeps/unix/sysv/linux/statx_cp.h index fdbb807a31..bf3186ffac 100644 --- a/sysdeps/unix/sysv/linux/statx_cp.h +++ b/sysdeps/unix/sysv/linux/statx_cp.h @@ -18,3 +18,9 @@ extern void __cp_stat64_statx (struct stat64 *to, struct statx *from) attribute_hidden; +extern void __cp_stat_t64_statx (struct __stat_t64 *to, + const struct statx *from) + attribute_hidden; +extern void __cp_stat64_t64_statx (struct __stat64_t64 *to, + const struct statx *from) + attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/struct_stat_time64.h b/sysdeps/unix/sysv/linux/struct_stat_time64.h new file mode 100644 index 0000000000..b2a51927d0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/struct_stat_time64.h @@ -0,0 +1,122 @@ +/* Struct stat with 64-bit time support. + Copyright (C) 2020 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 + . */ + +#ifndef _BITS_STRUCT_STAT_TIME64_H +#define _BITS_STRUCT_STAT_TIME64_H 1 + +#if __TIMESIZE == 64 +# define __stat_t64 stat +# define __stat64_t64 stat64 +#else +# include + +# ifdef __USE_FILE_OFFSET64 +# define __field64(type, type64, name) type64 name +# else +# define __field64(type, type64, name) type name +# endif + +/* The definition should be equal to the 'struct __timespec64' internal + layout. */ +# if BYTE_ORDER == BIG_ENDIAN +# define __fieldts64(name) \ + __time64_t name; __int32_t :32; __int32_t name ## nsec +# else +# define __fieldts64(name) \ + __time64_t name; __int32_t name ## nsec; __int32_t :32 +# endif + +/* Workaround for the definition from struct_stat.h */ +# undef st_atime +# undef st_mtime +# undef st_ctime + +struct __stat_t64 + { + __dev_t st_dev; /* Device. */ + __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct __timespec64 st_atim; /* Time of last access. */ + struct __timespec64 st_mtim; /* Time of last modification. */ + struct __timespec64 st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __fieldts64 (st_atime); + __fieldts64 (st_mtime); + __fieldts64 (st_ctime); +# endif /* __USE_XOPEN2K8 */ + }; + +# undef __field64 + +#ifdef __USE_LARGEFILE64 +struct __stat64_t64 + { + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct __timespec64 st_atim; /* Time of last access. */ + struct __timespec64 st_mtim; /* Time of last modification. */ + struct __timespec64 st_ctim; /* Time of last status change. */ +# else + __fieldts64 (st_atime); + __fieldts64 (st_mtime); + __fieldts64 (st_ctime); +# endif /* __USE_XOPEN2K8 */ + }; +# endif /* __USE_LARGEFILE64 */ + +# undef __fieldts64 + +# define _STATBUF_ST_BLKSIZE +# define _STATBUF_ST_RDEV +# define _STATBUF_ST_NSEC + +# endif /* __TIMESIZE == 64 */ + +#endif /* _BITS_STRUCT_STAT_TIME64_H */ From patchwork Thu Jul 23 19:46:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40168 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 034203840C2F; Thu, 23 Jul 2020 19:47:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 034203840C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595533640; bh=ekXoJLfPfupexeZFBIW2+n9uuE1g2lXhOKqu1dV2ss0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=TN5K3uWUryInpCBAtRkgbJ62DEVjvJdI/pfZGIG2812EaulcyV3+SfpWIbo80Hcu7 1oQlQKOnGsbTyygKqZstIiqmBL/gCN2YItybPPB4BNSxvdfsOUClmiey+Hlvi94ZSd UvJqerP87kut71EtjhOnnV3XpufSgjXeRlFolscg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by sourceware.org (Postfix) with ESMTPS id 34EFF3857002 for ; Thu, 23 Jul 2020 19:47:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 34EFF3857002 Received: by mail-qk1-x741.google.com with SMTP id h7so6549847qkk.7 for ; Thu, 23 Jul 2020 12:47:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ekXoJLfPfupexeZFBIW2+n9uuE1g2lXhOKqu1dV2ss0=; b=QYUrPKDx8V37KYRChwvH7lBD/HUvaW/FX//AdHPn+2NR8xTizLhGzYhz8lKyW/Z3gi J7Xdf8hIEk2lytaU5oZrPYYywLy//5lQzGsIhuPDMi8CSGXV5mTrWhOkQgtoEMOH3BKx XzagfVtM1DAWWbXG+s26RRYnP+voUeJI0jmfJZP334InFclFXxoqg7hA7nOPh/WTtNjJ I2mq2Umr52c4FsfGdRVPohA7eD4y+0FO3DwXCDChR5qxBSqd9U7pdOY0jxFQFrmAj1a0 fFfT9XwIDp2cIliLY2Y431bsAOHmA4NdmRtwdK1E1amAUSIAubTFukJrc4H9uCXLpZ8v 4KSA== X-Gm-Message-State: AOAM5308rjP0DxFTGnVfYWX/TIUsBwY9lAye8XGIHy32ymdQYqw3pPT/ 5ahZ9TlhjuLtGa6bvP5+ROgl9alKC4w= X-Google-Smtp-Source: ABdhPJwOVFWN4zNIzGh7nog2gOrAqX5zWCCNMh4blvr05q5EeWrfLlW+OzvXh0udXaoZosmANVXygw== X-Received: by 2002:a37:6447:: with SMTP id y68mr7129342qkb.351.1595533635473; Thu, 23 Jul 2020 12:47:15 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id k56sm3570639qtk.61.2020.07.23.12.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 12:47:15 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 16/16] linux: Move xmknoda{at} to compat symbols Date: Thu, 23 Jul 2020 16:46:41 -0300 Message-Id: <20200723194641.1949404-17-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> References: <20200723194641.1949404-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It also decouple mknod{at} from xmknod{at}. Checked with a build for all affected Linux ABIs. I checked also on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- include/sys/stat.h | 6 +++-- sysdeps/mach/hurd/xmknod.c | 1 - sysdeps/mach/hurd/xmknodat.c | 2 -- sysdeps/unix/sysv/linux/mknod.c | 28 ++++++++++++++++++++ sysdeps/unix/sysv/linux/mknodat.c | 41 ++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/xmknod.c | 20 +++++---------- sysdeps/unix/sysv/linux/xmknodat.c | 23 +++++------------ 7 files changed, 86 insertions(+), 35 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/mknod.c create mode 100644 sysdeps/unix/sysv/linux/mknodat.c diff --git a/include/sys/stat.h b/include/sys/stat.h index 87d4a5ec4f..da8b14fee0 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -84,6 +84,8 @@ extern __mode_t __umask (__mode_t __mask); extern int __mkdir (const char *__path, __mode_t __mode); libc_hidden_proto (__mkdir) +extern int __mknodat_common (int fd, const char *, __mode_t, __dev_t *) + attribute_hidden; extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev); libc_hidden_proto (__mknodat); extern int __mknod (const char *__path, @@ -92,10 +94,8 @@ libc_hidden_proto (__mknod); extern int __xmknod (int __ver, const char *__path, __mode_t __mode, __dev_t *__dev); -libc_hidden_proto (__xmknod) extern int __xmknodat (int __ver, int __fd, const char *__path, __mode_t __mode, __dev_t *__dev); -libc_hidden_proto (__xmknodat) int __fxstat (int __ver, int __fildes, struct stat *__stat_buf); int __xstat (int __ver, const char *__filename, @@ -121,6 +121,8 @@ hidden_proto (__xstat64); hidden_proto (__lxstat64); hidden_proto (__fxstatat64); # endif +libc_hidden_proto (__xmknod) +libc_hidden_proto (__xmknodat) # define stat(fname, buf) __xstat (_STAT_VER, fname, buf) # define lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) # define __lstat(fname, buf) __lxstat (_STAT_VER, fname, buf) diff --git a/sysdeps/mach/hurd/xmknod.c b/sysdeps/mach/hurd/xmknod.c index 0ab4f1b719..67e32f518d 100644 --- a/sysdeps/mach/hurd/xmknod.c +++ b/sysdeps/mach/hurd/xmknod.c @@ -30,4 +30,3 @@ __xmknod (int vers, const char *file_name, mode_t mode, dev_t *dev) { return __xmknodat (vers, AT_FDCWD, file_name, mode, dev); } -libc_hidden_def (__xmknod) diff --git a/sysdeps/mach/hurd/xmknodat.c b/sysdeps/mach/hurd/xmknodat.c index 4239d1ea91..0333765ebc 100644 --- a/sysdeps/mach/hurd/xmknodat.c +++ b/sysdeps/mach/hurd/xmknodat.c @@ -116,5 +116,3 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev) return __hurd_fail (err); return 0; } - -libc_hidden_def (__xmknodat) diff --git a/sysdeps/unix/sysv/linux/mknod.c b/sysdeps/unix/sysv/linux/mknod.c new file mode 100644 index 0000000000..3185726f52 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mknod.c @@ -0,0 +1,28 @@ +/* Create a special or ordinary file. Linux version. + Copyright (C) 2020 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 + +int +__mknod (const char *path, mode_t mode, dev_t dev) +{ + return __mknodat_common (AT_FDCWD, path, mode, &dev); +} +libc_hidden_def (__mknod) +weak_alias (__mknod, mknod) diff --git a/sysdeps/unix/sysv/linux/mknodat.c b/sysdeps/unix/sysv/linux/mknodat.c new file mode 100644 index 0000000000..d160fe520b --- /dev/null +++ b/sysdeps/unix/sysv/linux/mknodat.c @@ -0,0 +1,41 @@ +/* Create a special or ordinary file. Linux version. + Copyright (C) 2020 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 + +int +__mknodat_common (int fd, const char *path, mode_t mode, dev_t *dev) +{ + /* We must convert the value to dev_t type used by the kernel. */ + unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1); + if (k_dev != *dev) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); + + return INLINE_SYSCALL_CALL (mknodat, fd, path, mode, + (unsigned int) k_dev); +} + +int +__mknodat (int fd, const char *path, mode_t mode, dev_t dev) +{ + return __mknodat_common (fd, path, mode, &dev); +} +libc_hidden_def (__mknodat) +weak_alias (__mknodat, mknodat) diff --git a/sysdeps/unix/sysv/linux/xmknod.c b/sysdeps/unix/sysv/linux/xmknod.c index 42809d4c57..2ae384a536 100644 --- a/sysdeps/unix/sysv/linux/xmknod.c +++ b/sysdeps/unix/sysv/linux/xmknod.c @@ -17,29 +17,23 @@ . */ #include -#include #include -#include +#include +#include +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33) /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ int +attribute_compat_text_section __xmknod (int vers, const char *path, mode_t mode, dev_t *dev) { - unsigned long long int k_dev; - if (vers != _MKNOD_VER) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - /* We must convert the value to dev_t type used by the kernel. */ - k_dev = (*dev) & ((1ULL << 32) - 1); - if (k_dev != *dev) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - - return INLINE_SYSCALL_CALL (mknodat, AT_FDCWD, path, mode, - (unsigned int) k_dev); + return __mknodat_common (AT_FDCWD, path, mode, dev); } -weak_alias (__xmknod, _xmknod) -libc_hidden_def (__xmknod) +compat_symbol (libc, __xmknod, __xmknod, GLIBC_2_0); +#endif diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c index 5640a499aa..11b52a29b2 100644 --- a/sysdeps/unix/sysv/linux/xmknodat.c +++ b/sysdeps/unix/sysv/linux/xmknodat.c @@ -15,18 +15,11 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include -#include -#include #include -#include - -#include -#include - +#include +#include +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) /* Create a device file named PATH relative to FD, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ @@ -36,12 +29,8 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev) if (vers != _MKNOD_VER) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - /* We must convert the value to dev_t type used by the kernel. */ - unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1); - if (k_dev != *dev) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - - return INLINE_SYSCALL (mknodat, 4, fd, file, mode, (unsigned int) k_dev); + return __mknodat_common (fd, file, mode, dev); } -libc_hidden_def (__xmknodat) +compat_symbol (libc, __xmknodat, __xmknodat, GLIBC_2_4); +#endif