Commit | Line | Data |
---|---|---|
108e5a1e | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
108e5a1e | 3 | * |
0235b0db | 4 | * Copyright (C) 2016 Michael Jeanson <mjeanson@efficios.com> |
108e5a1e MJ |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef _BABELTRACE_COMPAT_UNISTD_H |
8 | #define _BABELTRACE_COMPAT_UNISTD_H | |
108e5a1e MJ |
9 | |
10 | #include <unistd.h> | |
11 | ||
12 | #ifdef __MINGW32__ | |
13 | #include <windows.h> | |
14 | #include <errno.h> | |
15 | ||
16 | #define _SC_PAGESIZE 30 | |
17 | ||
18 | static inline | |
19 | long bt_sysconf(int name) | |
20 | { | |
21 | SYSTEM_INFO si; | |
22 | ||
23 | switch(name) { | |
24 | case _SC_PAGESIZE: | |
25 | GetNativeSystemInfo(&si); | |
26 | return si.dwPageSize; | |
27 | default: | |
28 | errno = EINVAL; | |
29 | return -1; | |
30 | } | |
31 | } | |
32 | ||
33 | #else | |
34 | ||
35 | static inline | |
36 | long bt_sysconf(int name) | |
37 | { | |
38 | return sysconf(name); | |
39 | } | |
40 | ||
41 | #endif | |
42 | #endif /* _BABELTRACE_COMPAT_UNISTD_H */ |