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 | |
14 | static inline | |
15 | int lttng_dirfd(DIR *dir) { | |
16 | return dirfd(dir); | |
17 | } | |
18 | #else | |
19 | # ifndef __XOPEN_OR_POSIX | |
20 | static inline | |
21 | int lttng_dirfd(DIR *dir) { | |
22 | return dir->dd_fd; | |
23 | } | |
24 | # else | |
25 | static inline | |
26 | int lttng_dirfd(DIR *dir) { | |
27 | return dir->d_fd; | |
28 | } | |
29 | # endif | |
30 | #endif | |
31 | ||
32 | #endif /* _COMPAT_DIRENT_H */ |