From patchwork Tue Jun 30 19:24:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 39843 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 8C1D2385702F; Tue, 30 Jun 2020 19:24:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C1D2385702F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1593545092; bh=eRO8sN91TCLjwoIhQ1B4w538Gc3/xpAdLf1spiwX+Bo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=TJQtgVAV9DteDSDCmK9tkfy98/ry5T/waDMEDVl9h1e2DjROk1+D9ewe6LzQQGLYn 5hNjxrgEueGmnAvO08qiISoP08LEkLQi7/EHNQlfrIH0nrs0x0j7HAySuBhKfuPzsF X9H2Z/TQSK5iBQjFHXy6AxT8UxNUp2y8lrpwBwfQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by sourceware.org (Postfix) with ESMTPS id F338C3858D35 for ; Tue, 30 Jun 2020 19:24:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F338C3858D35 Received: by mail-qv1-xf44.google.com with SMTP id h18so9820442qvl.3 for ; Tue, 30 Jun 2020 12:24:48 -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=eRO8sN91TCLjwoIhQ1B4w538Gc3/xpAdLf1spiwX+Bo=; b=F1lMFXBIAE325AHArO5ogSKs7KgJASDfiXMQ4l0mY23loC8lmBMW1oioQJawE9Rv26 iD0b2yil6kweFyrK+FjCsDOxJ/RuOjKEwT6cCyxT0e9JxayAYaH7SqxEGxVVkZjTKb5i 4U39+D5WcYx55g0z9Nygi1tqI1t/RGjYjsKudwWRRwIvCLOHMwRQ4G+iNOiMQodlOQWG 6V3SoLlzj09QGn/IG26H5AJnbC318ARkZWNoxX815r70aZYDgklPo2F80tjCPaMvNrbu z6wtITZgv7PyTLe9hFrhEltTUzzywQkQ0HWlj60O80hI7u3nzpCOImznXOwFrjDjX2K1 kVYg== X-Gm-Message-State: AOAM531RXikJp1qBaYU7c5PzSSDG3+E4gA7VlrbOseRFSDLQaUsfrH2N miC0RYAkYfuoN4+cFaTZQ+fjV/4nDg8= X-Google-Smtp-Source: ABdhPJxG5vJ92/Cbs7yMzXFvOpTPv2VfIuvppKiYKm4Ia+IyTFzQNMwyEJ2QQ26yO5YAZNLAslepKQ== X-Received: by 2002:a0c:c405:: with SMTP id r5mr21688694qvi.184.1593545088182; Tue, 30 Jun 2020 12:24:48 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id b7sm3558214qkl.18.2020.06.30.12.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 12:24:47 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 2/7] sysvipc: Split out linux struct semid_ds Date: Tue, 30 Jun 2020 16:24:36 -0300 Message-Id: <20200630192441.3299710-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630192441.3299710-1-adhemerval.zanella@linaro.org> References: <20200630192441.3299710-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-14.6 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 Cc: stepan@golosunov.pp.ru, Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This will allow us to have architectures specify their own version. Not semantic changes expected. Checked with a build against the all affected ABIs. Reviewed-by: Alistair Francis Tested-by: Carlos O'Donell Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/bits/msq.h | 39 +++----------- .../sysv/linux/bits/types/struct_msqid_ds.h | 51 +++++++++++++++++++ 3 files changed, 58 insertions(+), 33 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index e02065dc8d..70e2d9e044 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -92,6 +92,7 @@ sysdep_headers += sys/mount.h sys/acct.h \ bits/termios-c_lflag.h bits/termios-tcflow.h \ bits/termios-misc.h \ bits/types/struct_semid_ds.h \ + bits/types/struct_msqid_ds.h \ bits/ipc-perm.h tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h index cc4ebae0f0..6ce6408ebc 100644 --- a/sysdeps/unix/sysv/linux/bits/msq.h +++ b/sysdeps/unix/sysv/linux/bits/msq.h @@ -20,7 +20,12 @@ #endif #include -#include + +/* Types used in the MSQID_DS structure definition. */ +typedef __syscall_ulong_t msgqnum_t; +typedef __syscall_ulong_t msglen_t; + +#include /* Define options for message queue functions. */ #define MSG_NOERROR 010000 /* no error if message is too big */ @@ -29,38 +34,6 @@ # define MSG_COPY 040000 /* copy (not remove) all queue messages */ #endif -/* Types used in the structure definition. */ -typedef __syscall_ulong_t msgqnum_t; -typedef __syscall_ulong_t msglen_t; - -#if __MSQ_PAD_BEFORE_TIME -# define __MSQ_PAD_TIME(NAME, RES) \ - unsigned long int __glibc_reserved ## RES; __time_t NAME -#elif __MSQ_PAD_AFTER_TIME -# define __MSQ_PAD_TIME(NAME, RES) \ - __time_t NAME; unsigned long int __glibc_reserved ## RES -#else -# define __MSQ_PAD_TIME(NAME, RES) \ - __time_t NAME -#endif - -/* Structure of record for one message inside the kernel. - The type `struct msg' is opaque. */ -struct msqid_ds -{ - struct ipc_perm msg_perm; /* structure describing operation permission */ - __MSQ_PAD_TIME (msg_stime, 1); /* time of last msgsnd command */ - __MSQ_PAD_TIME (msg_rtime, 2); /* time of last msgrcv command */ - __MSQ_PAD_TIME (msg_ctime, 3); /* 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() */ - __syscall_ulong_t __glibc_reserved4; - __syscall_ulong_t __glibc_reserved5; -}; - #ifdef __USE_MISC # define msg_cbytes __msg_cbytes diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h new file mode 100644 index 0000000000..bfc56f6ac1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h @@ -0,0 +1,51 @@ +/* Generic implementation of the SysV message struct msqid_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 + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +#if __MSQ_PAD_BEFORE_TIME +# define __MSQ_PAD_TIME(NAME, RES) \ + unsigned long int __glibc_reserved ## RES; __time_t NAME +#elif __MSQ_PAD_AFTER_TIME +# define __MSQ_PAD_TIME(NAME, RES) \ + __time_t NAME; unsigned long int __glibc_reserved ## RES +#else +# define __MSQ_PAD_TIME(NAME, RES) \ + __time_t NAME +#endif + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ + __MSQ_PAD_TIME (msg_stime, 1); /* time of last msgsnd command */ + __MSQ_PAD_TIME (msg_rtime, 2); /* time of last msgrcv command */ + __MSQ_PAD_TIME (msg_ctime, 3); /* 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() */ + __syscall_ulong_t __glibc_reserved4; + __syscall_ulong_t __glibc_reserved5; +};