1433d6423SLionel Sambuc /* The kernel call implemented in this file:
2433d6423SLionel Sambuc * m_type: SYS_STATECTL
3433d6423SLionel Sambuc *
4433d6423SLionel Sambuc * The parameters for this kernel call are:
5433d6423SLionel Sambuc * m_lsys_krn_sys_statectl.request (state control request)
6433d6423SLionel Sambuc */
7433d6423SLionel Sambuc
8433d6423SLionel Sambuc #include "kernel/system.h"
9433d6423SLionel Sambuc
10433d6423SLionel Sambuc #if USE_STATECTL
11433d6423SLionel Sambuc
12433d6423SLionel Sambuc /*===========================================================================*
13433d6423SLionel Sambuc * do_statectl *
14433d6423SLionel Sambuc *===========================================================================*/
do_statectl(struct proc * caller,message * m_ptr)15433d6423SLionel Sambuc int do_statectl(struct proc * caller, message * m_ptr)
16433d6423SLionel Sambuc {
17433d6423SLionel Sambuc /* Handle sys_statectl(). A process has issued a state control request. */
18433d6423SLionel Sambuc
19433d6423SLionel Sambuc switch(m_ptr->m_lsys_krn_sys_statectl.request)
20433d6423SLionel Sambuc {
21433d6423SLionel Sambuc case SYS_STATE_CLEAR_IPC_REFS:
22433d6423SLionel Sambuc /* Clear IPC references for all the processes communicating
23433d6423SLionel Sambuc * with the caller.
24433d6423SLionel Sambuc */
25433d6423SLionel Sambuc clear_ipc_refs(caller, EDEADSRCDST);
26433d6423SLionel Sambuc return(OK);
2741022be1SCristiano Giuffrida case SYS_STATE_SET_STATE_TABLE:
2841022be1SCristiano Giuffrida /* Set state table for the caller. */
2941022be1SCristiano Giuffrida priv(caller)->s_state_table = (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address;
3041022be1SCristiano Giuffrida priv(caller)->s_state_entries = m_ptr->m_lsys_krn_sys_statectl.length;
3141022be1SCristiano Giuffrida return(OK);
32*c8a9900bSCristiano Giuffrida case SYS_STATE_ADD_IPC_BL_FILTER:
33*c8a9900bSCristiano Giuffrida /* Add an IPC blacklist filter for the caller. */
34*c8a9900bSCristiano Giuffrida return add_ipc_filter(caller, IPCF_BLACKLIST,
35*c8a9900bSCristiano Giuffrida (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address,
36*c8a9900bSCristiano Giuffrida m_ptr->m_lsys_krn_sys_statectl.length);
37*c8a9900bSCristiano Giuffrida case SYS_STATE_ADD_IPC_WL_FILTER:
38*c8a9900bSCristiano Giuffrida /* Add an IPC whitelist filter for the caller. */
39*c8a9900bSCristiano Giuffrida return add_ipc_filter(caller, IPCF_WHITELIST,
40*c8a9900bSCristiano Giuffrida (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address,
41*c8a9900bSCristiano Giuffrida m_ptr->m_lsys_krn_sys_statectl.length);
42*c8a9900bSCristiano Giuffrida case SYS_STATE_CLEAR_IPC_FILTERS:
43*c8a9900bSCristiano Giuffrida /* Clear any IPC filter for the caller. */
44*c8a9900bSCristiano Giuffrida clear_ipc_filters(caller);
45*c8a9900bSCristiano Giuffrida return OK;
46433d6423SLionel Sambuc default:
47433d6423SLionel Sambuc printf("do_statectl: bad request %d\n",
48433d6423SLionel Sambuc m_ptr->m_lsys_krn_sys_statectl.request);
49433d6423SLionel Sambuc return EINVAL;
50433d6423SLionel Sambuc }
51433d6423SLionel Sambuc }
52433d6423SLionel Sambuc
53433d6423SLionel Sambuc #endif /* USE_STATECTL */
54