git: 638a0649cf18 - stable/13 - linux(4): Add support for __WALL wait option bit.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 19:38:46 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=638a0649cf185da082b9cae6a5a6d0535db604b3

commit 638a0649cf185da082b9cae6a5a6d0535db604b3
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-03-31 17:42:03 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:45 +0000

    linux(4): Add support for __WALL wait option bit.
    
    As FreeBSD does not have __WALL option bit analogue explicitly set all
    possible option bits to emulate Linux __WALL wait option bit.
    
    Reviewed by:            emaste
    Differential revision:  https://reviews.freebsd.org/D31555
    MFC after:              2 weeks
    
    (cherry picked from commit c7ef7c3facaf663c3da2d91916bcb2f162fc300e)
---
 sys/compat/linux/linux_misc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 00783091175c..b761917b2dc9 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1063,6 +1063,14 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args)
 	 */
 	options |= WEXITED | WTRAPPED;
 
+	/*
+	 * As FreeBSD does not have __WALL option bit analogue explicitly set all
+	 * possible option bits to emulate Linux __WALL wait option bit. The same
+	 * for waitid system call.
+	 */
+	if ((args->options & __WALL) != 0)
+		options |= WUNTRACED | WCONTINUED | WLINUXCLONE;
+
 	if (args->pid == WAIT_ANY) {
 		idtype = P_ALL;
 		id = 0;
@@ -1096,6 +1104,9 @@ linux_waitid(struct thread *td, struct linux_waitid_args *args)
 
 	options = 0;
 	linux_to_bsd_waitopts(args->options, &options);
+	if ((args->options & __WALL) != 0)
+		options |= WEXITED | WTRAPPED | WUNTRACED |
+		    WCONTINUED | WLINUXCLONE;
 
 	switch (args->idtype) {
 	case LINUX_P_ALL: