xref: /minix3/minix/kernel/system/do_statectl.c (revision 41022be18241fb5c8cc01e14c238c7e5273a4a06)
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  *===========================================================================*/
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);
27*41022be1SCristiano Giuffrida   case SYS_STATE_SET_STATE_TABLE:
28*41022be1SCristiano Giuffrida 	/* Set state table for the caller. */
29*41022be1SCristiano Giuffrida 	priv(caller)->s_state_table = (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address;
30*41022be1SCristiano Giuffrida 	priv(caller)->s_state_entries = m_ptr->m_lsys_krn_sys_statectl.length;
31*41022be1SCristiano Giuffrida 	return(OK);
32433d6423SLionel Sambuc   default:
33433d6423SLionel Sambuc 	printf("do_statectl: bad request %d\n",
34433d6423SLionel Sambuc 		m_ptr->m_lsys_krn_sys_statectl.request);
35433d6423SLionel Sambuc 	return EINVAL;
36433d6423SLionel Sambuc   }
37433d6423SLionel Sambuc }
38433d6423SLionel Sambuc 
39433d6423SLionel Sambuc #endif /* USE_STATECTL */
40