From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) by sourceware.org (Postfix) with ESMTPS id EA8C938438A3 for ; Tue, 29 Dec 2020 10:54:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EA8C938438A3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4D4rrj0wKzz1rypD; Tue, 29 Dec 2020 11:54:13 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4D4rrh6VTMz1tSQS; Tue, 29 Dec 2020 11:54:12 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id GWAFpSbDXUL7; Tue, 29 Dec 2020 11:54:10 +0100 (CET) X-Auth-Info: pCaxySV4650/JbiA3gYpBbNgSGhNN/dWrWBy6ribfX4= Received: from jawa (89-64-25-12.dynamic.chello.pl [89.64.25.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 29 Dec 2020 11:54:10 +0100 (CET) Date: Tue, 29 Dec 2020 11:54:01 +0100 From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Cc: Alistair Francis , Arnd Bergmann , Alistair Francis , GNU C Library , Florian Weimer , Carlos O'Donell , Stepan Golosunov , Andreas Schwab , Zack Weinberg , Siddhesh Poyarekar Subject: Re: [RFC 5/6] msqid: Provide internal copy of struct __msqid64_ds Message-ID: <20201229115401.491d4179@jawa> In-Reply-To: <20201204233604.7430-6-lukma@denx.de> References: <20201204233604.7430-1-lukma@denx.de> <20201204233604.7430-6-lukma@denx.de> Organization: denx.de X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/SdlI/2a/iqTp6u4vBWFg2wL"; protocol="application/pgp-signature" X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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-List-Received-Date: Tue, 29 Dec 2020 10:54:15 -0000 --Sig_/SdlI/2a/iqTp6u4vBWFg2wL Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Adhemerval, > After the commit SHA1: 3283f711132eaadc4f04bd8c1d84c910c29ba > "sysv: linux: Add 64-bit time_t variant for msgctl" >=20 > The glibc internal, 64 bit supporting version of struct __msqid64_ds > has been exported. >=20 > This approach has issue when one would like to add Y2038 support to > glibc. The problem is that both struct msqid_ds and __msqid64_ds rely > on exported implementation of the msg.h header (./sysvipc/sys/msg.h) > which unconditionally includes ./sysdeps/unix/sysv/linux/bits/msq.h > which in turn includes > ./sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h >=20 > As a result the externally exported struct msqid_ds.h is used > internally by glibc. Problem starts when one wants to extend this > struct with 64 bit time support: >=20 > | In file included from ../sysdeps/unix/sysv/linux/bits/msq.h:28, > | from ../sysvipc/sys/msg.h:30, > | from > ../sysdeps/unix/sysv/linux/include/sys/msg.h:2, | > from ../include/sys/msg.h:1, | from > ../sysdeps/unix/sysv/linux/msgctl.c:19: | > ../sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h:31:6: error: > "__USE_TIME_BITS64" is not defined, evaluates to 0 [-Werror=3Dundef] | > # if __USE_TIME_BITS64 | ^~~~~~~~~~~~~~~~~ >=20 >=20 > To fix this issue - the internal,for glibc, copy of struct > __msqid64_ds has been re-introduced. This will allow clear separation > between exported and internal glibc types. >=20 > Moreover, the __TIMESIZE based alias shall be internal to glibc. >=20 > Build tests: > ./src/scripts/build-many-glibcs.py glibcs We had a discussion regarding this patch some time ago [1]. The conclusion was that we would need to duplicate this structure to have a copy of msqid_ds structure as adding new members to exported (and POSIX standardized) headers causes POSIX naming pollution. Can we have a final agreement on this patch? This also would require discussion about related patch -=20 "msg: provide glibc local copy of struct msqid_ds" [2] Links:=20 [1] - https://marc.info/?t=3D160383682700004&r=3D1&w=3D2 [2] - https://marc.info/?t=3D160383682700003&r=3D1&w=3D2 > --- > include/bits/types/struct_msqid64_ds.h | 36 > +++++++++++++++++++ .../sysv/linux/bits/types/struct_msqid64_ds.h | > 4 --- 2 files changed, 36 insertions(+), 4 deletions(-) > create mode 100644 include/bits/types/struct_msqid64_ds.h >=20 > diff --git a/include/bits/types/struct_msqid64_ds.h > b/include/bits/types/struct_msqid64_ds.h new file mode 100644 > index 0000000000..8c39a2a872 > --- /dev/null > +++ b/include/bits/types/struct_msqid64_ds.h > @@ -0,0 +1,36 @@ > +/* Internal for glibc implementation of the SysV message struct > msqid64_ds. > + 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 =3D=3D 64 > +# define __msqid64_ds msqid_ds > +#else > +struct __msqid64_ds > +{ > + struct ipc_perm msg_perm; /* structure describing operation > permission */ > + __time64_t msg_stime; /* time of last msgsnd > command */ > + __time64_t msg_rtime; /* time of last msgsnd > command */ > + __time64_t msg_ctime; /* time of last change */ > + __syscall_ulong_t __msg_cbytes; /* current number of bytes on > queue */ > + msgqnum_t msg_qnum; /* number of messages currently > on queue */ > + msglen_t msg_qbytes; /* max number of bytes allowed > on queue */ > + __pid_t msg_lspid; /* pid of last msgsnd() */ > + __pid_t msg_lrpid; /* pid of last msgrcv() */ > +}; > +#endif > diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_msqid64_ds.h > b/sysdeps/unix/sysv/linux/bits/types/struct_msqid64_ds.h index > 3536c8ea62..07cc1036ab 100644 --- > a/sysdeps/unix/sysv/linux/bits/types/struct_msqid64_ds.h +++ > b/sysdeps/unix/sysv/linux/bits/types/struct_msqid64_ds.h @@ -20,9 > +20,6 @@ # error "Never use directly; include > instead." #endif > =20 > -#if __TIMESIZE =3D=3D 64 > -# define __msqid64_ds msqid_ds > -#else > struct __msqid64_ds > { > struct ipc_perm msg_perm; /* structure describing operation > permission */ @@ -35,4 +32,3 @@ struct __msqid64_ds > __pid_t msg_lspid; /* pid of last msgsnd() */ > __pid_t msg_lrpid; /* pid of last msgrcv() */ > }; > -#endif Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/SdlI/2a/iqTp6u4vBWFg2wL Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl/rCskACgkQAR8vZIA0 zr2E4Af/U4+QR8iHQ9G+7c6AJoop7egCsB8slcuuEMu2UrvRozvjho3AvcMrLXJS QtI4kVr2V+Jfjro2VHUWvDyNHL5CN2p9VjaWf4T2JwD3p87ESHecsqbySNGQEVgw lBpFiRvEX4BkTzopUJomB7KcyK0xvR+FcdophQgeR1pZZuVggX2JrUXfSTj9y349 /gF7WVw4PVz4efje+1Y6ePo86yg9PCAD+cdExgQz7GJtK4BLRFZqaiczLG2tqjeh X8uwzSQW0klQEUua55ZxMYzHKbPubW0nUlcpZch/+xWoF0CIB58UWD/vWeRJ8j9p 8YoNMZ+6VJzqNwNs5rfBhJhv3CA3cQ== =Ouqy -----END PGP SIGNATURE----- --Sig_/SdlI/2a/iqTp6u4vBWFg2wL--