BSD 2 development
[unix-history] / misc / access.sys
--- This is a new line for sysent.c ---
2, &saccess, /* 33 = access */
--- Also extern saccess at the beginning of sysent. ---
--- And this code should be placed at the end of sys2.c ---
/*
* access system call
*/
saccess()
{
extern uchar;
register svuid, svgid;
register *ip;
svuid = u.u_uid;
svgid = u.u_gid;
u.u_uid = u.u_ruid;
u.u_gid = u.u_rgid;
ip = namei(&uchar, 0);
if (ip != NULL) {
if (u.u_arg[1]&(IREAD>>6))
access(ip, IREAD);
if (u.u_arg[1]&(IWRITE>>6))
access(ip, IWRITE);
if (u.u_arg[1]&(IEXEC>>6))
access(ip, IEXEC);
iput(ip);
}
u.u_uid = svuid;
u.u_gid = svgid;
}
--- That should do it ---