[Mesa-dev] [PATCH:mesa] util: Make xmlconfig.c build on Solaris without d_type in dirent
Roland Mainz
roland.mainz at nrubsig.org
Thu Oct 4 05:57:36 UTC 2018
On Thu, Oct 4, 2018 at 5:21 AM Alan Coopersmith
<alan.coopersmith at oracle.com> wrote:
> On 10/ 3/18 03:15 PM, Roland Mainz wrote:
> > On Wed, Oct 3, 2018 at 11:51 PM Alan Coopersmith
> > <alan.coopersmith at oracle.com> wrote:
> >> Introduced-by: commit 04bdbbcab3c4862bf3f54ce60fcc1d2007776f80
> >> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> >> ---
> >> src/util/xmlconfig.c | 8 ++++++++
> >> 1 file changed, 8 insertions(+)
> >>
> >> diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
> >> index 5264f2598b..608972f812 100644
> >> --- a/src/util/xmlconfig.c
> >> +++ b/src/util/xmlconfig.c
> >> @@ -938,8 +938,16 @@ parseOneConfigFile(struct OptConfData *data, const char *filename)
> >> static int
> >> scandir_filter(const struct dirent *ent)
> >> {
> >> +#ifndef DT_REG /* systems without d_type in dirent results */
> >> + struct stat st;
> >> +
> >> + lstat(ent->d_name, &st);
> >> + if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode))
> >> + return 0;
> >> +#else
> >
> > What about testing for the return code of |lstat()|&&|errno| before
> > looking at the value of |st| ?
>
> Oh, I suppose there is a small window in which the file could disappear after
> it's read from the directory entry, but before the lstat occurs.
The term "small" is not right here, for example:
1. The machine could be slow, overloaded, paging/swapping and/or
virtualised, which can cause many-second gaps in process/thread
execution
2. HSM (=Hierarchical Storage Management) may need some time
(=minutes) to fetch data from tape
3. You may not have the permission to |stat()| the specific file or
directory, thanks to the wonders of ACLs and/or alien filesystems like
smbfs
4. There are things like SIGSTOP, debuggers, suspend-to-@(disk|memory)
etc. which can "delay" execution for days or weeks
> Attached version checks for that.
That version looks OK for me, r=roland.mainz at nrubsig.org
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
More information about the mesa-dev
mailing list