Date: Fri, 1 Dec 1995 23:29:53 +1100 From: Bruce Evans <bde@zeta.org.au> To: julian@ref.tfs.com, terry@lambert.org Cc: hackers@FreeBSD.org Subject: Re: seekdir broken.. Message-ID: <199512011229.XAA16391@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>Terry, look at what you just quoted.... >> >> Man page says: >> ========================================================================== >>... >> pointer, dirp, from which they are derived. If the directory is closed >> and then reopened, the telldir() value may be invalidated due to unde- >> tected directory compaction. It is safe to use a previous telldir() val- > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> ue immediately after a call to opendir() and before any calls to > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> readdir(). > ^^^^^^^^^ >> ========================================================================== >This is exactly what is failing..... Do you have cvs access? :-) The log for telldir says: revision 1.2 date: 1995/01/27 13:51:18; author: dfr; state: Exp; lines: +29 -0 Reclaim memory used for telldir cookies on closedir. I.e., extra work is done to break the underlined documentation. >> It is bogus to open and close the directory and expect the token to >> live past the life of the open. >In some ways I agree, exept that it is known to work on all other >systems and it seems to be commonly done It wastes a lot of memory. Consider a recursive traversal of "/". The original code allocates a telldir cookie for each telldir() call and frees it only for the corresponding seekdir() call. After closedir() there is unlikely to be a matching seekdir() call (unless the application is depending on the cookies living across closedir() and/or knows about the undocumented (#ifdef SINGLEUSE) way of freeing the cookies). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512011229.XAA16391>