Sync writeback tracepoints from mainline
[lttng-modules.git] / lttng-statedump-impl.c
index e4caa488e436f0e317bcd72f89a2da79cc128c52..656cebb26ba635fe141f0c7f0badde761be6b5a3 100644 (file)
@@ -65,6 +65,7 @@
 #define CREATE_TRACE_POINTS
 #define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module
 #define TRACE_INCLUDE_FILE lttng-statedump
+#define LTTNG_INSTRUMENTATION
 #include "instrumentation/events/lttng-module/lttng-statedump.h"
 
 DEFINE_TRACE(lttng_statedump_block_device);
@@ -213,6 +214,18 @@ int lttng_enumerate_network_ip_interface(struct lttng_session *session)
 }
 #endif /* CONFIG_INET */
 
+#ifdef FD_ISSET        /* For old kernels lacking close_on_exec() */
+static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
+{
+       return FD_ISSET(fd, fdt->close_on_exec);
+}
+#else
+static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
+{
+       return close_on_exec(fd, fdt);
+}
+#endif
+
 static
 int lttng_dump_one_fd(const void *p, struct file *file, unsigned int fd)
 {
@@ -236,7 +249,7 @@ int lttng_dump_one_fd(const void *p, struct file *file, unsigned int fd)
         * the lock is taken, but we are not aware whether this is
         * guaranteed or not, so play safe.
         */
-       if (fd < fdt->max_fds && test_bit(fd, fdt->close_on_exec))
+       if (fd < fdt->max_fds && lttng_close_on_exec(fd, fdt))
                flags |= O_CLOEXEC;
        if (IS_ERR(s)) {
                struct dentry *dentry = file->f_path.dentry;
This page took 0.024308 seconds and 4 git commands to generate.