From: Ben Gras Date: Fri, 23 Jun 2006 15:35:05 +0000 (+0000) Subject: Rename paramctl to setgrant. X-Git-Tag: v3.1.3~290 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/zones/static/Bv9ARM.ch07.html?a=commitdiff_plain;h=3b814d36d16e46ab6e115782ae1734dfe1189ca4;p=minix.git Rename paramctl to setgrant. --- diff --git a/include/minix/com.h b/include/minix/com.h index 679d3ca4a..b4b65bf38 100755 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -289,7 +289,7 @@ # define SYS_SAFECOPYFROM (KERNEL_CALL + 31) /* sys_safecopyfrom() */ # define SYS_SAFECOPYTO (KERNEL_CALL + 32) /* sys_safecopyto() */ # define SYS_VSAFECOPY (KERNEL_CALL + 33) /* sys_vsafecopy() */ -# define SYS_PARAMCTL (KERNEL_CALL + 34) /* sys_paramctl() */ +# define SYS_SETGRANT (KERNEL_CALL + 34) /* sys_setgrant() */ #define NR_SYS_CALLS 35 /* number of system calls */ @@ -303,7 +303,7 @@ */ #define SYS_PRIV_ADD_IRQ 4 /* Add IRQ */ -/* Subfunctions for SYS_PARAMCTL */ +/* Subfunctions for SYS_SETGRANT */ #define SYS_PARAM_SET_GRANT 1 /* Set address and size of grant table */ /* Field names for SYS_MEMSET, SYS_SEGCTL. */ @@ -447,11 +447,9 @@ #define CTL_ADDRESS m2_l1 /* address at traced process' space */ #define CTL_DATA m2_l2 /* data field for tracing */ -/* Field names for SYS_PARAMCTL */ -#define PCTL_REQ m2_i1 /* request code */ -#define PCTL_INT1 m2_i2 /* int param 1 */ -#define PCTL_INT2 m2_i3 /* int param 2 */ -#define PCTL_ADDR1 m2_p1 /* address param 1 */ +/* Field names for SYS_SETGRANT */ +#define SG_ADDR m2_p1 /* address */ +#define SG_SIZE m2_i2 /* no. of entries */ /* Field names for SYS_KILL, SYS_SIGCTL */ #define SIG_REQUEST m2_l2 /* PM signal control request */ diff --git a/include/minix/syslib.h b/include/minix/syslib.h index ad7cca1cd..85a8b3a83 100755 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -37,7 +37,7 @@ _PROTOTYPE( int sys_exit, (endpoint_t proc)); _PROTOTYPE( int sys_trace, (int req, endpoint_t proc, long addr, long *data_p)); _PROTOTYPE( int sys_privctl, (endpoint_t proc, int req, int i, void *p)); -_PROTOTYPE( int sys_paramctl, (int req, int int1, void *addr1, int int2)); +_PROTOTYPE( int sys_setgrant, (cp_grant_t *grants, int ngrants)); _PROTOTYPE( int sys_nice, (endpoint_t proc, int priority)); _PROTOTYPE( int sys_int86, (struct reg86u *reg86p)); diff --git a/kernel/system.c b/kernel/system.c index bfdc1f419..5520bfcdb 100755 --- a/kernel/system.c +++ b/kernel/system.c @@ -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 */ diff --git a/kernel/system.h b/kernel/system.h index fd7ef35e8..452ca2543 100644 --- a/kernel/system.h +++ b/kernel/system.h @@ -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 */ diff --git a/kernel/system/Makefile b/kernel/system/Makefile index a3b288f6a..9c873ee57 100644 --- a/kernel/system/Makefile +++ b/kernel/system/Makefile @@ -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 diff --git a/kernel/system/do_paramctl.c b/kernel/system/do_paramctl.c deleted file mode 100644 index 2fcd24b1f..000000000 --- a/kernel/system/do_paramctl.c +++ /dev/null @@ -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 - -/*===========================================================================* - * 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; -} diff --git a/kernel/system/do_setgrant.c b/kernel/system/do_setgrant.c new file mode 100644 index 000000000..7f353e33a --- /dev/null +++ b/kernel/system/do_setgrant.c @@ -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 + +/*===========================================================================* + * 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; +} diff --git a/lib/syslib/Makefile.in b/lib/syslib/Makefile.in index a0e0621da..0b0736b7f 100644 --- a/lib/syslib/Makefile.in +++ b/lib/syslib/Makefile.in @@ -49,7 +49,7 @@ libsys_FILES=" \ sys_sigreturn.c \ sys_sigsend.c \ sys_privctl.c \ - sys_paramctl.c \ + sys_setgrant.c \ sys_times.c \ sys_trace.c \ sys_umap.c \ diff --git a/lib/syslib/safecopies.c b/lib/syslib/safecopies.c index 14298d11a..1b3312e87 100644 --- a/lib/syslib/safecopies.c +++ b/lib/syslib/safecopies.c @@ -35,7 +35,7 @@ cpf_preallocate(cp_grant_t *new_grants, int new_ngrants) } /* Update kernel about the table. */ - if((s=sys_paramctl(SYS_PARAM_SET_GRANT, new_ngrants, new_grants, 0))) { + if((s=sys_setgrant(new_grants, new_ngrants))) { return -1; } @@ -80,7 +80,7 @@ cpf_grow(void) new_grants[g].cp_flags = 0; /* Inform kernel about new size (and possibly new location). */ - if((sys_paramctl(SYS_PARAM_SET_GRANT, new_size, new_grants, 0))) { + if((sys_setgrant(new_grants, new_size))) { free(new_grants); return; /* Failed - don't grow then. */ } diff --git a/lib/syslib/sys_setgrant.c b/lib/syslib/sys_setgrant.c new file mode 100644 index 000000000..6d2c96daf --- /dev/null +++ b/lib/syslib/sys_setgrant.c @@ -0,0 +1,14 @@ + +#include "syslib.h" + +#include + +int sys_setgrant(cp_grant_t *grants, int ngrants) +{ + message m; + + m.SG_ADDR = (char *) grants; + m.SG_SIZE = ngrants; + + return _taskcall(SYSTASK, SYS_SETGRANT, &m); +}