From 2f0649f6fe411d7e07c8d56cf8ea56db53536da8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 19:06:04 +0200 Subject: Adding upstream version 2.0.13. Signed-off-by: Daniel Baumann --- usr/include/sys/sysconf.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 usr/include/sys/sysconf.h (limited to 'usr/include/sys/sysconf.h') diff --git a/usr/include/sys/sysconf.h b/usr/include/sys/sysconf.h new file mode 100644 index 0000000..13ababc --- /dev/null +++ b/usr/include/sys/sysconf.h @@ -0,0 +1,40 @@ +/* + * sys/sysconf.h + * + * sysconf() macros and demultiplex + * This file is included in + * + * Add things here as needed, we don't really want to add things wildly. + * For things that require a lot of code, create an out-of-line function + * and put it in a .c file in the sysconf directory. + */ + +#ifndef _SYS_SYSCONF_H +#define _SYS_SYSCONF_H + +#ifndef _UNISTD_H +# include +#endif +#include + +enum sysconf { + _SC_PAGESIZE = 1, +}; + +__extern long sysconf(int); + +__must_inline long __sysconf_inline(int __val) +{ + switch (__val) { + case _SC_PAGESIZE: + return getpagesize(); + default: + errno = EINVAL; + return -1; + } +} + +#define sysconf(x) \ + (__builtin_constant_p(x) ? __sysconf_inline(x) : sysconf(x)) + +#endif /* _SYS_SYSCONF_H */ -- cgit v1.2.3