From patchwork Mon Apr 20 16:48:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 6330 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com Received: (qmail 7278 invoked by alias); 20 Apr 2015 16:48:14 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 7193 invoked by uid 89); 20 Apr 2015 16:48:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f169.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=clRCjz9PG4t+ANMGxqpt/KCEcpVmtD3hZNFRZn5+k/k=; b=hOsLa2/7QCJYCXZNmbYCjAzy585E2qThyN2gWitR7PSV7Kf2FfU3QPthTaZKQ3j6QN HOW+a4/UQOUqo3Y/Xd3SrTCdajyBV9LHNxelImfJQhMDuYth2NoN0RYhelwfppWFbHjo tCnHa6Vva09Y5SvRHJumpVjvWrNUWm/UKyvtVqwD49aSgeL12g76COYpo+fdPhna+lbd YITTFdwybWEtL0y+HYBYoBEleW2vhzHPLSMAB5ix1gpXUX5xOxChVRxG0Pq+rwiS52OR hTeSTlKaiVMjm64TXbOgypQbjoeU8ejEMu04OeIxtPXHYgS9QBzIns5Bms2h4Uv5w+RN AKkQ== X-Gm-Message-State: ALoCoQngdBh31J6qetVACCsldxIATXvACw60TIQGF+Sdguj2On99DU7MI5/uMwAWxqBAnZh/jhEx X-Received: by 10.55.18.139 with SMTP id 11mr30066850qks.5.1429548486610; Mon, 20 Apr 2015 09:48:06 -0700 (PDT) Message-ID: <55352DC3.40900@linaro.org> Date: Mon, 20 Apr 2015 13:48:03 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: libc-alpha@sourceware.org Subject: [PATCH 3/3] x86: clock_gettime and timespec_get vDSO cleanup This patch removes the x86 specific timespec_get and clock_gettime implementation to use generic HAVE_CLOCK_GETTIME_VSYSCALL way.] --- * sysdeps/unix/sysv/linux/i386/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL): Define. (HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL): Likewise. (HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/timespec_get.c: Include errno.h. * sysdeps/unix/sysv/linux/x86/clock_gettime.c: Remove file. * sysdeps/unix/sysv/linux/x86/timespec_get.c: Likewise. --- diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 7f6fcf3..d76aca5 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -328,6 +328,10 @@ struct libc_do_syscall_args } \ (int) resultvar; }) +/* List of system calls which are supported as vsyscalls. */ +# define HAVE_CLOCK_GETTIME_VSYSCALL 1 +# define HAVE_GETTIMEOFDAY_VSYSCALL 1 + /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. This returns just what the kernel diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c index 0e5f513..b42a44f 100644 --- a/sysdeps/unix/sysv/linux/timespec_get.c +++ b/sysdeps/unix/sysv/linux/timespec_get.c @@ -17,6 +17,7 @@ #include #include +#include #ifdef HAVE_CLOCK_GETTIME_VSYSCALL # define HAVE_VSYSCALL diff --git a/sysdeps/unix/sysv/linux/x86/clock_gettime.c b/sysdeps/unix/sysv/linux/x86/clock_gettime.c deleted file mode 100644 index 98ffb01..0000000 --- a/sysdeps/unix/sysv/linux/x86/clock_gettime.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Get the current value of a clock. Linux/x86 version. - Copyright (C) 2015 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 - . */ - -#include - -#ifdef SHARED -# define SYSCALL_GETTIME(id, tp) \ - ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \ - long int v_ret; \ - PTR_DEMANGLE (f); \ - v_ret = (*f) (id, tp); \ - if (INTERNAL_SYSCALL_ERROR_P (v_ret, )) { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (v_ret, )); \ - v_ret = -1; \ - } \ - v_ret; }) -#endif - -#include diff --git a/sysdeps/unix/sysv/linux/x86/timespec_get.c b/sysdeps/unix/sysv/linux/x86/timespec_get.c deleted file mode 100644 index b21efce..0000000 --- a/sysdeps/unix/sysv/linux/x86/timespec_get.c +++ /dev/null @@ -1,29 +0,0 @@ -/* timespec_get -- returns the calendar time based on a given time base. - Linux/x86 version. - Copyright (C) 2015 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 - . */ - -#include - -#ifdef SHARED -# define INTERNAL_GETTIME(id, tp) \ - ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \ - PTR_DEMANGLE (f); \ - (*f) (id, tp); }) -#endif - -#include diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index cc66093..bea3192 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -252,6 +252,10 @@ # undef INTERNAL_SYSCALL_ERRNO # define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +/* List of system calls which are supported as vsyscalls. */ +# define HAVE_CLOCK_GETTIME_VSYSCALL 1 +# define HAVE_GETTIMEOFDAY_VSYSCALL 1 + # define LOAD_ARGS_0() # define LOAD_REGS_0 # define ASM_ARGS_0