How can I increase the MAX

I am writing a 'find' like utility to search some particular files in a freebsd based system. The stat() call in freeBSD 9 can accept paths with length 1024 chars, though linux supports upto 4K char paths.

The system itself has a filesystem other than freeBSD's (its a commercial OS) and that filesystem has a very high limit on MAX_PATH_LENGTH.

If some user mounted a volume on linux and created a directory hierarchy with path length greater than 1K, then though the filesystem will support it, the freeBSD lstat/stat calls will fail.

Is there a way around, or can I get this limit increased somehow?


You should be able to do this by upping the value for PATH_MAX in /usr/src/sys/sys/syslimits.h and doing a full rebuild of the entire system (kernel, libraries, and any installed software that uses PATH_MAX, MAXPATHLEN, or MAXINTERP). Just make sure to keep it under 64k.

If you do go this route, avoid using binary packages (like via pkg, portmaster, or portupgrade). Stick to compiling and installing out of /usr/ports, and you'll be fine.

链接地址: http://www.djcxy.com/p/56778.html

上一篇: 如何在POSIX sh中获取脚本目录?

下一篇: 我怎样才能增加MAX