minix/minix/lib/libsys/checkperms.c
Lionel Sambuc 433d6423c3 New sources layout
Change-Id: Ic716f336b7071063997cf5b4dae6d50e0b4631e9
2014-07-31 16:00:30 +02:00

28 lines
558 B
C

#include "syslib.h"
#include <unistd.h>
#include <string.h>
#include <minix/safecopies.h>
int
checkperms(endpoint_t endpt, char *path, size_t size)
{
cp_grant_id_t grant;
message m;
int r;
if ((grant = cpf_grant_direct(VFS_PROC_NR, (vir_bytes) path, size,
CPF_READ | CPF_WRITE)) == GRANT_INVALID)
return ENOMEM;
memset(&m, 0, sizeof(m));
m.m_lsys_vfs_checkperms.endpt = endpt;
m.m_lsys_vfs_checkperms.grant = grant;
m.m_lsys_vfs_checkperms.count = size;
r = _taskcall(VFS_PROC_NR, VFS_CHECKPERMS, &m);
cpf_revoke(grant);
return r;
}