On Sun, Feb 12, 2006 at 04:54:23PM -0800, Linda Walsh wrote:Sometimes, there are better ways than implementing your
Al Viro wrote:
On Sun, Feb 12, 2006 at 02:54:33PM -0800, Linda Walsh wrote:---
Al Viro wrote:Sigh... 12 works at the limit on your particular config, filesystems
Care to RTFS? I mean, really - at least to the point of seeing what'sHmmm...that's where I got the original parameter numbers, but
involved in that recursion.
I see it's not so straightforward. I tried a limit of
40, but I quickly get an OS hang when trying to reference a
13th link. Twelve works at the limit, but would take more testing
to find out the bottleneck.
being used and syscall being issued (hint: amount of stuff on stack
before we enter mutual recursion varies; so does the amount of stuff
on stack we get from function that are not part of mutual recursion,
but are called from the damn thing).
Yeah, I sorta figured that. Is there any easier way to
remove the recursion? I dunno about you, but I was always taught
that recursion, while elegant, was not always the most efficient in
terms of time and space requirements and one could get similar
functionality using iteration and a stack.
I don't know exactly why recursion is used to follow symlinks,
which at first thought seems like it could be iterated, but
I've not checked the code, there certainly are specific reasons
for this. However, there's often an alternative to recursion, it
consists in implementing a local stack onto the stack. I mean,
when you need recursion, it is because you want to be able toYes, but what if we don't need the ability to go back?
get back to where you were previously (eg: try another branch
in a tree).