diff mbox

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

Message ID 1461163181-24069-1-git-send-email-sndirsch@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Dirsch April 20, 2016, 2:39 p.m. UTC
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@suse.de>
---
 include/drm/drm.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Daniel Vetter April 20, 2016, 2:47 p.m. UTC | #1
On Wed, Apr 20, 2016 at 4:39 PM, Stefan Dirsch <sndirsch@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@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Stefan Dirsch April 20, 2016, 3:25 p.m. UTC | #2
On Wed, Apr 20, 2016 at 04:47:20PM +0200, Daniel Vetter wrote:
> On Wed, Apr 20, 2016 at 4:39 PM, Stefan Dirsch <sndirsch@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@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

Indeed I figured out the patch is no longer needed and finally removed it. ;-)

Thanks,
Stefan

Public Key available
------------------------------------------------------
Stefan Dirsch (Res. & Dev.)   SUSE LINUX GmbH
Tel: 0911-740 53 0            Maxfeldstraße 5
FAX: 0911-740 53 479          D-90409 Nürnberg
http://www.suse.de            Germany 
---------------------------------------------------------------
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham
Norton, HRB 21284 (AG Nürnberg)
---------------------------------------------------------------
Emil Velikov April 21, 2016, 12:37 p.m. UTC | #3
On 20 April 2016 at 16:25, Stefan Dirsch <sndirsch@suse.de> wrote:
> On Wed, Apr 20, 2016 at 04:47:20PM +0200, Daniel Vetter wrote:
>> On Wed, Apr 20, 2016 at 4:39 PM, Stefan Dirsch <sndirsch@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@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
>
> Indeed I figured out the patch is no longer needed and finally removed it. ;-)
>
No problem Stefan and thanks for starting to get the Suse patches upstreamed.

A few friendly suggestions - please correctly the patch author (if not
yourself) and don't add their s-o-b unless they have done/agreed so.

Thanks,
Emil

P.S. [Note to self~ish~] Perhaps it's time we unconditionally use
O_CLOEXEC in mesa...
Stefan Dirsch April 21, 2016, 1:51 p.m. UTC | #4
On Thu, Apr 21, 2016 at 01:37:22PM +0100, Emil Velikov wrote:
> On 20 April 2016 at 16:25, Stefan Dirsch <sndirsch@suse.de> wrote:
> > On Wed, Apr 20, 2016 at 04:47:20PM +0200, Daniel Vetter wrote:
> >> On Wed, Apr 20, 2016 at 4:39 PM, Stefan Dirsch <sndirsch@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@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
> >
> > Indeed I figured out the patch is no longer needed and finally removed it. ;-)
> >
> No problem Stefan and thanks for starting to get the Suse patches upstreamed.

You're welcome. I'm trying my best. ;-)

> A few friendly suggestions - please correctly the patch author (if not
> yourself) and don't add their s-o-b unless they have done/agreed so.

Fixed and resent. ;-)

Thanks,
Stefan

Public Key available
------------------------------------------------------
Stefan Dirsch (Res. & Dev.)   SUSE LINUX GmbH
Tel: 0911-740 53 0            Maxfeldstraße 5
FAX: 0911-740 53 479          D-90409 Nürnberg
http://www.suse.de            Germany 
---------------------------------------------------------------
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham
Norton, HRB 21284 (AG Nürnberg)
---------------------------------------------------------------
diff mbox

Patch

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;