Hello Bernhard, On Wed, Jan 22, 2020 at 11:55:33AM +0100, Bernhard Voelker wrote: > Hi Padraig, > > On 1/20/20 12:52 PM, Pádraig Brady wrote: > >I plan to do one in the next few weeks > > on openSUSE:Tumbleweed with glibc-2.30, I'm getting the following errors. > > CC lib/nproc.o > In file included from lib/nproc.c:50: > /usr/include/sys/sysctl.h:21:2: error: #warning "The <sys/sysctl.h> header > is deprecated and will be removed." [-Werror=cpp] > 21 | #warning "The <sys/sysctl.h> header is deprecated and will be > removed." > | ^~~~~~~ > cc1: all warnings being treated as errors > make[2]: *** [Makefile:10238: lib/nproc.o] Error 1 > CC lib/physmem.o > In file included from lib/physmem.c:54: > /usr/include/sys/sysctl.h:21:2: error: #warning "The <sys/sysctl.h> header > is deprecated and will be removed." [-Werror=cpp] > 21 | #warning "The <sys/sysctl.h> header is deprecated and will be > removed." > | ^~~~~~~ > cc1: all warnings being treated as errors > make[2]: *** [Makefile:10238: lib/physmem.o] Error 1 > CC src/uptime.o > In file included from src/uptime.c:26: > /usr/include/sys/sysctl.h:21:2: error: #warning "The <sys/sysctl.h> header > is deprecated and will be removed." [-Werror=cpp] > 21 | #warning "The <sys/sysctl.h> header is deprecated and will be > removed." > | ^~~~~~~ > cc1: all warnings being treated as errors > make[2]: *** [Makefile:10238: src/uptime.o] Error 1 > CC src/uname.o > In file included from src/uname.c:34: > /usr/include/sys/sysctl.h:21:2: error: #warning "The <sys/sysctl.h> header > is deprecated and will be removed." [-Werror=cpp] > 21 | #warning "The <sys/sysctl.h> header is deprecated and will be > removed." > | ^~~~~~~ > cc1: all warnings being treated as errors > make[2]: *** [Makefile:10238: src/uname.o] Error 1 > make[2]: Target 'all-am' not remade because of errors. > > I didn't have a deeper look about this issue yet, but at least on that system > it seems to work with those includes simply removed.
The sysctl function from sys/sysctl.h seems to be used. Usage may vary between operating systems, there is a comment pertaining to FreeBSD: ~/tmp/coreutils$ fgrep -r sysctl . ./src/uname.c:# include <sys/sysctl.h> ./src/uname.c: if (sysctl (mib, 2, processor, &s, 0, 0) >= 0) ./src/uname.c: if (sysctlbyname ("hw.cputype", &cputype, &cs, NULL, 0) == 0 ./src/uname.c: if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0) ./src/uptime.c:# include <sys/sysctl.h> ./src/uptime.c: /* FreeBSD specific: fetch sysctl "kern.boottime". */ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./src/uptime.c: if (sysctl (request, 2, &result, &result_len, NULL, 0) >= 0) ./tests/tail-2/inotify-rotate-resources.sh: # sudo sysctl -w fs.inotify.max_user_watches=$smallish_number ./m4/boottime.m4: AC_CHECK_FUNCS([sysctl]) ./m4/boottime.m4: AC_CHECK_HEADERS([sys/sysctl.h], [], [], ./m4/boottime.m4:# include <sys/sysctl.h> ./m4/jm-macros.m4: sysctl ./m4/jm-macros.m4: AC_CHECK_HEADERS([sys/sysctl.h], [], [], Thanks, Erik