Hi Vladimir, > > hash.c in order to properly detect ELOOP, which must be done as part > > of an unlimited-depth link following algorithm. (If we didn't have > > the GNU mantra of no arbitrary limits, then we could declare ELOOP at > > SYMLOOP_MAX instead.) > > > Brent's algorithm is universal, sets no arbitrary limit and requires no > hash and is implemented in few lines at a slight cost of going through > the cycle potentially up to 2 (or was it 3?) times. > http://en.wikipedia.org/wiki/Cycle_detection#Brent.27s_algorithm
Interesting idea. But in file system related code like here, we consider a system call to be very expensive (as it implies a context switch to the kernel and back). Whereas adding one entry to a hash table is rather quick on average. Therefore we try to minimize the number of system calls, even if it causes an increase in temporary memory use. Bruno