opendir()/closedir()
Igor Sysoev
is at rambler-co.ru
Fri Sep 5 19:00:45 UTC 2008
Looking at opendir()/readdir()/closedir() sequence via ktrace,
I've seen supposedly useless lseek() syscall just before close().
It's called from closedir():
_seekdir(dirp, dirp->dd_rewind); /* free seekdir storage */
It seems that free()ing libc seekdir storage should be done without
calling lseek().
Other strange place for me is stat() before open() in opendir()
/*
* stat() before _open() because opening of special files may be
* harmful. _fstat() after open because the file may have changed.
*/
What is the case when opening special file may be harmful ?
--
Igor Sysoev
http://sysoev.ru/en/
More information about the freebsd-hackers
mailing list