Skip to contentSkip to conversation

tools/libxendevicemodel: define O_CLOEXEC

PATCH In review Olaf Hering 2 participants 2 messages Mar 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxendevicemodel: define O_CLOEXEC

Similar defines are already used elsewhere.
Fixes e7745d8ef5 ("tools/libxendevicemodel: introduce a Linux-specific implementation")

---
 tools/libs/devicemodel/linux.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/libs/devicemodel/linux.c +4 -0
index 438c55bf2c..0fdc7121f1 100644
@@ -31,6 +31,10 @@
 
 #include "private.h"
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 int osdep_xendevicemodel_open(xendevicemodel_handle *dmod)
 {
     int fd = open("/dev/xen/privcmd", O_RDWR | O_CLOEXEC);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Olaf Hering

Similar defines are already used elsewhere.

I think I would like to change this a bit to be more explicit:

Some libc headers don't have O_CLOEXEC, we need to take care of it by defining to 0 (on the ground that such glibc might barf on O_CLOEXEC).

If you don't object, I will use the above paragraph.

Quoted 4 lines

Fixes e7745d8ef5 ("tools/libxendevicemodel: introduce a Linux-specific implementation")

Quoted 9 lines
---
 tools/libs/devicemodel/linux.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/libs/devicemodel/linux.c +0 -0
index 438c55bf2c..0fdc7121f1 100644

tools/libs/devicemodel/linux.c line 40

Quoted 10 lines
tools/libs/devicemodel/linux.c +4 -0
@@ -31,6 +31,10 @@
 
 #include "private.h"
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 int osdep_xendevicemodel_open(xendevicemodel_handle *dmod)
 {
     int fd = open("/dev/xen/privcmd", O_RDWR | O_CLOEXEC);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel