__vdso_gettimeofday.c (237434) | __vdso_gettimeofday.c (246117) |
---|---|
1/*- 2 * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org> 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org> 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/lib/libc/sys/__vdso_gettimeofday.c 237434 2012-06-22 07:13:30Z kib $"); | 27__FBSDID("$FreeBSD: head/lib/libc/sys/__vdso_gettimeofday.c 246117 2013-01-30 12:48:16Z kib $"); |
28 29#include <sys/elf.h> 30#include <sys/time.h> 31#include <sys/vdso.h> 32#include <errno.h> 33#include <time.h> 34#include <machine/atomic.h> 35#include "libc_private.h" --- 38 unchanged lines hidden (view full) --- 74 */ 75 rmb(); 76 } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen); 77 return (0); 78} 79 80static struct vdso_timekeep *tk; 81 | 28 29#include <sys/elf.h> 30#include <sys/time.h> 31#include <sys/vdso.h> 32#include <errno.h> 33#include <time.h> 34#include <machine/atomic.h> 35#include "libc_private.h" --- 38 unchanged lines hidden (view full) --- 74 */ 75 rmb(); 76 } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen); 77 return (0); 78} 79 80static struct vdso_timekeep *tk; 81 |
82#pragma weak __vdso_gettimeofday |
|
82int 83__vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 84{ 85 struct bintime bt; 86 int error; 87 88 if (tz != NULL) 89 return (ENOSYS); 90 if (tk == NULL) { | 83int 84__vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 85{ 86 struct bintime bt; 87 int error; 88 89 if (tz != NULL) 90 return (ENOSYS); 91 if (tk == NULL) { |
91 error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); | 92 error = __vdso_gettimekeep(&tk); |
92 if (error != 0 || tk == NULL) 93 return (ENOSYS); 94 } 95 if (tk->tk_ver != VDSO_TK_VER_CURR) 96 return (ENOSYS); 97 error = binuptime(&bt, tk, 1); 98 if (error != 0) 99 return (error); 100 bintime2timeval(&bt, tv); 101 return (0); 102} 103 | 93 if (error != 0 || tk == NULL) 94 return (ENOSYS); 95 } 96 if (tk->tk_ver != VDSO_TK_VER_CURR) 97 return (ENOSYS); 98 error = binuptime(&bt, tk, 1); 99 if (error != 0) 100 return (error); 101 bintime2timeval(&bt, tv); 102 return (0); 103} 104 |
105#pragma weak __vdso_clock_gettime |
|
104int 105__vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) 106{ 107 struct bintime bt; 108 int abs, error; 109 110 if (tk == NULL) { 111 error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); --- 31 unchanged lines hidden --- | 106int 107__vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) 108{ 109 struct bintime bt; 110 int abs, error; 111 112 if (tk == NULL) { 113 error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); --- 31 unchanged lines hidden --- |