Defining PATH_MAX for a filesystem?

前端 未结 6 1583
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 02:09

I\'m presently writing a filesystem. The statvfs (and even the statfs) structs contain a field specifying the maximum length of a name in that path. As PATH_M

6条回答
  •  滥情空心
    2021-02-04 02:39

    I do not enough about other OSes but imho this is a system-wide setting in at least FreeBSD 5.2.1

    PATH_MAX is found in #62 sys/syslimits.h


    Because static int ufs_pathconf() which returns the PATHCONF information for UFS FS, uses this variable in the manner you specified.

    /*
     * Return POSIX pathconf information applicable to ufs filesystems.
     */
    int
    ufs_pathconf(ap)
        struct vop_pathconf_args /* {
            struct vnode *a_vp;
            int a_name;
            int *a_retval;
        } */ *ap;
    {
    
        switch (ap->a_name) {
        .
        .
        .
        .
        case _PC_PATH_MAX:
            *ap->a_retval = PATH_MAX;
            return (0);
        .
        .
        .
        .
    
        default:
            return (EINVAL);
        }
        /* NOTREACHED */
    }
    

提交回复
热议问题