New kernel call, SYS_PARAMCTL, that sets parameters of the caller
and is therefore unprivileged. Used to set grant tables.
This commit is contained in:
@@ -49,6 +49,7 @@ libsys_FILES=" \
|
||||
sys_sigreturn.c \
|
||||
sys_sigsend.c \
|
||||
sys_privctl.c \
|
||||
sys_paramctl.c \
|
||||
sys_times.c \
|
||||
sys_trace.c \
|
||||
sys_umap.c \
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <minix/syslib.h>
|
||||
#include <minix/safecopies.h>
|
||||
#include <minix/com.h>
|
||||
#include <string.h>
|
||||
|
||||
PRIVATE cp_grant_t *grants = NULL;
|
||||
PRIVATE int ngrants = 0, dynamic = 1;
|
||||
@@ -33,8 +35,7 @@ cpf_preallocate(cp_grant_t *new_grants, int new_ngrants)
|
||||
}
|
||||
|
||||
/* Update kernel about the table. */
|
||||
if((s=sys_privctl(SELF, SYS_PRIV_SET_GRANTS,
|
||||
new_ngrants, new_grants))) {
|
||||
if((s=sys_paramctl(SYS_PARAM_SET_GRANT, new_ngrants, new_grants, 0))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ cpf_grow(void)
|
||||
new_grants[g].cp_flags = 0;
|
||||
|
||||
/* Inform kernel about new size (and possibly new location). */
|
||||
if(sys_privctl(SELF, SYS_PRIV_SET_GRANTS, new_size, new_grants)) {
|
||||
if((sys_paramctl(SYS_PARAM_SET_GRANT, new_size, new_grants, 0))) {
|
||||
free(new_grants);
|
||||
return; /* Failed - don't grow then. */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user