From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 2E2073858D28 for ; Tue, 23 Nov 2021 21:39:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2E2073858D28 Received: by mail-pj1-x1029.google.com with SMTP id gx15-20020a17090b124f00b001a695f3734aso537737pjb.0 for ; Tue, 23 Nov 2021 13:39:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=hZI1/1f4C79Osd17gnend6S6wd18RcdECfYC0OxlWpc=; b=17n5XWdo5fHTbJuww/Mi2EHk4VmDvzdI3rO1/J1ahDkWUKqNo4ncRE0xQTXtPEqmcf ymnjH4yPUqBJRlPT+Ir4hvTthtfM0G/vZi1BVHg2ATSfSA+cQHMi/bQN5J2RH4bctbh8 fv+L+sUCTLVHzuzXLXIBcYHLIdZDq2kGUaJ5UmiUVpJhgJ9KmDgrjEaH+BTXSSDEf2lJ Y2RjY/EwZOqSV2Jm/uEBcyqiepxMORBGKxrF5uPxibkfErtESTfXgphCLMyHmQpz3olL Q39OGSEGgyVThXbIqY42rRQgNN1zhNuHgF0QvgzLhgQviiHqZMrRfHcHrOMR1sfC4J9H JENA== X-Gm-Message-State: AOAM532177EdwBlq5Pe02rsl1rw+8ACPSDfEM7LLTGpk9gWVAZYupjjl 90TXJTDvCBt6rHLqzH77BIi6MSKfhVk= X-Google-Smtp-Source: ABdhPJynHIn7kg8osuctGAnkRuXl8XULvAo0OxMXEViTRcxSytnAaFIn+h/bSlYE6dZkpqOYOmn3ng== X-Received: by 2002:a17:90a:bb03:: with SMTP id u3mr7414887pjr.85.1637703547142; Tue, 23 Nov 2021 13:39:07 -0800 (PST) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id mu4sm2529503pjb.8.2021.11.23.13.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 13:39:05 -0800 (PST) Date: Wed, 24 Nov 2021 06:39:04 +0900 From: Stafford Horne To: Adhemerval Zanella Cc: GLIBC patches Subject: Re: [PATCH] linux: Define STAT64_IS_KERNEL_STAT64 by default Message-ID: References: <20211120210901.3991578-1-shorne@gmail.com> <7bea3e23-bbde-e5c8-137d-1fc105c1a7b7@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <7bea3e23-bbde-e5c8-137d-1fc105c1a7b7@linaro.org> X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Tue, 23 Nov 2021 21:39:10 -0000 On Mon, Nov 22, 2021 at 10:00:31AM -0300, Adhemerval Zanella wrote: >=20 >=20 > On 20/11/2021 18:09, Stafford Horne via Libc-alpha wrote: > > In commit 36260d5035 ("linux: Set default kernel_stat.h to LFS") the > > default for STAT64_IS_KERNEL_STAT64 was removed. This patch adds it > > back. > >=20 > > For architectures that want to used the default kernel_stat.h and do not > > have __NR_newfstatat, STAT64_IS_KERNEL_STAT64 needs to be defined. Set > > the default as 1 as modern port's stat64 struct should match the kernel > > stat64 layout. > >=20 > > I tested this on the OpenRISC port and it seems to work fine. Currentl= y, > > all archs that use the default kernel_stat.h define __NR_newfstatat so > > they will not use the STAT64_IS_KERNEL_STAT64 macro. However, arc seems > > to be an outlier it uses the default kernel_stat.h, but does not define > > __NR_newfstatat or __NR_fstatat64 I am not clear how arc works here. >=20 > arc and usually newer 32-bit ports will only use __NR_statx: >=20 > 138 #if (__WORDSIZE =3D=3D 32 \ > 139 && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE =3D=3D 32)= ) \ > 140 || defined STAT_HAS_TIME32 > 141 # define FSTATAT_USE_STATX 1 > 142 #else > 143 # define FSTATAT_USE_STATX 0 > 144 #endif >=20 > The patch looks ok, but it seems strange that ork1 requires it since it > setting minimum required kernel to 5.10. I would expect that __ASSUME_STA= TX > would be defined and only fstatat64_time64_statx would be used. Right, In that case maybe another ifdef is needed in fstatat64.c? I don't see fstatat64_time64_stat is actually getting compiled into the libc.so binary.= But if I don't define STAT64_IS_KERNEL_STAT64 I get the below compile error. I added a pragma to output the value of FSTATAT_USE_STATX and __ASSUME_STAT= X in the compile unit and I get the below which looks right: * __ASSUME_STATX: 1 * FSTATAT_USE_STATX: 1 Error: or1k-glibc-linux-gnu-gcc ../sysdeps/unix/sysv/linux/fstatat64.c -c -std=3Dg= nu11 -fgnu89-inline -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-a= ll-constants -frounding-math -fno-stack-protector -fno-common -Wstrict-prot= otypes -Wold-style-definition -fmath-errno -ftls-model=3Dinitial-exec = -I../include -I/home/shorne/work/gnu-toolchain/build-many/build/glibcs= /or1k-linux-gnu-soft/glibc/io -I/home/shorne/work/gnu-toolchain/build-many= /build/glibcs/or1k-linux-gnu-soft/glibc -I../sysdeps/unix/sysv/linux/or1k = -I../sysdeps/or1k/nptl -I../sysdeps/unix/sysv/linux/generic/wordsize-32 = -I../sysdeps/unix/sysv/linux/generic -I../sysdeps/unix/sysv/linux/include = -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I..= /sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/= unix -I../sysdeps/posix -I../sysdeps/or1k/nofpu -I../sysdeps/ieee754/sof= t-fp -I../sysdeps/or1k -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/dbl= -64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generi= c -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/shorne/work/gnu-to= olchain/build-many/build/glibcs/or1k-linux-gnu-soft/glibc/libc-modules.h -D= MODULE_NAME=3Dlibc -include ../include/libc-symbols.h -DTOP_NAMESPACE= =3Dglibc -o /home/shorne/work/gnu-toolchain/build-many/build/glibcs/or1k-li= nux-gnu-soft/glibc/io/fstatat64.o -MD -MP -MF /home/shorne/work/gnu-toolcha= in/build-many/build/glibcs/or1k-linux-gnu-soft/glibc/io/fstatat64.o.dt -MT = /home/shorne/work/gnu-toolchain/build-many/build/glibcs/or1k-linux-gnu-soft= /glibc/io/fstatat64.o =2E./sysdeps/unix/sysv/linux/fstatat64.c: In function =E2=80=98fstatat64_ti= me64_stat=E2=80=99: =2E./sysdeps/unix/sysv/linux/fstatat64.c:89:7: error: "STAT64_IS_KERNEL_STA= T64" is not defined, evaluates to 0 [-Werror=3Dundef] 89 | # if STAT64_IS_KERNEL_STAT64 | ^~~~~~~~~~~~~~~~~~~~~~~ =2E./sysdeps/unix/sysv/linux/fstatat64.c:94:24: error: storage size of =E2= =80=98kst64=E2=80=99 isn=E2=80=99t known 94 | struct kernel_stat64 kst64; | ^~~~~ =2E./sysdeps/unix/sysv/linux/fstatat64.c:97:5: error: implicit declaration = of function =E2=80=98__cp_stat64_kstat64=E2=80=99 [-Werror=3Dimplicit-funct= ion-declaration] 97 | __cp_stat64_kstat64 (buf, &kst64); | ^~~~~~~~~~~~~~~~~~~ =2E./sysdeps/unix/sysv/linux/fstatat64.c:94:24: error: unused variable =E2= =80=98kst64=E2=80=99 [-Werror=3Dunused-variable] 94 | struct kernel_stat64 kst64; | ^~~~~ =2E./sysdeps/unix/sysv/linux/fstatat64.c: At top level: =2E./sysdeps/unix/sysv/linux/fstatat64.c:149:9: note: =E2=80=98#pragma mess= age: The value of FSTATAT_USE_STATX: 1=E2=80=99 149 | #pragma message "The value of FSTATAT_USE_STATX: " XSTR(FSTATAT_USE= _STATX) | ^~~~~~~ =2E./sysdeps/unix/sysv/linux/fstatat64.c:150:9: note: =E2=80=98#pragma mess= age: The value of __ASSUME_STATX: 1=E2=80=99 150 | #pragma message "The value of __ASSUME_STATX: " XSTR(__ASSUME_STATX) | ^~~~~~~ Again I am not sure how arc avoids this error I shall try to compile it too. -Stafford > > --- > > sysdeps/unix/sysv/linux/kernel_stat.h | 1 + > > 1 file changed, 1 insertion(+) > >=20 > > diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/= linux/kernel_stat.h > > index 6c1b175cb4..b8c376f41e 100644 > > --- a/sysdeps/unix/sysv/linux/kernel_stat.h > > +++ b/sysdeps/unix/sysv/linux/kernel_stat.h > > @@ -20,3 +20,4 @@ > > #define XSTAT_IS_XSTAT64 1 > > #define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64 > > #define STAT_IS_KERNEL_STAT 1 > > +#define STAT64_IS_KERNEL_STAT64 1 > >=20 >=20