xref: /minix/minix/kernel/system/do_statectl.c (revision 9f988b79)
1 /* The kernel call implemented in this file:
2  *   m_type:	SYS_STATECTL
3  *
4  * The parameters for this kernel call are:
5  *   m_lsys_krn_sys_statectl.request	(state control request)
6  */
7 
8 #include "kernel/system.h"
9 
10 #if USE_STATECTL
11 
12 /*===========================================================================*
13  *			          do_statectl				     *
14  *===========================================================================*/
15 int do_statectl(struct proc * caller, message * m_ptr)
16 {
17 /* Handle sys_statectl(). A process has issued a state control request. */
18 
19   switch(m_ptr->m_lsys_krn_sys_statectl.request)
20   {
21   case SYS_STATE_CLEAR_IPC_REFS:
22 	/* Clear IPC references for all the processes communicating
23 	 * with the caller.
24 	 */
25 	clear_ipc_refs(caller, EDEADSRCDST);
26 	return(OK);
27   case SYS_STATE_SET_STATE_TABLE:
28 	/* Set state table for the caller. */
29 	priv(caller)->s_state_table = (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address;
30 	priv(caller)->s_state_entries = m_ptr->m_lsys_krn_sys_statectl.length;
31 	return(OK);
32   case SYS_STATE_ADD_IPC_BL_FILTER:
33 	/* Add an IPC blacklist filter for the caller. */
34 	return add_ipc_filter(caller, IPCF_BLACKLIST,
35 	    (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address,
36 	    m_ptr->m_lsys_krn_sys_statectl.length);
37   case SYS_STATE_ADD_IPC_WL_FILTER:
38 	/* Add an IPC whitelist filter for the caller. */
39 	return add_ipc_filter(caller, IPCF_WHITELIST,
40 	    (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address,
41 	    m_ptr->m_lsys_krn_sys_statectl.length);
42   case SYS_STATE_CLEAR_IPC_FILTERS:
43 	/* Clear any IPC filter for the caller. */
44 	clear_ipc_filters(caller);
45 	return OK;
46   default:
47 	printf("do_statectl: bad request %d\n",
48 		m_ptr->m_lsys_krn_sys_statectl.request);
49 	return EINVAL;
50   }
51 }
52 
53 #endif /* USE_STATECTL */
54