about summary refs log tree commit diff
path: root/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-10-26 09:21:08 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-10-29 13:47:57 -0400
commitd11260f86a64a634f5a3ad9939f6e8ce30442460 (patch)
tree531d8bb95411444ab37294516688ccced5dccbb9 /ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c
parent19f1dd5f2dbf794cd6b040093bf2b1ba114b3c15 (diff)
downloadglibc-d11260f86a64a634f5a3ad9939f6e8ce30442460.tar.gz
glibc-d11260f86a64a634f5a3ad9939f6e8ce30442460.tar.xz
glibc-d11260f86a64a634f5a3ad9939f6e8ce30442460.zip
tile: add vDSO support for gettimeofday()
Diffstat (limited to 'ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c')
-rw-r--r--ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c b/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c
new file mode 100644
index 0000000000..e2bcc45018
--- /dev/null
+++ b/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c
@@ -0,0 +1,38 @@
+/* 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 <sysdep.h>
+#include <stddef.h>
+#include <sys/time.h>
+#include <time.h>
+
+#undef __gettimeofday
+#include <bits/libc-vdso.h>
+
+int
+__gettimeofday (struct timeval *tv, struct timezone *tz)
+{
+#ifdef SHARED
+  /* If the vDSO is available we use it. */
+  if (__vdso_gettimeofday != NULL)
+    return __vdso_gettimeofday (tv, tz);
+#endif
+  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
+}
+
+strong_alias (__gettimeofday, __gettimeofday_internal)
+weak_alias (__gettimeofday, gettimeofday)