GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
VOP_ACCESS(9) FreeBSD Kernel Developer's Manual VOP_ACCESS(9)

̾??

VOP_ACCESS?ե??????ޤ??? UNIX ?ɥᥤ?󥽥??åȤΥ??????????Ĥ?Ĵ??

<sys/param.h> <sys/vnode.h> int (struct vnode *vp, int mode, struct ucred *cred, struct thread *td)

???Υ????ȥ??ݥ????Ȥϡ?Ϳ?????줿???????Ф??롢?ե??????? ???????????Ĥ?Ĵ?????ޤ???

?????ϰʲ????̤??Ǥ???

vp
Ĵ???оݥե??????? vnode??
mode
?׵ᤵ?줿?????????Υ????ס?
cred
Ĵ???оݤΥ桼????????
td
Ĵ?????Ƥ??륹???åɡ?

mode ?? VREAD, VWRITE ?ޤ??? VEXEC ???ޤ??ޥ????Ǥ???

vnode ?ϡ????????˥??å????졢???????ˤ????å?????³???ޤ???

?ե????뤬???ꤵ?줿??ˡ?ǥ?????????ǽ?ʾ????ˤϡ?0 ???֤????ޤ??? ?????Ǥʤ??????ˤϡ?Ŭ?ڤʥ??顼?????ɤ??֤????ޤ???

int
vop_access(struct vnode *vp, int mode, struct ucred *cred, struct thread *td)
{
    int error;

    /*
     * ?ե????뤬?????åȡ?FIFO???ޤ??ϥե????륷???ƥ???¸?ߤ???
     * ?֥??å????ޤ???ʸ?????ǥХ????Ǥʤ??????ˤϡ??ɤ߹???????
     * ?ե????륷???ƥ??ؤν񤭹??ߤ?ǧ???????ޤ?????
     */
    if (mode & VWRITE) {
	switch (vp->v_type) {
	case VDIR:
	case VLNK:
	case VREG:
	    if (vp->v_mount->mnt_flag & MNT_RDONLY)
		return EROFS;

	    break;
	}
    }

    /* ???ѥӥåȤ????ꤵ???Ƥ????С?ï???񤭹????ޤ????? */
    if ((mode & VWRITE) && vp has immutable bit set)
	return EPERM;

    /* ?????Ǥʤ????С?uid ?? 0 ?ʤ??о??˵??ġ? */
    if (cred->cr_uid == 0)
	return 0;

    mask = 0;

    /* ?????Ǥʤ????С???ͭ?Ԥ?Ĵ?٤ޤ??? */
    if (cred->cr_uid == owner of vp) {
	if (mode & VEXEC)
	    mask |= S_IXUSR;
	if (mode & VREAD)
	    mask |= S_IRUSR;
	if (mode & VWRITE)
	    mask |= S_IWUSR;
	return (((mode of vp) & mask) == mask ? 0 : EACCES);
    }

    /* ?????Ǥʤ????С????롼?פ?Ĵ?٤ޤ??? */
    for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++)
	if (group of vp == *gp) {
	    if (mode & VEXEC)
		mask |= S_IXGRP;
	    if (mode & VREAD)
		mask |= S_IRGRP;
	    if (mode & VWRITE)
		mask |= S_IWGRP;
	    return (((mode of vp) & mask) == mask ? 0 : EACCES);
	}

    /* ?????Ǥʤ????С?????¾??Ĵ?٤ޤ??? */
    if (mode & VEXEC)
	mask |= S_IXOTH;
    if (mode & VREAD)
	mask |= S_IROTH;
    if (mode & VWRITE)
	mask |= S_IWOTH;
    return (((mode of vp) & mask) == mask ? 0 : EACCES);
}

[EPERM]
???ѥե????????ѹ????褦?Ȥ??ޤ?????
[EACCES]
?ѡ??ߥå??????ӥåȤΥե??????⡼?ɤޤ??? ACL ???׵ᤵ?줿?????????? ???Ĥ??ޤ????Ǥ?????

vaccess(9), vaccess_acl_posix1e(9), vnode(9)

???Υޥ˥奢???ڡ????? Doug Rabson ???񤭤ޤ?????

July 24, 1996 FreeBSD 14.3-RELEASE

Search for    or go to Top of page |  Section 9 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.