e517e4bc9e8e926c236ea92c0efb564ac3f6deb9
[babeltrace.git] / src / compat / unistd.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2016 Michael Jeanson <mjeanson@efficios.com>
5 */
6
7 #ifndef _BABELTRACE_COMPAT_UNISTD_H
8 #define _BABELTRACE_COMPAT_UNISTD_H
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 */
This page took 0.029186 seconds and 4 git commands to generate.