[Mesa-stable] [Mesa-dev] [PATCH] loader: include <sys/stat.h> for non-sysfs builds
Emil Velikov
emil.l.velikov at gmail.com
Wed Mar 11 15:39:20 PDT 2015
On 11 March 2015 at 22:18, Ian Romanick <idr at freedesktop.org> wrote:
> On 03/11/2015 02:44 PM, Emil Velikov wrote:
>> On 11 March 2015 at 20:50, Ian Romanick <idr at freedesktop.org> wrote:
>>> On 03/11/2015 12:12 PM, Emil Velikov wrote:
>>>> Required by fstat(), otherwise we'll error out due to implicit function
>>>> declaration.
>>>
>>> Alternate suggestion... include unistd.h unconditionally. I see that's
>>> already in the #ifdef HAVE_LIBUDEV path. Does that work too?
>>>
>> Perhaps the commit message is a bit confusing, but your suggestion
>> does not parse here. How does the following sound ?
>>
>> When building with libudev (non-sysfs) we don't include sys/stat.h
>> thus we error out due to the implicit declaration of the function
>> fstat().
>
> What I meant was:
>
> diff --git a/src/loader/loader.c b/src/loader/loader.c
> index 9ff5115..4709b02 100644
> --- a/src/loader/loader.c
> +++ b/src/loader/loader.c
> @@ -67,11 +67,11 @@
> #include <stdarg.h>
> #include <stdio.h>
> #include <string.h>
> +#include <unistd.h>
> #ifdef HAVE_LIBUDEV
> #include <assert.h>
> #include <dlfcn.h>
> #include <fcntl.h>
> -#include <unistd.h>
> #include <stdlib.h>
> #include <errno.h>
> #ifdef USE_DRICONF
> @@ -80,7 +80,6 @@
> #endif
> #endif
> #ifdef HAVE_SYSFS
> -#include <sys/stat.h>
> #include <sys/types.h>
> #endif
> #include "loader.h"
>
> The fstat man page led me to believe that fstat also comes from
> unistd.h, but
$ man 3 fstat does not list unistd.h. Which made we think there is
some confusion.
Checking with the Linux manual (man 2 fstat) I do see your point.
> In any case, just ignore all my noise.
>
Wouldn't call it noise, by any means.
-Emil
More information about the mesa-stable
mailing list