Skip to contentSkip to conversation

perf tools: Move conditional O_CLOEXEC to util.h

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jan 24, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  5c61d70e55ab1cb917752f4a0d5f4683b4869e32
Gitweb:     https://git.kernel.org/tip/5c61d70e55ab1cb917752f4a0d5f4683b4869e32
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 22 Jan 2018 17:11:30 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 23 Jan 2018 09:48:20 -0300

perf tools: Move conditional O_CLOEXEC to util.h

To be more generally available and get the build on centos:5 to work after we use O_CLOEXEC in the next patch, in the util/dso.c file.

---
 tools/perf/util/data.c | 10 ----------
 tools/perf/util/util.h | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)
tools/perf/util/data.c +0 -10
index 48094fd..d8cfc19 100644
@@ -12,16 +12,6 @@
 #include "util.h"
 #include "debug.h"
 
-#ifndef O_CLOEXEC
-#ifdef __sparc__
-#define O_CLOEXEC	0x400000
-#elif defined(__alpha__) || defined(__hppa__)
-#define O_CLOEXEC	010000000
-#else
-#define O_CLOEXEC	02000000
-#endif
-#endif
-
 static bool check_pipe(struct perf_data *data)
 {
 	struct stat st;
tools/perf/util/util.h +10 -0
index 0143450..9496365 100644
@@ -68,4 +68,14 @@ extern bool perf_singlethreaded;
 void perf_set_singlethreaded(void);
 void perf_set_multithreaded(void);
 
+#ifndef O_CLOEXEC
+#ifdef __sparc__
+#define O_CLOEXEC      0x400000
+#elif defined(__alpha__) || defined(__hppa__)
+#define O_CLOEXEC      010000000
+#else
+#define O_CLOEXEC      02000000
+#endif
+#endif
+
 #endif /* GIT_COMPAT_UTIL_H */