Whamcloud - gitweb
e2fsck: drop use of sysctl(2)
authorTheodore Ts'o <tytso@mit.edu>
Fri, 29 Jan 2021 06:03:36 +0000 (01:03 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 29 Jan 2021 06:10:29 +0000 (01:10 -0500)
Remove the use of the binary interface using the sysctl(2) system call
since sys/sysctl.h has been deprecated.  We can find the total memory
available in the system using the POSIX standard sysconf(2) interface.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
configure
configure.ac
e2fsck/util.c

index ade0ee1..9d41d06 100755 (executable)
--- a/configure
+++ b/configure
@@ -10448,7 +10448,7 @@ fi
 done
 
 fi
-for ac_header in       dirent.h        errno.h         execinfo.h      getopt.h        malloc.h        mntent.h        paths.h         semaphore.h     setjmp.h        signal.h        stdarg.h        stdint.h        stdlib.h        termios.h       termio.h        unistd.h        utime.h         attr/xattr.h    linux/falloc.h  linux/fd.h      linux/fsmap.h   linux/major.h   linux/loop.h    linux/types.h   net/if_dl.h     netinet/in.h    sys/acl.h       sys/disklabel.h         sys/disk.h      sys/file.h      sys/ioctl.h     sys/key.h       sys/mkdev.h     sys/mman.h      sys/mount.h     sys/prctl.h     sys/resource.h  sys/select.h    sys/socket.h    sys/sockio.h    sys/stat.h      sys/syscall.h   sys/sysctl.h    sys/sysmacros.h         sys/time.h      sys/types.h     sys/un.h        sys/wait.h      sys/xattr.h
+for ac_header in       dirent.h        errno.h         execinfo.h      getopt.h        malloc.h        mntent.h        paths.h         semaphore.h     setjmp.h        signal.h        stdarg.h        stdint.h        stdlib.h        termios.h       termio.h        unistd.h        utime.h         attr/xattr.h    linux/falloc.h  linux/fd.h      linux/fsmap.h   linux/major.h   linux/loop.h    linux/types.h   net/if_dl.h     netinet/in.h    sys/acl.h       sys/disklabel.h         sys/disk.h      sys/file.h      sys/ioctl.h     sys/key.h       sys/mkdev.h     sys/mman.h      sys/mount.h     sys/prctl.h     sys/resource.h  sys/select.h    sys/socket.h    sys/sockio.h    sys/stat.h      sys/syscall.h   sys/sysmacros.h         sys/time.h      sys/types.h     sys/un.h        sys/wait.h      sys/xattr.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
index 3e93c30..141c4d9 100644 (file)
@@ -1010,7 +1010,6 @@ AC_CHECK_HEADERS(m4_flatten([
        sys/sockio.h
        sys/stat.h
        sys/syscall.h
-       sys/sysctl.h
        sys/sysmacros.h
        sys/time.h
        sys/types.h
index e0623e4..0a7cafe 100644 (file)
 #include <errno.h>
 #endif
 
-#ifdef HAVE_SYS_SYSCTL_H
-#include <sys/sysctl.h>
-#endif
-
 #include "e2fsck.h"
 
 extern e2fsck_t e2fsck_global_ctx;   /* Try your very best not to use this! */
@@ -886,12 +882,6 @@ unsigned long long get_memory_size(void)
 # elif defined(CTL_HW_UINT)
        unsigned int size = 0;
 # endif
-# if defined(CTL_HW_INT64) || defined(CTL_HW_UINT)
-       size_t len = sizeof(size);
-
-       if (sysctl(mib, 2, &size, &len, NULL, 0) == 0)
-               return (unsigned long long)size;
-# endif
        return 0;
 #else
 # warning "Don't know how to detect memory on your platform?"