4 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; only
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/version.h>
22 #include <linux/spinlock.h>
23 #include <wrapper/fdtable.h>
25 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
28 * Reimplementation of iterate_fd() for kernels between 2.6.32 and 3.6
31 int lttng_iterate_fd(struct files_struct
*files
,
33 int (*cb
)(const void *, struct file
*, unsigned int),
43 spin_lock(&files
->file_lock
);
44 fdt
= files_fdtable(files
);
45 for (i
= 0; i
< fdt
->max_fds
; i
++) {
46 filp
= fcheck_files(files
, i
);
49 res
= cb(ctx
, filp
, i
);
53 spin_unlock(&files
->file_lock
);
This page took 0.051704 seconds and 5 git commands to generate.