From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by sourceware.org (Postfix) with ESMTPS id 16764385DC22 for ; Mon, 7 Jun 2021 18:46:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 16764385DC22 Received: by mail-qt1-x831.google.com with SMTP id s12so13382230qta.3 for ; Mon, 07 Jun 2021 11:46: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:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GFBE2KC7iGJg9bhyQzoEYSIZ85Jg9j1qqH1FqtQ+zfA=; b=kkVcg1ghW3aoGJNMEGmQ6tkl8rE6fhUSYtraettGsemzTFcRIP89jRfn0c7oI+z4ML Ck+9Ss/UkV56Qvt6VLAL8kpYyUrF44X79SBGXdsX3eL/RuIE2meGSI0s+dtezScD8qyb ET7OimP1pEywSpRbqhRnSnCr3S2uNdFKKRpxH7yvw+KdZgt5o2y3noSCyLqTyGDMyGlq kzepgTTaokiQ2uj0u/wvWu0EtEx+hZve2P3JiVgPNG1VMQt229Xbb7G0XjmVq1R1aWkI 7e2CJTC31ERT0D0tcn6bNvtV8mu3/nPSitVLPdrGqpeUKqzpNEOAjuRKImEY1Dft8AVB Y7tQ== X-Gm-Message-State: AOAM531Bnnp5Uri19PT/LMlqt49Knb4OQutjEnsEc7ubZjtORJq6140V d6XH6FkICRO4HDJ4ZZ2shFMqTRm4iLhwsQ== X-Google-Smtp-Source: ABdhPJxjDwRHlfKjedOWMe62Ey9rDfY9PgaRfAidXv2GBWtbonwSOXc3/BnoeNGzMByFxw16rZ/mKQ== X-Received: by 2002:a05:622a:446:: with SMTP id o6mr18312460qtx.246.1623091565474; Mon, 07 Jun 2021 11:46:05 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id s133sm7590889qke.97.2021.06.07.11.46.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Jun 2021 11:46:05 -0700 (PDT) Subject: Re: [PATCH v2 15/25] y2038: Use a common definition for semid_ds To: Carlos O'Donell , libc-alpha@sourceware.org References: <20210518205613.1487824-1-adhemerval.zanella@linaro.org> <20210518205613.1487824-16-adhemerval.zanella@linaro.org> <6d1e06b6-fd95-29c5-f4bc-2a4ba7608de6@redhat.com> From: Adhemerval Zanella Message-ID: <870d1791-cfc3-7f8b-9ee5-a6c33107a6cd@linaro.org> Date: Mon, 7 Jun 2021 15:46:02 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <6d1e06b6-fd95-29c5-f4bc-2a4ba7608de6@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, 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-List-Received-Date: Mon, 07 Jun 2021 18:46:08 -0000 On 04/06/2021 16:38, Carlos O'Donell wrote: > On 5/18/21 4:56 PM, Adhemerval Zanella wrote: >> Instead of replicate the same definitions from struct_semid64_ds.h >> on the multiple struct_semid_ds.h, use a common header which is included >> when required (struct_semid64_ds_helper.h). >> >> The __USE_TIME_BITS64 is not defined internally yet, although the >> internal header is used when building the 64-bit semctl implementation. > > Requesting a v3 please. > > Similar to 14/25, we should add the __glibc_reserved* members to the > structure to preserve maximum compatibility with the kernel structure. > > The original struct semid_ds is 64 bytes on i686 with high-low time pairs > and only 56 bytes in the 64-bit time_t version. With the two reserved > members added back it's 64 bytes in both ABIs. Ack. > > We could add some static asserts if we really want to be thorough about > the alignment of __time64_t. I think there is no need, this would bsaically verify the expected ABI already set by the compiler (since we do not need to actually follow kernel expected internal layout). > >> --- >> sysdeps/unix/sysv/linux/Makefile | 3 ++- >> .../sysv/linux/bits/types/struct_semid64_ds.h | 5 +--- >> .../bits/types/struct_semid64_ds_helper.h | 23 +++++++++++++++++++ >> .../sysv/linux/bits/types/struct_semid_ds.h | 10 +++++--- >> .../linux/hppa/bits/types/struct_semid_ds.h | 4 ++++ >> .../linux/mips/bits/types/struct_semid_ds.h | 4 ++++ >> .../powerpc/bits/types/struct_semid_ds.h | 10 +++++--- >> .../linux/sparc/bits/types/struct_semid_ds.h | 10 +++++--- >> .../linux/x86/bits/types/struct_semid_ds.h | 4 ++++ >> 9 files changed, 59 insertions(+), 14 deletions(-) >> create mode 100644 sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds_helper.h >> >> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile >> index 193b7c46b9..b599c423ed 100644 >> --- a/sysdeps/unix/sysv/linux/Makefile >> +++ b/sysdeps/unix/sysv/linux/Makefile >> @@ -102,7 +102,8 @@ sysdep_headers += sys/mount.h sys/acct.h \ >> bits/ipc-perm.h \ >> bits/struct_stat.h \ >> bits/struct_stat_time64_helper.h \ >> - bits/types/struct_msqid64_ds_helper.h >> + bits/types/struct_msqid64_ds_helper.h \ >> + bits/types/struct_semid64_ds_helper.h > > OK. Add helper. > >> >> 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/bits/types/struct_semid64_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds.h >> index 7263e50bbf..adaee3eb9e 100644 >> --- a/sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds.h >> +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds.h >> @@ -25,9 +25,6 @@ >> #else >> struct __semid64_ds >> { >> - struct ipc_perm sem_perm; /* operation permission struct */ >> - __time64_t sem_otime; /* last semop() time */ >> - __time64_t sem_ctime; /* last time changed by semctl() */ >> - __syscall_ulong_t sem_nsems; /* number of semaphores in set */ >> +# include > > OK. Use helper. > >> }; >> #endif >> diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds_helper.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds_helper.h >> new file mode 100644 >> index 0000000000..ea60b671f1 >> --- /dev/null >> +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds_helper.h >> @@ -0,0 +1,23 @@ >> +/* Common definitions for struct semid_ds with 64 bit time. >> + Copyright (C) 2020-2021 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 >> + . */ >> + >> + /* Content of internal __semid64_ds. */ >> + struct ipc_perm sem_perm; /* operation permission struct */ >> + __time64_t sem_otime; /* last semop() time */ >> + __time64_t sem_ctime; /* last time changed by semctl() */ >> + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ > > Definitions look good. > > Needs __glibc_reserved3 and __glibc_reserved4. Ack.