minix/minix/kernel/system/do_statectl.c
Cristiano Giuffrida c8a9900b0c kernel: Add support for IPC filters.
Edited by David van Moolenbroek.

Change-Id: Ia0052c42a0f218d011dd2da1e3db6c5b2107adc7
2015-09-16 11:02:24 +00:00

54 lines
1.7 KiB
C

/* The kernel call implemented in this file:
* m_type: SYS_STATECTL
*
* The parameters for this kernel call are:
* m_lsys_krn_sys_statectl.request (state control request)
*/
#include "kernel/system.h"
#if USE_STATECTL
/*===========================================================================*
* do_statectl *
*===========================================================================*/
int do_statectl(struct proc * caller, message * m_ptr)
{
/* Handle sys_statectl(). A process has issued a state control request. */
switch(m_ptr->m_lsys_krn_sys_statectl.request)
{
case SYS_STATE_CLEAR_IPC_REFS:
/* Clear IPC references for all the processes communicating
* with the caller.
*/
clear_ipc_refs(caller, EDEADSRCDST);
return(OK);
case SYS_STATE_SET_STATE_TABLE:
/* Set state table for the caller. */
priv(caller)->s_state_table = (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address;
priv(caller)->s_state_entries = m_ptr->m_lsys_krn_sys_statectl.length;
return(OK);
case SYS_STATE_ADD_IPC_BL_FILTER:
/* Add an IPC blacklist filter for the caller. */
return add_ipc_filter(caller, IPCF_BLACKLIST,
(vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address,
m_ptr->m_lsys_krn_sys_statectl.length);
case SYS_STATE_ADD_IPC_WL_FILTER:
/* Add an IPC whitelist filter for the caller. */
return add_ipc_filter(caller, IPCF_WHITELIST,
(vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address,
m_ptr->m_lsys_krn_sys_statectl.length);
case SYS_STATE_CLEAR_IPC_FILTERS:
/* Clear any IPC filter for the caller. */
clear_ipc_filters(caller);
return OK;
default:
printf("do_statectl: bad request %d\n",
m_ptr->m_lsys_krn_sys_statectl.request);
return EINVAL;
}
}
#endif /* USE_STATECTL */