From 2d25f71f2a661cd8a5638aa88bc7a48dde3e736d Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Tue, 27 Jul 2021 16:19:55 -0400 Subject: [PATCH] pmon.h: Ensure compat. with v5.10 kernel The v5.10 kernel no longer guards the task_state_notify_info data structure with #ifdef CONFIG_SIGEXIT, which causes a redefinition-related compilation error. Work around this by checking for the existence of the PR_DO_NOTIFY_TASK_STATE macro, and only define the PR_DO_NOTIFY_TASK_STATE and the task_state_notify_info structure if the kernel does not do so. Story: 2008921 Task: 42915 Change-Id: I4bb499e2b52e20542f202dea1c2c55d88bb8ba61 Signed-off-by: M. Vefa Bicakci --- mtce/src/pmon/pmon.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mtce/src/pmon/pmon.h b/mtce/src/pmon/pmon.h index 158553da..009c6fe5 100755 --- a/mtce/src/pmon/pmon.h +++ b/mtce/src/pmon/pmon.h @@ -140,6 +140,12 @@ using namespace std; /* Notification of Death Of Arbitrary Process */ +/* Newer kernel headers expose the PR_DO_NOTIFY_TASK_STATE macro and the + * task_state_notify_info structure to user-space via the prctl.h header, so + * guard the definition of the macro and the structure with a pre-processor + * condition to avoid redefinition-related compilation errors. + */ +#ifndef PR_DO_NOTIFY_TASK_STATE /* New PRCTL Flag * * Set/get notification for task state changes */ @@ -158,6 +164,7 @@ struct task_state_notify_info int sig ; unsigned int events; }; +#endif /* !PR_DO_NOTIFY_TASK_STATE */ /* The "events" bits in the struct correspond to the si_code values in the siginfo_t struct * that would normally be sent along with a SIGCHLD to the parent process.