#include "wrapper/ringbuffer/backend.h"
#include "wrapper/ringbuffer/frontend.h"
#include "wrapper/poll.h"
+#include "wrapper/file.h"
#include "lttng-abi.h"
#include "lttng-abi-old.h"
#include "lttng-events.h"
session = lttng_session_create();
if (!session)
return -ENOMEM;
- session_fd = get_unused_fd();
+ session_fd = lttng_get_unused_fd();
if (session_fd < 0) {
ret = session_fd;
goto fd_error;
struct file *tracepoint_list_file;
int file_fd, ret;
- file_fd = get_unused_fd();
+ file_fd = lttng_get_unused_fd();
if (file_fd < 0) {
ret = file_fd;
goto fd_error;
int chan_fd;
int ret = 0;
- chan_fd = get_unused_fd();
+ chan_fd = lttng_get_unused_fd();
if (chan_fd < 0) {
ret = chan_fd;
goto fd_error;
int stream_fd, ret;
struct file *stream_file;
- stream_fd = get_unused_fd();
+ stream_fd = lttng_get_unused_fd();
if (stream_fd < 0) {
ret = stream_fd;
goto fd_error;
}
switch (event_param->instrumentation) {
default:
- event_fd = get_unused_fd();
+ event_fd = lttng_get_unused_fd();
if (event_fd < 0) {
ret = event_fd;
goto fd_error;
#include "lib/bitfield.h"
#include "wrapper/tracepoint.h"
+#include "wrapper/file.h"
#include "lttng-events.h"
#ifndef CONFIG_COMPAT
struct file *syscall_list_file;
int file_fd, ret;
- file_fd = get_unused_fd();
+ file_fd = lttng_get_unused_fd();
if (file_fd < 0) {
ret = file_fd;
goto fd_error;
--- /dev/null
+#ifndef _LTTNG_WRAPPER_FILE_H
+#define _LTTNG_WRAPPER_FILE_H
+
+/*
+ * wrapper/file.h
+ *
+ * wrapper around linux/file.h.
+ *
+ * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <linux/version.h>
+#include <linux/file.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
+
+static
+inline int lttng_get_unused_fd(void)
+{
+ return get_unused_fd_flags(0);
+}
+
+#else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) */
+
+static
+inline int lttng_get_unused_fd(void)
+{
+ return get_unused_fd();
+}
+
+#endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) */
+
+#endif /* _LTTNG_WRAPPER_FILE_H */