Kernel: make SIGKMESS target process list dynamic
The set of processes to which a SIGKMESS signal is sent whenever new diagnostics messages are added to the kernel's message buffer, is now no longer hardcoded. Instead, processes can (un)register themselves to receive such notifications, by means of sys_diagctl(). Change-Id: I9d6ac006a5d9bbfad2757587a068fc1ec3cc083e
This commit is contained in:
@@ -42,6 +42,21 @@ int do_diagctl(struct proc * caller, message * m_ptr)
|
||||
return EINVAL;
|
||||
proc_stacktrace(proc_addr(proc_nr));
|
||||
return OK;
|
||||
case DIAGCTL_CODE_REGISTER:
|
||||
if (!(priv(caller)->s_flags & SYS_PROC))
|
||||
return EPERM;
|
||||
priv(caller)->s_diag_sig = TRUE;
|
||||
/* If the message log is not empty, send a first notification
|
||||
* immediately. After bootup the log is basically never empty.
|
||||
*/
|
||||
if (kmess.km_size > 0 && !kinfo.do_serial_debug)
|
||||
send_sig(caller->p_endpoint, SIGKMESS);
|
||||
return OK;
|
||||
case DIAGCTL_CODE_UNREGISTER:
|
||||
if (!(priv(caller)->s_flags & SYS_PROC))
|
||||
return EPERM;
|
||||
priv(caller)->s_diag_sig = FALSE;
|
||||
return OK;
|
||||
default:
|
||||
printf("do_diagctl: invalid request %d\n", m_ptr->DIAGCTL_CODE);
|
||||
return(EINVAL);
|
||||
|
||||
@@ -116,6 +116,7 @@ int do_privctl(struct proc * caller, message * m_ptr)
|
||||
reset_kernel_timer(&priv(rp)->s_alarm_timer); /* - alarm */
|
||||
priv(rp)->s_asyntab= -1; /* - asynsends */
|
||||
priv(rp)->s_asynsize= 0;
|
||||
priv(rp)->s_diag_sig = FALSE; /* no request for diag sigs */
|
||||
|
||||
/* Set defaults for privilege bitmaps. */
|
||||
priv(rp)->s_flags= DSRV_F; /* privilege flags */
|
||||
|
||||
@@ -161,6 +161,7 @@ static void adjust_priv_slot(struct priv *privp, struct priv *from_privp)
|
||||
privp->s_int_pending = from_privp->s_int_pending;
|
||||
privp->s_sig_pending = from_privp->s_sig_pending;
|
||||
privp->s_alarm_timer = from_privp->s_alarm_timer;
|
||||
privp->s_diag_sig = from_privp->s_diag_sig;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
||||
Reference in New Issue
Block a user