From: Sascha Wildner Date: Sun, 25 Oct 2015 21:47:18 +0000 (+0100) Subject: libc/sysconf: Simplify sysconf(_SC_XOPEN_SHM) a bit. X-Git-Tag: v4.5.0~294 X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/2f6482abea88bce07df7c4a5491a44a06ed5e3c7 libc/sysconf: Simplify sysconf(_SC_XOPEN_SHM) a bit. We never had sysv_shm as a module like FreeBSD, only as a kernel option (SYSVSHM), which was made a no-op when we started to compile it into our kernels by default over a year ago (see 10ceb70237a5). The sysctl check in the sysconf(3) code was only there to check if it was compiled into the kernel or (in FreeBSD's case) if it was loaded as a module, when it was still optional. So the worst thing that could happen after this commit is a wrong return value for sysconf(_SC_XOPEN_SHM) if someone was running a kernel without "options SYSVSHM" from earlier than July 29, 2014 in combination with a current world. This all looks quite unlikely, so remove the check. Also, return the right variable from . --- diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index 91126460a3..230cdaf74b 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -588,15 +588,7 @@ yesno: return (_XOPEN_REALTIME_THREADS); #endif case _SC_XOPEN_SHM: - len = sizeof(lvalue); - sverrno = errno; - if (sysctlbyname("kern.ipc.shmmin", &lvalue, &len, NULL, - 0) == -1) { - errno = sverrno; - return (-1); - } - errno = sverrno; - return (1); + return (_XOPEN_SHM); case _SC_XOPEN_STREAMS: return (_XOPEN_STREAMS); case _SC_XOPEN_UNIX: