This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2 1/6] Add <sys/auxv.h> and gethwcap function.


	* misc/gethwcap.c: New file.
	* misc/sys/auxv.h, misc/bits/hwcap.h: New files.
	* misc/Makefile (headers): Add sys/auxv.h, bits/hwcap.h.
	(routines): Add gethwcap.
	* misc/Versions (GLIBC_2.16): Add __gethwcap, gethwcap.
---
 misc/Makefile                |    4 ++--
 misc/Versions                |    3 +++
 misc/gethwcap.c              |   28 ++++++++++++++++++++++++++++
 misc/sys/auxv.h              |   31 +++++++++++++++++++++++++++++++
 sysdeps/generic/bits/hwcap.h |   23 +++++++++++++++++++++++
 5 files changed, 87 insertions(+), 2 deletions(-)
 create mode 100644 misc/gethwcap.c
 create mode 100644 misc/sys/auxv.h
 create mode 100644 sysdeps/generic/bits/hwcap.h

diff --git a/misc/Makefile b/misc/Makefile
index f42347a..49c7ff3 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -31,7 +31,7 @@ headers	:= sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
 	   regexp.h bits/select.h bits/mman.h sys/xattr.h \
 	   syslog.h sys/syslog.h \
 	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \
-	   bits/select2.h
+	   bits/select2.h bits/hwcap.h sys/auxv.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev preadv preadv64 pwritev pwritev64 \
@@ -64,7 +64,7 @@ routines := brk sbrk sstk ioctl \
 	    getloadavg getclktck \
 	    fgetxattr flistxattr fremovexattr fsetxattr getxattr \
 	    listxattr lgetxattr llistxattr lremovexattr lsetxattr \
-	    removexattr setxattr
+	    removexattr setxattr gethwcap
 
 generated := tst-error1.mtrace tst-error1-mem
 
diff --git a/misc/Versions b/misc/Versions
index 3a31c7f..de6c27e 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -146,4 +146,7 @@ libc {
   GLIBC_2.14 {
     syncfs;
   }
+  GLIBC_2.16 {
+    __gethwcap; gethwcap;
+  }
 }
diff --git a/misc/gethwcap.c b/misc/gethwcap.c
new file mode 100644
index 0000000..79baa58
--- /dev/null
+++ b/misc/gethwcap.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/auxv.h>
+#include <ldsodefs.h>
+
+
+uint64_t
+__gethwcap (void)
+{
+  return GLRO(dl_hwcap);
+}
+
+weak_alias (__gethwcap, gethwcap)
diff --git a/misc/sys/auxv.h b/misc/sys/auxv.h
new file mode 100644
index 0000000..19ef499
--- /dev/null
+++ b/misc/sys/auxv.h
@@ -0,0 +1,31 @@
+/* Access to the auxiliary vector.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H 1
+
+#include <elf.h>
+#include <bits/hwcap.h>
+
+__BEGIN_DECLS
+
+extern uint64_t gethwcap (void) __THROW;
+
+__END_DECLS
+
+#endif /* sys/auxv.h */
diff --git a/sysdeps/generic/bits/hwcap.h b/sysdeps/generic/bits/hwcap.h
new file mode 100644
index 0000000..b27d2fe
--- /dev/null
+++ b/sysdeps/generic/bits/hwcap.h
@@ -0,0 +1,23 @@
+/* Defines for bits in AT_HWCAP.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_AUXV_H
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+/* No bits defined for this architecture.  */
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]