public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Joseph Myers <joseph@codesourcery.com>,
	Paul Eggert <eggert@cs.ucla.edu>,
	Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Alistair Francis <alistair23@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Alistair Francis <alistair.francis@wdc.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>,
	Carlos O'Donell <carlos@redhat.com>,
	Stepan Golosunov <stepan@golosunov.pp.ru>,
	Andreas Schwab <schwab@suse.de>, Zack Weinberg <zackw@panix.com>,
	Siddhesh Poyarekar <siddhesh@redhat.com>
Subject: Re: [RFC 5/6] msqid: Provide internal copy of struct __msqid64_ds
Date: Tue, 29 Dec 2020 11:54:01 +0100	[thread overview]
Message-ID: <20201229115401.491d4179@jawa> (raw)
In-Reply-To: <20201204233604.7430-6-lukma@denx.de>

[-- Attachment #1: Type: text/plain, Size: 5363 bytes --]

Hi Adhemerval,

> After the commit SHA1: 3283f711132eaadc4f04bd8c1d84c910c29ba
> "sysv: linux: Add 64-bit time_t variant for msgctl"
> 
> The glibc internal, 64 bit supporting version of struct __msqid64_ds
> has been exported.
> 
> 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
> 
> 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:
> 
> | 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=undef] |
> # if __USE_TIME_BITS64 |       ^~~~~~~~~~~~~~~~~
> 
> 
> 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.
> 
> Moreover, the __TIMESIZE based alias shall be internal to glibc.
> 
> 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 - 
"msg: provide glibc local copy of struct msqid_ds" [2]

Links: 
[1] - https://marc.info/?t=160383682700004&r=1&w=2
[2] - https://marc.info/?t=160383682700003&r=1&w=2

> ---
>  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
> 
> 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
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <time.h>
> +
> +#if __TIMESIZE == 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 <bits/msq.h> directly; include
> <sys/msg.h> instead." #endif
>  
> -#if __TIMESIZE == 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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-12-29 10:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 23:35 [RFC 0/6] y2038: Prepare glibc to be Y2038 safe for 32 bit ports Lukasz Majewski
2020-12-04 23:35 ` [RFC 1/6] y2038: Introduce _TIME_BITS flag to support 64 bit time on 32 bit systems Lukasz Majewski
2020-12-05  0:12   ` Joseph Myers
2020-12-07 13:00     ` Lukasz Majewski
2020-12-04 23:36 ` [RFC 2/6] y2038: stat: {f}stat{at}64_time64 redirection to be used on Y2038 systems Lukasz Majewski
2020-12-05  0:04   ` Joseph Myers
2020-12-07 10:28     ` Lukasz Majewski
2020-12-07 18:07       ` Joseph Myers
2020-12-04 23:36 ` [RFC 3/6] y2038: Export struct_stat_time64_helper.h with Y2038 safe stat{64} content Lukasz Majewski
2020-12-29 10:30   ` Lukasz Majewski
2020-12-04 23:36 ` [RFC 4/6] y2038: Enhance struct msqid_ds to support 64 bit time Lukasz Majewski
2020-12-29 10:34   ` Lukasz Majewski
2020-12-04 23:36 ` [RFC 5/6] msqid: Provide internal copy of struct __msqid64_ds Lukasz Majewski
2020-12-29 10:54   ` Lukasz Majewski [this message]
2020-12-04 23:36 ` [RFC 6/6] msg: provide glibc local copy of struct msqid_ds Lukasz Majewski
2020-12-05  0:01 ` [RFC 0/6] y2038: Prepare glibc to be Y2038 safe for 32 bit ports Joseph Myers
2020-12-07 10:22   ` Lukasz Majewski
2020-12-07 18:01     ` Joseph Myers
2020-12-08 10:07       ` Lukasz Majewski
2020-12-08 15:25         ` Joseph Myers
2020-12-13 11:49           ` Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201229115401.491d4179@jawa \
    --to=lukma@denx.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=arnd@arndb.de \
    --cc=carlos@redhat.com \
    --cc=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    --cc=siddhesh@redhat.com \
    --cc=stepan@golosunov.pp.ru \
    --cc=zackw@panix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).