site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Hi all, Answering relative to Tiger... {SYMLOOP_MAX} Maximum number of symbolic links that can be reliably traversed in the resolution of a pathname in the absence of a loop. Minimum Acceptable Value: {_POSIX_SYMLOOP_MAX} {_POSIX_SYMLOOP_MAX} The number of symbolic links that can be traversed in the resolution of a pathname in the absence of a loop. Value: 8 long symloop_max; symloop_max = sysconf(_SC_SYMLOOP_MAX); Hope that helps. -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On Jun 4, 2005, at 12:35 AM, Andre Pang wrote: I have a need for changing the value of MAXSYMLINKS in sys/param.h (the maximum depth for traversing symbolic links) from 32 to something higher. POSIX & limits.h apparently defines the maximum level of symbolic links to be 255. So, I have a couple of questions about this: * Is there any harm done in simply editing sys/param.h from 32 to something higher such as 64, 128 or 256? * Given that this maximum-symlink-depth value appears to be a constant defined in an included kernel-related header file, is there anyway to increase this symlink limit to something higher in already-compiled programs? (Perhaps even via a kernel extension.) * If there is no way to increase the symlink limit for already- compiled programs, would it be possible to raise the limit to 64/128/256 in future versions of Darwin and Mac OS X? Making this a sysctl would be even nicer ... (Sorry if this post is to the wrong list; I thought darwin-kernel was probably the best choice. Please feel free to move to the post to another list if you feel it's more appropriate.) Thanks! Actually, POSIX states that the minimum acceptable value is 8, and doesn't place a cap on the maximum value: http://www.opengroup.org/onlinepubs/009695399/basedefs/ limits.h.html The MacOS X default value for this is 32, which is 4 times the POSIX minimum. As long as you recompile both the Libc/LibSystem and the kernel, you should be able to change MAXSYMLINKS. In general, MAXSYMLINKS exists to ensure that you don't spend too much time (e.g. "forever" is too much time) going around in a symbolic link loop. Expansion of link targets teds to be in place, unless there are relative paths involved, in which case, you are also limited by the value of MAXPATHLEN -- don't expect to be able to change MAXPATHLEN safely: you are stuck at 1024. So if you are using relative links and hitting your head on MAXPATHLEN, changing the value of MAXSYMLINKS isn't going to help you any. As Justin noted, there can also be compiled code that would use MAXSYMLINKS directly. Any code that does this is non-POSIX code; the correct way for a POSIX compliant program to obtain this value is: This value is obtained out of Libc, rather than from the kernel, which is why you will need to recompile Libc as well as the kernel, so that this value matches the kernel value. In general, the kernel interface is at the top of Libc/LibSystem. Practically, there is not that much you can do with the value in user space, except make decisions not to create link trees deeper than the allowed value, so for most applications, just changing the kernel value will be enough. If you have an already compiled program that depends on the value for MAXSYMLINKS, rather than using the sysconf() interface as it should, then that program is out of luck (sorry). Future programs that need this value should use sysconf() to obtain it instead, so that you can make the change you want to make here, and they will continue to function correctly. This email sent to site_archiver@lists.apple.com