Displaying 1 result from an estimated 1 matches for "__sysconf_inline".
2013 May 13
0
[klibc:sysconf] Framework and trivial implementation of sysconf(3)
...ine function
+ * and put it in a .c file in the sysconf directory.
+ */
+
+#ifndef _SYS_SYSCONF_H
+#define _SYS_SYSCONF_H
+
+#ifndef _UNISTD_H
+# include <unistd.h>
+#endif
+#include <errno.h>
+
+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 */
diff --git a/usr/include/unistd.h b/usr/include/uni...