From patchwork Mon Jun 7 20:36:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 43765 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 4B95E3938C1C for ; Mon, 7 Jun 2021 20:47:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B95E3938C1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623098844; bh=WVD3ZWieTFWHd4YggxkRdkjd9PgOZ1zJcrASO+L1Iu0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=UZuwRfxLuNeBjj04V3gRNI5BrAgqPzWaZvooxjsVZrYMLD4O9kfW24jHBOGZMYF9Z 1D5MqGqx2gksbOo26dw+JBU5ZvZbx+1JF7jtxqImEGNXZ+2W6Id5DhAUgy1RebGGxS Ft+L5doDEwEvwnpoYmurDhcwJNknV+f7RQSSkHAY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by sourceware.org (Postfix) with ESMTPS id 893CE3938C0B for ; Mon, 7 Jun 2021 20:36:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 893CE3938C0B Received: by mail-qt1-x82a.google.com with SMTP id p21so1890564qtw.6 for ; Mon, 07 Jun 2021 13:36:42 -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=WVD3ZWieTFWHd4YggxkRdkjd9PgOZ1zJcrASO+L1Iu0=; b=UO7LiPAQ63Rt4IYGeKvpZj4MewKU693nNqj1NP7k5R/cfCamPfdAPlhTRbqnDebm72 X8lbUbKvJXw4ucx6q0CX1di4weZnunOx0rzoxXI847Ux7g+8jTEzQDqd7idL5mGMBqHU aoLkVDdI1GzU1K1WA1r4iAr+FS9kK45VMlo0tfdvwkxCAcppyzEIEnp0V3UIw6Ory9n2 Xs6R58lJFJ/KOYEqugTmFp1ceNH9nZyV2jAXMYaUo/CT+DC8lr7jMR2soGGFQB0m8ctN ZpoSguV4toVeEpffsIpf+CM/8fKcHmHqy30Jvwbz9/Ko5glTSswUueNZByWsYFkNA5mK ftqw== X-Gm-Message-State: AOAM531hPWzq17lU7CmUXeMkcCFJPLCzuj6UTbNxDTGrGKYFHdfLQUn7 +ilGTq6B1hgUvcaeZRwP3lAOQDB/gK0ZIw== X-Google-Smtp-Source: ABdhPJz6mDNR8Elu4Aj+tpbV8ODh/f0w6tV6JzgsKBSircXSyJ7UojM0ZRGPp1TNx1iHwOeTy1ShSw== X-Received: by 2002:ac8:7699:: with SMTP id g25mr11922163qtr.309.1623098201918; Mon, 07 Jun 2021 13:36:41 -0700 (PDT) Received: from birita.. ([177.194.59.218]) by smtp.googlemail.com with ESMTPSA id t196sm10422123qke.50.2021.06.07.13.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 13:36:41 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v3 14/24] y2038: Use a common definition for semid_ds Date: Mon, 7 Jun 2021 17:36:03 -0300 Message-Id: <20210607203613.282543-15-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210607203613.282543-1-adhemerval.zanella@linaro.org> References: <20210607203613.282543-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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 Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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. Reviewed-by: Carlos O'Donell Tested-by: carlos O'Donell --- sysdeps/unix/sysv/linux/Makefile | 3 ++- .../sysv/linux/bits/types/struct_semid64_ds.h | 5 +--- .../bits/types/struct_semid64_ds_helper.h | 25 +++++++++++++++++++ .../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, 61 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 6715a4b623..b6abcb1365 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 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 }; #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..e6592e6c3f --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid64_ds_helper.h @@ -0,0 +1,25 @@ +/* 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 */ + unsigned long int __glibc_reserved3; + unsigned long int __glibc_reserved4; diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h index 2f32fa500e..a7b2c9022e 100644 --- a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_otime_high; __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t __sem_ctime_high; -#else +# else __time_t sem_otime; __time_t sem_ctime; -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; diff --git a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h index 16a9735e7b..5067fb1572 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h @@ -23,6 +23,9 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ @@ -31,4 +34,5 @@ struct semid_ds __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h index 73587ea634..ee9a1e5e61 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h @@ -23,10 +23,14 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __sem_otime_high; __syscall_ulong_t __sem_ctime_high; +#endif }; diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h index 8fdbc5d776..0c080fed61 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_ctime_high; __time_t sem_ctime; /* last time changed by semctl() */ -#else +# else __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h index 6b9b3639b2..76810427f6 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_ctime_high; __time_t sem_ctime; /* last time changed by semctl() */ -#else +# else __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; diff --git a/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h index 90f03b2407..affd38b6bd 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h @@ -23,6 +23,9 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_otime_high; @@ -31,4 +34,5 @@ struct semid_ds __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif };