[PATCH] drm: Fix compilation on systems that don't provide O_CLOEXEC

Daniel Vetter daniel at ffwll.ch
Wed Apr 20 14:47:20 UTC 2016


On Wed, Apr 20, 2016 at 4:39 PM, Stefan Dirsch <sndirsch at suse.de> wrote:
> Patch suggestion by Thomas Klausner. See also
> http://mail-index.netbsd.org/pkgsrc-changes/2012/08/13/msg076887.html
>
> Signed-off-by: Stefan Dirsch <sndirsch at suse.de>

Fix your OS to have O_CLOEXEC semantics I think is what should happen
here. It's an obvious race in multi-threaded apps, and you need a fix
for it anyway.
-Daniel

> ---
>  include/drm/drm.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/drm/drm.h b/include/drm/drm.h
> index b4ebaa9..739df01 100644
> --- a/include/drm/drm.h
> +++ b/include/drm/drm.h
> @@ -674,7 +674,11 @@ struct drm_set_client_cap {
>  };
>
>  #define DRM_RDWR O_RDWR
> +#ifdef O_CLOEXEC
>  #define DRM_CLOEXEC O_CLOEXEC
> +#else
> +#define DRM_CLOEXEC 0
> +#endif
>  struct drm_prime_handle {
>         __u32 handle;
>
> --
> 2.6.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list