2006-06-23 17:35:05 +02:00
|
|
|
/* 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 *
|
|
|
|
*===========================================================================*/
|
2010-02-03 10:04:48 +01:00
|
|
|
PUBLIC int do_setgrant(struct proc * caller, message * m_ptr)
|
2006-06-23 17:35:05 +02:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
|
|
|
/* Copy grant table set in priv. struct. */
|
2010-02-03 10:04:48 +01:00
|
|
|
if (RTS_ISSET(caller, RTS_NO_PRIV) || !(priv(caller))) {
|
2006-06-23 17:35:05 +02:00
|
|
|
r = EPERM;
|
|
|
|
} else {
|
2010-02-03 10:04:48 +01:00
|
|
|
_K_SET_GRANT_TABLE(caller,
|
2006-06-23 17:35:05 +02:00
|
|
|
(vir_bytes) m_ptr->SG_ADDR,
|
|
|
|
m_ptr->SG_SIZE);
|
|
|
|
r = OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|