Commit | Line | Data |
---|---|---|
5a2451c9 MJ |
1 | /* |
2 | * Copyright (C) 2015 Michael Jeanson <mjeanson@efficios.com> | |
3 | * | |
ab5be9fa | 4 | * SPDX-License-Identifier: MIT |
5a2451c9 | 5 | * |
5a2451c9 MJ |
6 | */ |
7 | ||
8 | #ifndef _COMPAT_DIRENT_H | |
9 | #define _COMPAT_DIRENT_H | |
10 | ||
11 | #include <dirent.h> | |
12 | ||
13 | #ifdef HAVE_DIRFD | |
28f23191 JG |
14 | static inline int lttng_dirfd(DIR *dir) |
15 | { | |
5a2451c9 MJ |
16 | return dirfd(dir); |
17 | } | |
18 | #else | |
28f23191 JG |
19 | #ifndef __XOPEN_OR_POSIX |
20 | static inline int lttng_dirfd(DIR *dir) | |
21 | { | |
5a2451c9 MJ |
22 | return dir->dd_fd; |
23 | } | |
28f23191 JG |
24 | #else |
25 | static inline int lttng_dirfd(DIR *dir) | |
26 | { | |
5a2451c9 MJ |
27 | return dir->d_fd; |
28 | } | |
28f23191 | 29 | #endif |
5a2451c9 MJ |
30 | #endif |
31 | ||
32 | #endif /* _COMPAT_DIRENT_H */ |