Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

exit: add internal include file with helpers

Move struct wait_opts and waitid_info into kernel/exit.h, and include
function declarations for the recently added helpers. Make them
non-static as well.

This is in preparation for adding a waitid operation through io_uring.
With the abtracted helpers, this is now possible.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+37 -25
+7 -25
kernel/exit.c
··· 74 74 #include <asm/unistd.h> 75 75 #include <asm/mmu_context.h> 76 76 77 + #include "exit.h" 78 + 77 79 /* 78 80 * The default value should be high enough to not crash a system that randomly 79 81 * crashes its kernel from time to time, but low enough to at least not permit ··· 1039 1037 return 0; 1040 1038 } 1041 1039 1042 - struct waitid_info { 1043 - pid_t pid; 1044 - uid_t uid; 1045 - int status; 1046 - int cause; 1047 - }; 1048 - 1049 - struct wait_opts { 1050 - enum pid_type wo_type; 1051 - int wo_flags; 1052 - struct pid *wo_pid; 1053 - 1054 - struct waitid_info *wo_info; 1055 - int wo_stat; 1056 - struct rusage *wo_rusage; 1057 - 1058 - wait_queue_entry_t child_wait; 1059 - int notask_error; 1060 - }; 1061 - 1062 1040 static int eligible_pid(struct wait_opts *wo, struct task_struct *p) 1063 1041 { 1064 1042 return wo->wo_type == PIDTYPE_MAX || ··· 1502 1520 return 0; 1503 1521 } 1504 1522 1505 - static bool pid_child_should_wake(struct wait_opts *wo, struct task_struct *p) 1523 + bool pid_child_should_wake(struct wait_opts *wo, struct task_struct *p) 1506 1524 { 1507 1525 if (!eligible_pid(wo, p)) 1508 1526 return false; ··· 1572 1590 return 0; 1573 1591 } 1574 1592 1575 - static long __do_wait(struct wait_opts *wo) 1593 + long __do_wait(struct wait_opts *wo) 1576 1594 { 1577 1595 long retval; 1578 1596 ··· 1644 1662 return retval; 1645 1663 } 1646 1664 1647 - static int kernel_waitid_prepare(struct wait_opts *wo, int which, pid_t upid, 1648 - struct waitid_info *infop, int options, 1649 - struct rusage *ru) 1665 + int kernel_waitid_prepare(struct wait_opts *wo, int which, pid_t upid, 1666 + struct waitid_info *infop, int options, 1667 + struct rusage *ru) 1650 1668 { 1651 1669 unsigned int f_flags = 0; 1652 1670 struct pid *pid = NULL;
+30
kernel/exit.h
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #ifndef LINUX_WAITID_H 3 + #define LINUX_WAITID_H 4 + 5 + struct waitid_info { 6 + pid_t pid; 7 + uid_t uid; 8 + int status; 9 + int cause; 10 + }; 11 + 12 + struct wait_opts { 13 + enum pid_type wo_type; 14 + int wo_flags; 15 + struct pid *wo_pid; 16 + 17 + struct waitid_info *wo_info; 18 + int wo_stat; 19 + struct rusage *wo_rusage; 20 + 21 + wait_queue_entry_t child_wait; 22 + int notask_error; 23 + }; 24 + 25 + bool pid_child_should_wake(struct wait_opts *wo, struct task_struct *p); 26 + long __do_wait(struct wait_opts *wo); 27 + int kernel_waitid_prepare(struct wait_opts *wo, int which, pid_t upid, 28 + struct waitid_info *infop, int options, 29 + struct rusage *ru); 30 + #endif