Drop support for kernels < 4.4 from 'wrapper/fdtable.h'
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 18 Nov 2022 21:26:21 +0000 (16:26 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 23 Nov 2022 20:02:48 +0000 (15:02 -0500)
Change-Id: Ib398db572d18c9ad3d08a5f21fe9285261fae0d1
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/wrapper/fdtable.h
src/Kbuild
src/lttng-statedump-impl.c
src/wrapper/fdtable.c [deleted file]

index e07dfebc91c5dd6e64624363a2bd791769c70c97..fa5f720775577a11c6693903d29840d3dc2efc53 100644 (file)
@@ -26,38 +26,4 @@ struct file *lttng_lookup_fd_rcu(unsigned int fd)
 }
 #endif
 
-#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,7,0))
-
-int lttng_iterate_fd(struct files_struct *files,
-               unsigned int first,
-               int (*cb)(const void *, struct file *, unsigned int),
-               const void *ctx);
-
-#else
-
-/*
- * iterate_fd() appeared at commit
- * c3c073f808b22dfae15ef8412b6f7b998644139a in the Linux kernel (first
- * released kernel: v3.7).
- */
-#define lttng_iterate_fd       iterate_fd
-
-#endif
-
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0))
-
-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
-{
-       return close_on_exec(fd, fdt);
-}
-
-#else
-
-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
-{
-       return FD_ISSET(fd, fdt->close_on_exec);
-}
-
-#endif
-
 #endif /* _LTTNG_WRAPPER_FDTABLE_H */
index 440b61d906a20dfc8404154d56d84b1430a85825..ede6b847e299edc6578c6d8372e7b84c7aa8e62b 100644 (file)
@@ -84,7 +84,6 @@ lttng-wrapper-objs := wrapper/page_alloc.o \
                       wrapper/trace-clock.o \
                       wrapper/kallsyms.o \
                       wrapper/irqdesc.o \
-                      wrapper/fdtable.o \
                       lttng-wrapper-impl.o
 
 ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),)
index 65efc54b2741e7dc6f2e9230e7a0760edc2929aa..9d708af9f751b59286292ff6a7edfa17735e7a08 100644 (file)
@@ -428,7 +428,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 && lttng_close_on_exec(fd, fdt))
+       if (fd < fdt->max_fds && close_on_exec(fd, fdt))
                flags |= O_CLOEXEC;
        if (IS_ERR(s)) {
                struct dentry *dentry = file->f_path.dentry;
@@ -455,7 +455,7 @@ void lttng_enumerate_files(struct lttng_kernel_session *session,
 {
        struct lttng_fd_ctx ctx = { .page = tmp, .session = session, .files = files, };
 
-       lttng_iterate_fd(files, 0, lttng_dump_one_fd, &ctx);
+       iterate_fd(files, 0, lttng_dump_one_fd, &ctx);
 }
 
 #ifdef LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
diff --git a/src/wrapper/fdtable.c b/src/wrapper/fdtable.c
deleted file mode 100644 (file)
index 3aa6e7b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- * wrapper/fdtable.c
- *
- * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#include <lttng/kernel-version.h>
-#include <linux/spinlock.h>
-#include <wrapper/fdtable.h>
-
-#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,7,0))
-
-/*
- * Reimplementation of iterate_fd() for kernels between 2.6.32 and 3.6
- * (inclusive).
- */
-int lttng_iterate_fd(struct files_struct *files,
-               unsigned int first,
-               int (*cb)(const void *, struct file *, unsigned int),
-               const void *ctx)
-{
-       struct fdtable *fdt;
-       struct file *filp;
-       unsigned int i;
-       int res = 0;
-
-       if (!files)
-               return 0;
-       spin_lock(&files->file_lock);
-       fdt = files_fdtable(files);
-       for (i = 0; i < fdt->max_fds; i++) {
-               filp = fcheck_files(files, i);
-               if (!filp)
-                       continue;
-               res = cb(ctx, filp, i);
-               if (res)
-                       break;
-       }
-       spin_unlock(&files->file_lock);
-       return res;
-}
-
-#endif
This page took 0.028548 seconds and 4 git commands to generate.