X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttng-statedump-impl.c;h=656cebb26ba635fe141f0c7f0badde761be6b5a3;hb=aa29f2d33bae1396b7bd4766b7442ca780fa712e;hp=864637dd457fc1321c9ca09fe23764704e55eb22;hpb=fcf7fa335dc9b5119fccc23bb81fff546ce854ec;p=lttng-modules.git diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index 864637dd..656cebb2 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -214,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) { @@ -237,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;