Rename paramctl to setgrant.
This commit is contained in:
@@ -148,7 +148,7 @@ PRIVATE void initialize(void)
|
||||
map(SYS_NICE, do_nice); /* set scheduling priority */
|
||||
map(SYS_PRIVCTL, do_privctl); /* system privileges control */
|
||||
map(SYS_TRACE, do_trace); /* request a trace operation */
|
||||
map(SYS_PARAMCTL, do_paramctl); /* get/set own parameters */
|
||||
map(SYS_SETGRANT, do_setgrant); /* get/set own parameters */
|
||||
|
||||
/* Signal handling. */
|
||||
map(SYS_KILL, do_kill); /* cause a process to be signaled */
|
||||
|
||||
@@ -176,7 +176,7 @@ _PROTOTYPE( int do_setalarm, (message *m_ptr) );
|
||||
_PROTOTYPE( int do_safecopy, (message *m_ptr) );
|
||||
_PROTOTYPE( int do_vsafecopy, (message *m_ptr) );
|
||||
_PROTOTYPE( int do_iopenable, (message *m_ptr) );
|
||||
_PROTOTYPE( int do_paramctl, (message *m_ptr) );
|
||||
_PROTOTYPE( int do_setgrant, (message *m_ptr) );
|
||||
|
||||
#endif /* SYSTEM_H */
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ OBJECTS = \
|
||||
$(SYSTEM)(do_vcopy.o) \
|
||||
$(SYSTEM)(do_umap.o) \
|
||||
$(SYSTEM)(do_memset.o) \
|
||||
$(SYSTEM)(do_paramctl.o) \
|
||||
$(SYSTEM)(do_setgrant.o) \
|
||||
$(SYSTEM)(do_privctl.o) \
|
||||
$(SYSTEM)(do_segctl.o) \
|
||||
$(SYSTEM)(do_safecopy.o) \
|
||||
@@ -138,8 +138,8 @@ $(SYSTEM)(do_getinfo.o): do_getinfo.c
|
||||
$(SYSTEM)(do_abort.o): do_abort.c
|
||||
$(CC) do_abort.c
|
||||
|
||||
$(SYSTEM)(do_paramctl.o): do_paramctl.c
|
||||
$(CC) do_paramctl.c
|
||||
$(SYSTEM)(do_setgrant.o): do_setgrant.c
|
||||
$(CC) do_setgrant.c
|
||||
|
||||
$(SYSTEM)(do_privctl.o): do_privctl.c
|
||||
$(CC) do_privctl.c
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/* The kernel call implemented in this file:
|
||||
* m_type: SYS_PARAMCTL
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* PCTL_REQ request code (SYS_PARAM_*)
|
||||
* PCTL_INT[12] integer parameters
|
||||
* PCTL_ADDR1 address parameter
|
||||
*/
|
||||
|
||||
#include "../system.h"
|
||||
#include <minix/safecopies.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* do_paramctl *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_paramctl(m_ptr)
|
||||
message *m_ptr;
|
||||
{
|
||||
struct proc *rp;
|
||||
int r;
|
||||
|
||||
/* Who wants to set a parameter? */
|
||||
rp = proc_addr(who_p);
|
||||
|
||||
/* Which parameter is it? */
|
||||
switch(m_ptr->PCTL_REQ) {
|
||||
|
||||
case SYS_PARAM_SET_GRANT:
|
||||
/* Copy grant table set in priv. struct. */
|
||||
if ((rp->p_rts_flags & NO_PRIV) || !(priv(rp))) {
|
||||
r = EPERM;
|
||||
} else {
|
||||
_K_SET_GRANT_TABLE(rp,
|
||||
(vir_bytes) m_ptr->PCTL_ADDR1,
|
||||
m_ptr->PCTL_INT1);
|
||||
r = OK;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
r = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
35
kernel/system/do_setgrant.c
Normal file
35
kernel/system/do_setgrant.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* The kernel call implemented in this file:
|
||||
* m_type: SYS_SETGRANT
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* SG_ADDR address of grant table in own address space
|
||||
* SG_SIZE number of entries
|
||||
*/
|
||||
|
||||
#include "../system.h"
|
||||
#include <minix/safecopies.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* do_setgrant *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_setgrant(m_ptr)
|
||||
message *m_ptr;
|
||||
{
|
||||
struct proc *rp;
|
||||
int r;
|
||||
|
||||
/* Who wants to set a parameter? */
|
||||
rp = proc_addr(who_p);
|
||||
|
||||
/* Copy grant table set in priv. struct. */
|
||||
if ((rp->p_rts_flags & NO_PRIV) || !(priv(rp))) {
|
||||
r = EPERM;
|
||||
} else {
|
||||
_K_SET_GRANT_TABLE(rp,
|
||||
(vir_bytes) m_ptr->SG_ADDR,
|
||||
m_ptr->SG_SIZE);
|
||||
r = OK;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
Reference in New Issue
Block a user