Date: Mon, 25 Feb 2008 11:36:02 +0300 From: sam <samflanker@gmail.com> To: freebsd-emulation@freebsd.org Subject: info for discussion of syscall getdents() kern/117010 Message-ID: <47C27DF2.8060509@gmail.com>
next in thread | raw e-mail | index | archive | help
hi all links to similar problems: http://mail-index.netbsd.org/current-users/2005/11/13/0011.html > bug (+fix) in getdents + readdir > o We're not sure what the Linux kernel intended to place in this field, > but our experience shows that on "real" file systems (that actually > reside on some disk) the offset seems to be a simple (not necessarily > continuous) counter: e.g. first entry may have d_off=1, second: d_off=2, > third: d_off=4096, fourth=d_off=4097 etc. We conjecture this is the > serial of the dirent record within the directory (and so, this is indeed > the "offset", but counted in records out of which some were already > removed). > - In such an "overflow" situation, getdents() tries to lseek (the > directory-fd) to the end of the last-legal-dirent that getdents() > has successfully read. > This offset is supposedly held by the local variable `last_offset'. > But, since `last_offset' is assigned with `d_off' on each iteration, > and since as mentioned above `d_off' usually holds an incorrect value, > the lseek is not performed to the correct place. > getdents() then returns the number of bytes successfully read. http://sources.redhat.com/ml/libc-alpha/2004-02/msg00013.html /Vladimir Ermakov
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C27DF2.8060509>