From nobody Fri Jun 17 19:40:35 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BCDDE85CD71; Fri, 17 Jun 2022 19:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LPqC81yQZz3hNm; Fri, 17 Jun 2022 19:40:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XJ3qouh2Bf4wMpgKk0ARJMzHpRyvt1XCRS84tRDNUU8=; b=vMTrOXttCpVIiBey2bJ606BfFZsuhBVRfmEUYKoojr/Ld+wVcV58Vuz0E9jqDjbG7z9M0i 89+TW1ev2tQn964rHsJaRJhYKtarVTqZFF0JYKuYBTehHsUYoC+lT/lkQVT/tfLMZzjx54 XLGIttNWNIZokvMWSxobKhfOnIf/8eAcrmd9QMhBdiBLH86LxsGnaa0Yz9nJUVZCKp0mD0 hmbX1NCPT9iioLFkogR7RRl5VFEbiTNTe3haXdskh5DgucqJzJ6IK1YkaiJWQqcSVoOTW1 XBlmuRHwvc9nL1Fj3jq9O8aLWCpE2HoDoG6sdHoJ/L7kuTJfqRUU4KybPDfIYQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D09A125DA1; Fri, 17 Jun 2022 19:40:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJeZ19026017; Fri, 17 Jun 2022 19:40:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJeZ6K026016; Fri, 17 Jun 2022 19:40:35 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:40:35 GMT Message-Id: <202206171940.25HJeZ6K026016@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 43dbc72cc560 - stable/13 - linux(4): Rework the definition of struct siginfo to match Linux actual one List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 43dbc72cc5602c41f1767b187ebc50c1ce781282 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XJ3qouh2Bf4wMpgKk0ARJMzHpRyvt1XCRS84tRDNUU8=; b=TmyqtrfbqbAI8T+oDvG0aE9ZvNvvFJcMq1XVCcbXDu83+N/bnJWBapPQp3cd90tiOSXqnZ kj8AZXDWVNKZwxRF9TLHswb5KTwkLwfANeiCIwVOxaUa42ZJJp7a8kPpMvObxQlipGJaAr WAOrc+Dis6cPJuft8CcmwuCz2qdU3+8pSeVodyq9KkYzEa2lKNSV8rVE0OgIyTSHWh7Q9W xazqadnOFwuSqY/uvCxWG/EJntmrNWUfMSA/CfpwV+aRaxwQiZ6ycRYOt9XCugP6WTce+l BK/tQISY6tn6vqMo0yN4v8I9ck8M4A+BLF1i8hYFZZBnjiNCwbYMfb4wLAoGIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494836; a=rsa-sha256; cv=none; b=F82fELNViytscamUWQ3Id4LpAfnZK/CtM3iWHkC0pOvKjeKxWctK5OZBvBZ0PeGS4OvNHe PgoRx4jOyFcZuTTB0bqnKtXwC0qovV1tjyOpSlgC94ESCQGzqWPKdGO6Zb0rs9W/rNG+rt vhZWq2G4ZJ6nqXYIFSKoNRXOTlq0FLwvZi23OparCLWAn91EB/sJGaNCCAVt3lIZXE2Z7X FDaTcacS7zvH7flKhoOSNo9jH9THzR9JLiZBSPmu0fcSDY3P9mCZxIyVJg5HG3u8mc+Jvm yJ2P0KMlNlfV9nGZ3ALtEj13y1qcvwQCZl+x2FN8wLaIG7LkIgH13b1DZapfyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=43dbc72cc5602c41f1767b187ebc50c1ce781282 commit 43dbc72cc5602c41f1767b187ebc50c1ce781282 Author: Dmitry Chagin AuthorDate: 2022-05-15 18:05:01 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:35:20 +0000 linux(4): Rework the definition of struct siginfo to match Linux actual one Rework the defintion of struct siginfo so that the array padding struct siginfo to SI_MAX_SIZE can be placed in a union along side of the rest of the struct siginfo members. The result is that we no longer need the __ARCH_SI_PREAMBLE_SIZE or SI_PAD_SIZE definitions. Move struct siginfo definition under /compat/linux to reduce MD part. To avoid headers polution include linux_siginfo.h in the MD linux.h MFC after: 2 weeks (cherry picked from commit af557e649cf229e45a83767c3c4a7daeb92f0b01) --- sys/amd64/linux/linux.h | 71 +----------------------- sys/amd64/linux32/linux.h | 70 +----------------------- sys/arm64/linux/linux.h | 71 +----------------------- sys/compat/linux/linux_siginfo.h | 113 +++++++++++++++++++++++++++++++++++++++ sys/i386/linux/linux.h | 70 +----------------------- 5 files changed, 121 insertions(+), 274 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index 51a2906f45cf..02aede96ce23 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -74,6 +74,8 @@ typedef l_int l_mqd_t; typedef l_size_t l_socklen_t; typedef l_ulong l_fd_mask; +#include + typedef struct { l_int val[2]; } l_fsid_t; @@ -182,75 +184,6 @@ typedef struct { l_size_t ss_size; } l_stack_t; -#define LINUX_SI_PREAMBLE_SIZE (4 * sizeof(int)) -#define LINUX_SI_MAX_SIZE 128 -#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE - \ - LINUX_SI_PREAMBLE_SIZE) / sizeof(l_int)) -typedef union l_sigval { - l_int sival_int; - l_uintptr_t sival_ptr; -} l_sigval_t; - -typedef struct l_siginfo { - l_int lsi_signo; - l_int lsi_errno; - l_int lsi_code; - union { - l_int _pad[LINUX_SI_PAD_SIZE]; - - struct { - l_pid_t _pid; - l_uid_t _uid; - } _kill; - - struct { - l_timer_t _tid; - l_int _overrun; - char _pad[sizeof(l_uid_t) - sizeof(int)]; - union l_sigval _sigval; - l_uint _sys_private; - } _timer; - - struct { - l_pid_t _pid; /* sender's pid */ - l_uid_t _uid; /* sender's uid */ - union l_sigval _sigval; - } _rt; - - struct { - l_pid_t _pid; /* which child */ - l_uid_t _uid; /* sender's uid */ - l_int _status; /* exit code */ - l_clock_t _utime; - l_clock_t _stime; - } _sigchld; - - struct { - l_uintptr_t _addr; /* Faulting insn/memory ref. */ - } _sigfault; - - struct { - l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ - l_int _fd; - } _sigpoll; - } _sifields; -} l_siginfo_t; - -#define lsi_pid _sifields._kill._pid -#define lsi_uid _sifields._kill._uid -#define lsi_tid _sifields._timer._tid -#define lsi_overrun _sifields._timer._overrun -#define lsi_sys_private _sifields._timer._sys_private -#define lsi_status _sifields._sigchld._status -#define lsi_utime _sifields._sigchld._utime -#define lsi_stime _sifields._sigchld._stime -#define lsi_value _sifields._rt._sigval -#define lsi_int _sifields._rt._sigval.sival_int -#define lsi_ptr _sifields._rt._sigval.sival_ptr -#define lsi_addr _sifields._sigfault._addr -#define lsi_band _sifields._sigpoll._band -#define lsi_fd _sifields._sigpoll._fd - /* * mount flags */ diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 1987ff515275..5cdf7624fef5 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -82,6 +82,8 @@ typedef l_int l_timer_t; typedef l_int l_mqd_t; typedef l_ulong l_fd_mask; +#include + typedef struct { l_int val[2]; } l_fsid_t; @@ -287,74 +289,6 @@ typedef struct { l_size_t ss_size; } l_stack_t; -#define LINUX_SI_MAX_SIZE 128 -#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3) - -typedef union l_sigval { - l_int sival_int; - l_uintptr_t sival_ptr; -} l_sigval_t; - -typedef struct l_siginfo { - l_int lsi_signo; - l_int lsi_errno; - l_int lsi_code; - union { - l_int _pad[LINUX_SI_PAD_SIZE]; - - struct { - l_pid_t _pid; - l_uid_t _uid; - } _kill; - - struct { - l_timer_t _tid; - l_int _overrun; - char _pad[sizeof(l_uid_t) - sizeof(l_int)]; - l_sigval_t _sigval; - l_int _sys_private; - } _timer; - - struct { - l_pid_t _pid; /* sender's pid */ - l_uid_t _uid; /* sender's uid */ - l_sigval_t _sigval; - } _rt; - - struct { - l_pid_t _pid; /* which child */ - l_uid_t _uid; /* sender's uid */ - l_int _status; /* exit code */ - l_clock_t _utime; - l_clock_t _stime; - } _sigchld; - - struct { - l_uintptr_t _addr; /* Faulting insn/memory ref. */ - } _sigfault; - - struct { - l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ - l_int _fd; - } _sigpoll; - } _sifields; -} l_siginfo_t; - -#define lsi_pid _sifields._kill._pid -#define lsi_uid _sifields._kill._uid -#define lsi_tid _sifields._timer._tid -#define lsi_overrun _sifields._timer._overrun -#define lsi_sys_private _sifields._timer._sys_private -#define lsi_status _sifields._sigchld._status -#define lsi_utime _sifields._sigchld._utime -#define lsi_stime _sifields._sigchld._stime -#define lsi_value _sifields._rt._sigval -#define lsi_int _sifields._rt._sigval.sival_int -#define lsi_ptr _sifields._rt._sigval.sival_ptr -#define lsi_addr _sifields._sigfault._addr -#define lsi_band _sifields._sigpoll._band -#define lsi_fd _sifields._sigpoll._fd - /* * arch specific open/fcntl flags */ diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h index b6e2af506ad2..402f7aa39bb9 100644 --- a/sys/arm64/linux/linux.h +++ b/sys/arm64/linux/linux.h @@ -67,6 +67,8 @@ typedef l_int l_timer_t; /* XXX */ typedef l_int l_mqd_t; typedef l_ulong l_fd_mask; +#include + typedef struct { l_int val[2]; } l_fsid_t; @@ -179,75 +181,6 @@ typedef struct { l_size_t ss_size; } l_stack_t; -#define LINUX_SI_PREAMBLE_SIZE (4 * sizeof(int)) -#define LINUX_SI_MAX_SIZE 128 -#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE - \ - LINUX_SI_PREAMBLE_SIZE) / sizeof(l_int)) -typedef union l_sigval { - l_int sival_int; - l_uintptr_t sival_ptr; -} l_sigval_t; - -typedef struct l_siginfo { - l_int lsi_signo; - l_int lsi_errno; - l_int lsi_code; - union { - l_int _pad[LINUX_SI_PAD_SIZE]; - - struct { - l_pid_t _pid; - l_uid_t _uid; - } _kill; - - struct { - l_timer_t _tid; - l_int _overrun; - char _pad[sizeof(l_uid_t) - sizeof(int)]; - union l_sigval _sigval; - l_uint _sys_private; - } _timer; - - struct { - l_pid_t _pid; /* sender's pid */ - l_uid_t _uid; /* sender's uid */ - union l_sigval _sigval; - } _rt; - - struct { - l_pid_t _pid; /* which child */ - l_uid_t _uid; /* sender's uid */ - l_int _status; /* exit code */ - l_clock_t _utime; - l_clock_t _stime; - } _sigchld; - - struct { - l_uintptr_t _addr; /* Faulting insn/memory ref. */ - } _sigfault; - - struct { - l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ - l_int _fd; - } _sigpoll; - } _sifields; -} l_siginfo_t; - -#define lsi_pid _sifields._kill._pid -#define lsi_uid _sifields._kill._uid -#define lsi_tid _sifields._timer._tid -#define lsi_overrun _sifields._timer._overrun -#define lsi_sys_private _sifields._timer._sys_private -#define lsi_status _sifields._sigchld._status -#define lsi_utime _sifields._sigchld._utime -#define lsi_stime _sifields._sigchld._stime -#define lsi_value _sifields._rt._sigval -#define lsi_int _sifields._rt._sigval.sival_int -#define lsi_ptr _sifields._rt._sigval.sival_ptr -#define lsi_addr _sifields._sigfault._addr -#define lsi_band _sifields._sigpoll._band -#define lsi_fd _sifields._sigpoll._fd - union l_semun { l_int val; l_uintptr_t buf; diff --git a/sys/compat/linux/linux_siginfo.h b/sys/compat/linux/linux_siginfo.h new file mode 100644 index 000000000000..cb5c3e76482c --- /dev/null +++ b/sys/compat/linux/linux_siginfo.h @@ -0,0 +1,113 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2004 Tim J. Robbins + * Copyright (c) 2001 Doug Rabson + * Copyright (c) 1994-1996 Søren Schmidt + * All rights reserved. + * Copyright (c) 2022 Dmitry Chagin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_SIGINFO_H_ +#define _LINUX_SIGINFO_H_ + +typedef union l_sigval { + l_int sival_int; + l_uintptr_t sival_ptr; +} l_sigval_t; + +#define LINUX_SI_MAX_SIZE 128 + +union __sifields { + struct { + l_pid_t _pid; + l_uid_t _uid; + } _kill; + + struct { + l_timer_t _tid; + l_int _overrun; + char _pad[sizeof(l_uid_t) - sizeof(int)]; + union l_sigval _sigval; + l_uint _sys_private; + } _timer; + + struct { + l_pid_t _pid; /* sender's pid */ + l_uid_t _uid; /* sender's uid */ + union l_sigval _sigval; + } _rt; + + struct { + l_pid_t _pid; /* which child */ + l_uid_t _uid; /* sender's uid */ + l_int _status; /* exit code */ + l_clock_t _utime; + l_clock_t _stime; + } _sigchld; + + struct { + l_uintptr_t _addr; /* Faulting insn/memory ref. */ + } _sigfault; + + struct { + l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ + l_int _fd; + } _sigpoll; +}; + +typedef struct l_siginfo { + union { + struct { + l_int lsi_signo; + l_int lsi_errno; + l_int lsi_code; + union __sifields _sifields; + }; + l_int _pad[LINUX_SI_MAX_SIZE/sizeof(l_int)]; + }; +} l_siginfo_t; + +_Static_assert(sizeof(l_siginfo_t) == LINUX_SI_MAX_SIZE, "l_siginfo_t size"); + +#define lsi_pid _sifields._kill._pid +#define lsi_uid _sifields._kill._uid +#define lsi_tid _sifields._timer._tid +#define lsi_overrun _sifields._timer._overrun +#define lsi_sys_private _sifields._timer._sys_private +#define lsi_status _sifields._sigchld._status +#define lsi_utime _sifields._sigchld._utime +#define lsi_stime _sifields._sigchld._stime +#define lsi_value _sifields._rt._sigval +#define lsi_int _sifields._rt._sigval.sival_int +#define lsi_ptr _sifields._rt._sigval.sival_ptr +#define lsi_addr _sifields._sigfault._addr +#define lsi_band _sifields._sigpoll._band +#define lsi_fd _sifields._sigpoll._fd + +#endif /* _LINUX_SIGINFO_H_ */ diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 75995587373b..210fb6ca5778 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -74,6 +74,8 @@ typedef l_int l_timer_t; typedef l_int l_mqd_t; typedef l_ulong l_fd_mask; +#include + typedef struct { l_int val[2]; } l_fsid_t; @@ -260,74 +262,6 @@ typedef struct { l_size_t ss_size; } l_stack_t; -#define LINUX_SI_MAX_SIZE 128 -#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3) - -typedef union l_sigval { - l_int sival_int; - l_uintptr_t sival_ptr; -} l_sigval_t; - -typedef struct l_siginfo { - l_int lsi_signo; - l_int lsi_errno; - l_int lsi_code; - union { - l_int _pad[LINUX_SI_PAD_SIZE]; - - struct { - l_pid_t _pid; - l_uid_t _uid; - } _kill; - - struct { - l_timer_t _tid; - l_int _overrun; - char _pad[sizeof(l_uid_t) - sizeof(l_int)]; - l_sigval_t _sigval; - l_int _sys_private; - } _timer; - - struct { - l_pid_t _pid; /* sender's pid */ - l_uid_t _uid; /* sender's uid */ - l_sigval_t _sigval; - } _rt; - - struct { - l_pid_t _pid; /* which child */ - l_uid_t _uid; /* sender's uid */ - l_int _status; /* exit code */ - l_clock_t _utime; - l_clock_t _stime; - } _sigchld; - - struct { - l_uintptr_t _addr; /* Faulting insn/memory ref. */ - } _sigfault; - - struct { - l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ - l_int _fd; - } _sigpoll; - } _sifields; -} l_siginfo_t; - -#define lsi_pid _sifields._kill._pid -#define lsi_uid _sifields._kill._uid -#define lsi_tid _sifields._timer._tid -#define lsi_overrun _sifields._timer._overrun -#define lsi_sys_private _sifields._timer._sys_private -#define lsi_status _sifields._sigchld._status -#define lsi_utime _sifields._sigchld._utime -#define lsi_stime _sifields._sigchld._stime -#define lsi_value _sifields._rt._sigval -#define lsi_int _sifields._rt._sigval.sival_int -#define lsi_ptr _sifields._rt._sigval.sival_ptr -#define lsi_addr _sifields._sigfault._addr -#define lsi_band _sifields._sigpoll._band -#define lsi_fd _sifields._sigpoll._fd - extern struct sysentvec linux_sysvec; /*