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 1/4] Add <sys/hwcap.h> and associated __libc_hwcap function.


	* misc/hwcap.c: New file.
	* misc/sys/hwcap.h, misc/bits/hwcap.h: New files.
	* misc/Makefile (headers): Add sys/hwcap.h, bits/hwcap.h.
	* misc/Versions (GLIBC_2.16): Add __libc_hwcap.
---
 misc/Makefile     |    4 ++--
 misc/Versions     |    3 +++
 misc/bits/hwcap.h |   23 +++++++++++++++++++++++
 misc/hwcap.c      |   27 +++++++++++++++++++++++++++
 misc/sys/hwcap.h  |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 87 insertions(+), 2 deletions(-)
 create mode 100644 misc/bits/hwcap.h
 create mode 100644 misc/hwcap.c
 create mode 100644 misc/sys/hwcap.h

diff --git a/misc/Makefile b/misc/Makefile
index f42347a..5e52b4a 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/hwcap.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 hwcap
 
 generated := tst-error1.mtrace tst-error1-mem
 
diff --git a/misc/Versions b/misc/Versions
index 3a31c7f..39b1df2 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -146,4 +146,7 @@ libc {
   GLIBC_2.14 {
     syncfs;
   }
+  GLIBC_2.16 {
+    __libc_hwcap;
+  }
 }
diff --git a/misc/bits/hwcap.h b/misc/bits/hwcap.h
new file mode 100644
index 0000000..128d838
--- /dev/null
+++ b/misc/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_HWCAP_H
+# error "Never include <bits/hwcap.h> directly; use <sys/hwcap.h> instead."
+#endif
+
+/* Default version; no bits defined for this architecture.  */
diff --git a/misc/hwcap.c b/misc/hwcap.c
new file mode 100644
index 0000000..41231ff
--- /dev/null
+++ b/misc/hwcap.c
@@ -0,0 +1,27 @@
+/* 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/hwcap.h>
+#include <ldsodefs.h>
+
+
+/* Return the AT_HWCAP value.  */
+uint64_t
+__libc_hwcap (void)
+{
+  return GLRO(dl_hwcap);
+}
diff --git a/misc/sys/hwcap.h b/misc/sys/hwcap.h
new file mode 100644
index 0000000..29d4a06
--- /dev/null
+++ b/misc/sys/hwcap.h
@@ -0,0 +1,32 @@
+/* Access to 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_HWCAP_H
+#define _SYS_HWCAP_H 1
+
+#include <features.h>
+#include <stdint.h>
+#include <bits/hwcap.h>
+
+__BEGIN_DECLS
+
+extern uint64_t __libc_hwcap (void) __THROW;
+
+__END_DECLS
+
+#endif /* sys/hwcap.h */
-- 
1.7.7.6


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