sm_process_death: Avoid redefinition errors due to kernel headers
Prior to the v5.10-based StarlingX kernel, the "#ifdef CONFIG_SIGEXIT" guard in prctl.h would require the user-space to either define the CONFIG_SIGEXIT macro, or define the PR_DO_NOTIFY_TASK_STATE macro *and* the task_state_notify_info structure to avoid build failures. The service manager code had taken the latter approach. Now that the prctl.h header file has been fixed in the v5.10-based kernel to not guard these user-space APIs with "#ifdef CONFIG_SIGEXIT", the service manager is encountering the following compilation errors: sm_process_death.c:49:8: error: redefinition of \ 'struct task_state_notify_info' struct task_state_notify_info ^ In file included from /usr/include/sys/prctl.h:22:0, from sm_process_death.c:18: /usr/include/linux/prctl.h:76:8: error: previous definition of \ 'struct task_state_notify_info' struct task_state_notify_info { ^ This commit avoids these errors by detecting whether the PR_DO_NOTIFY_TASK_STATE macro has already been defined, which ought to preserve backwards compatibility with older StarlingX kernels. Story: 2008921 Change-Id: I0c28fe8b3d314931583462a3377f81ec0ca1f630 Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
This commit is contained in:
parent
f6f4b68527
commit
ff9e32bb80
|
@ -35,23 +35,28 @@
|
|||
#define SM_KERNEL_NOTIFY_FLAGS \
|
||||
( SM_KERNEL_NOTIFY_EXITED | SM_KERNEL_NOTIFY_KILLED )
|
||||
|
||||
#define SM_KERNEL_NOTIFY_SIGNAL (SIGRTMIN+1)
|
||||
|
||||
// Avoid redefinition errors for PR_DO_NOTIFY_TASK_STATE macro and
|
||||
// task_state_notify_info struct as the kernel headers may have
|
||||
// already defined them.
|
||||
#ifndef PR_DO_NOTIFY_TASK_STATE
|
||||
// Set/get notification for task state changes.
|
||||
#define PR_DO_NOTIFY_TASK_STATE 17
|
||||
|
||||
#define SM_KERNEL_NOTIFY_SIGNAL (SIGRTMIN+1)
|
||||
|
||||
// This is the data structure for requestion process death
|
||||
// (and other state change) information. Sig of -1 means
|
||||
// query, sig of 0 means deregistration, positive sig means
|
||||
// that you want to set it. sig and events are value-result
|
||||
// and will be updated with the previous values on every
|
||||
// successful call.
|
||||
struct task_state_notify_info
|
||||
struct task_state_notify_info
|
||||
{
|
||||
pid_t pid;
|
||||
int sig;
|
||||
unsigned int events;
|
||||
int sig;
|
||||
unsigned int events;
|
||||
};
|
||||
#endif // !PR_DO_NOTIFY_TASK_STATE
|
||||
#endif // __SM_PROCESS_DEATH_KERNEL_NOTIFICATION_SUPPORTED__
|
||||
|
||||
#define SM_PROCESS_DEATH_MAX 1024
|
||||
|
|
Loading…
Reference in New Issue