]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Hide internal sysinfo functions [BZ #18822]
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 1 Oct 2017 22:57:00 +0000 (15:57 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 1 Oct 2017 22:57:21 +0000 (15:57 -0700)
Hide internal sysinfo functions to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/sys/sysinfo.h (__get_nprocs_conf): Add
libc_hidden_proto.
(__get_nprocs): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.
(__get_child_max): Add attribute_hidden.
* misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def.
(__get_nprocs): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.
* sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add
libc_hidden_def.
(__get_nprocs): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.
* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add
libc_hidden_def.
(__get_nprocs_conf): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.

ChangeLog
include/sys/sysinfo.h
misc/getsysstats.c
sysdeps/mach/getsysstats.c
sysdeps/unix/sysv/linux/getsysstats.c

index 8117cc1b6aaa5d9ce9494e7ef46af6c689c2c67f..4851dc7c128b359c7526dfa77075394bd5c3d30a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #18822]
+       * include/sys/sysinfo.h (__get_nprocs_conf): Add
+       libc_hidden_proto.
+       (__get_nprocs): Likewise.
+       (__get_phys_pages): Likewise.
+       (__get_avphys_pages): Likewise.
+       (__get_child_max): Add attribute_hidden.
+       * misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def.
+       (__get_nprocs): Likewise.
+       (__get_phys_pages): Likewise.
+       (__get_avphys_pages): Likewise.
+       * sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add
+       libc_hidden_def.
+       (__get_nprocs): Likewise.
+       (__get_phys_pages): Likewise.
+       (__get_avphys_pages): Likewise.
+       * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add
+       libc_hidden_def.
+       (__get_nprocs_conf): Likewise.
+       (__get_phys_pages): Likewise.
+       (__get_avphys_pages): Likewise.
+
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        [BZ #18822]
index c33eae28835ffc4659e89a0e87dc336154ddaff9..7388356a192693352bb0c0302edd37f7b20b6aa4 100644 (file)
@@ -7,18 +7,22 @@
 
 /* Return number of configured processors.  */
 extern int __get_nprocs_conf (void);
+libc_hidden_proto (__get_nprocs_conf)
 
 /* Return number of available processors.  */
 extern int __get_nprocs (void);
+libc_hidden_proto (__get_nprocs)
 
 /* Return number of physical pages of memory in the system.  */
 extern long int __get_phys_pages (void);
+libc_hidden_proto (__get_phys_pages)
 
 /* Return number of available physical pages of memory in the system.  */
 extern long int __get_avphys_pages (void);
+libc_hidden_proto (__get_avphys_pages)
 
 /* Return maximum number of processes this real user ID can have.  */
-extern long int __get_child_max (void);
+extern long int __get_child_max (void) attribute_hidden;
 
 # endif /* !_ISOMAC */
 #endif /* sys/sysinfo.h */
index d25770ec5274de6b62f8acc36d1ce39e59b27fc3..cbad87a3a229dad68d4a4a131e063b7f7b4c96d8 100644 (file)
@@ -26,6 +26,7 @@ __get_nprocs_conf (void)
   /* We don't know how to determine the number.  Simply return always 1.  */
   return 1;
 }
+libc_hidden_def (__get_nprocs_conf)
 weak_alias (__get_nprocs_conf, get_nprocs_conf)
 
 link_warning (get_nprocs_conf, "warning: get_nprocs_conf will always return 1")
@@ -38,6 +39,7 @@ __get_nprocs (void)
   /* We don't know how to determine the number.  Simply return always 1.  */
   return 1;
 }
+libc_hidden_def (__get_nprocs)
 weak_alias (__get_nprocs, get_nprocs)
 
 link_warning (get_nprocs, "warning: get_nprocs will always return 1")
@@ -50,6 +52,7 @@ __get_phys_pages (void)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__get_phys_pages)
 weak_alias (__get_phys_pages, get_phys_pages)
 
 stub_warning (get_phys_pages)
@@ -62,6 +65,7 @@ __get_avphys_pages (void)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__get_avphys_pages)
 weak_alias (__get_avphys_pages, get_avphys_pages)
 
 stub_warning (get_avphys_pages)
index 0dacab03007c5248db4f7491a0406df28cf8a81c..3aabd61382b7607dbf993af67edce06614cab380 100644 (file)
@@ -39,6 +39,7 @@ __get_nprocs_conf (void)
 
   return hbi.max_cpus;
 }
+libc_hidden_def (__get_nprocs_conf)
 weak_alias (__get_nprocs_conf, get_nprocs_conf)
 
 /* Return the number of processors currently available on the system. */
@@ -58,6 +59,7 @@ __get_nprocs (void)
 
   return hbi.avail_cpus;
 }
+libc_hidden_def (__get_nprocs)
 weak_alias (__get_nprocs, get_nprocs)
 
 /* Return the number of physical pages on the system. */
@@ -77,6 +79,7 @@ __get_phys_pages (void)
 
   return hbi.memory_size / __vm_page_size;
 }
+libc_hidden_def (__get_phys_pages)
 weak_alias (__get_phys_pages, get_phys_pages)
 
 /* Return the number of available physical pages */
@@ -102,4 +105,5 @@ __get_avphys_pages (void)
 
   return vs.free_count;
 }
+libc_hidden_def (__get_avphys_pages)
 weak_alias (__get_avphys_pages, get_avphys_pages)
index d02c86d7397abfb71427289d6f6c2baafded02bf..c245b3c66294f7e737b4196b6a4e00d66b64c9b7 100644 (file)
@@ -226,6 +226,7 @@ __get_nprocs (void)
 
   return result;
 }
+libc_hidden_def (__get_nprocs)
 weak_alias (__get_nprocs, get_nprocs)
 
 
@@ -279,6 +280,7 @@ __get_nprocs_conf (void)
 
   return result;
 }
+libc_hidden_def (__get_nprocs_conf)
 weak_alias (__get_nprocs_conf, get_nprocs_conf)
 
 
@@ -320,6 +322,7 @@ __get_phys_pages (void)
   __sysinfo (&info);
   return sysinfo_mempages (info.totalram, info.mem_unit);
 }
+libc_hidden_def (__get_phys_pages)
 weak_alias (__get_phys_pages, get_phys_pages)
 
 long int
@@ -330,4 +333,5 @@ __get_avphys_pages (void)
   __sysinfo (&info);
   return sysinfo_mempages (info.freeram, info.mem_unit);
 }
+libc_hidden_def (__get_avphys_pages)
 weak_alias (__get_avphys_pages, get_avphys_pages)