[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATC 7/9] Skipping drm build, unsupported
From: |
Peter Maydell |
Subject: |
Re: [PATC 7/9] Skipping drm build, unsupported |
Date: |
Wed, 1 Jul 2020 17:53:35 +0100 |
On Wed, 1 Jul 2020 at 16:15, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> > > Ah, that is the problem. Yes, DT_CHR is an non-posix optimization which
> > > allows to get the file type directly, without another round-trip to the
> > > kernel. If that isn't available you can stat() the file and check
> > > ((st_mode & S_IFMT) == S_IFCHR) instead.
> >
> > Even when d_type and DT_CHR is available, there are filesystems where the
> > Linux kernel reports d_type of DT_UNKNOWN, and where you are best having
> > that code also falling back to an fstat().
>
> Given this isn't perforance critical at all it is probably simplest to
> avoid non-portable d_type altogether and just to the fstat
> unconditionally.
> @@ -53,6 +50,12 @@ int qemu_drm_rendernode_open(const char *rendernode)
> g_free(p);
> continue;
> }
> + fstat(r, &st);
Don't forget to check the fstat return code in the final
version of this patch :-)
thanks
-- PMM