From patchwork Mon May 11 19:11:52 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: 471006 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2350B140187 for ; Tue, 12 May 2015 05:12:06 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=uHzXQHAs; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=P0B YeN52+3E29lSvng4v7WP+CQjDL0/7GjgSXoJRNN4QRhqQ6O5hCpcpKs74v58H3Qe 7Bpkkvo2hIfvodgESQ5on5H7xGCrNIeFdq8j7PrOanWaqebCD+AAPkIh/3kibF2K f7LCLsMrWdIkZ6APiQ0Z6x2n4dvEv2WB8iyOXnqo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=iKHhL3ytv ilz/foPnPY/0rKYb94=; b=uHzXQHAsMcBVhkiBHa1n5mlsoFvWYnFdVGtyWxBOF F158MTSrfarGdSMFzW11cVNdI8ojUnK+rc/zjNEWempQMZL4X2G/Oz9SQKnFLc+t mC6eo6Bl4VE9Hskm0khn8jIWdwfCjmPjWExvjqBfmAK7edFe/GdEJCRCzP/a5XmO 5k= Received: (qmail 37579 invoked by alias); 11 May 2015 19:12:00 -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 37563 invoked by uid 89); 11 May 2015 19:11:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f178.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=V2fqk5ngD8rWGYnrJIyAOhDHa87c/qrVfWJSmd5ImPg=; b=Ifsz3UAFs5fQQsoHAXkf7DTDnUCGM0pD8A51Q97ow+taj1sDphTJjAaxDRsuNflTUX UGPJy8tnCooy0UOCe+UtW5iPjdfAd48u66Ohpx2Z+A1UVfOypMUcwRxhed1o7v925iPk PlUKEzRhp4hLt8lnatfmPJhb/WRBsr8kFgLAwNe9Bm6GFW4JUvcjLtX4cm7KSfx+IdVQ IB2SJDOrE62ddVUWpJFfrBGRp+ocViB9iXh3JwN30WViRpfW6WN1HSDBCiH3nIF1MYiv NjHwntOofg+Y/KwDLbD/8VSPuiWpdwAU0S0eWpg8pZF5StDP7L/VPNBXKFH/bHjzLMA9 YVkg== X-Gm-Message-State: ALoCoQmVNdoQKUpQvXH39XmID1hvQQIf/G/oZYHsGWwA8mB3HV4Ovyzwky93lEk+xOhM7I8LwJfu X-Received: by 10.140.145.78 with SMTP id 75mr16005047qhr.61.1431371515365; Mon, 11 May 2015 12:11:55 -0700 (PDT) Message-ID: <5550FEF8.50501@linaro.org> Date: Mon, 11 May 2015 16:11:52 -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: GNU C Library Subject: [PATCH v3 2/3] Consolidate gettimeofday across aarch64/s390/tile This patch removes the architecture specific gettimeofday implementation to use the vDSO symbol and consolidate it on a common Linux one. Similat to gettime and getres vDSO implementation, each arch that supports gettimeofday through vDSO should just implement INLINE_VSYSCALL to access the symbol and define HAVE_GETTIMEOFDAY_VSYSCAL as 1. Tested on i386, x32, x86_64, ppc64le and aarch64. Ok to apply? Changes from previous version: - Fix SYSCALL spelling. --- * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: Remove file. * sysdeps/unix/sysv/linux/s390/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/tile/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h [HAVE_GETTIMEOFDAY_VSYSCALL]: Define. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h [HAVE_GETTIMEOFDAY_VSYSCALL]: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h [HAVE_GETTIMEOFDAY_VSYSCALL]: Likewise. * sysdeps/unix/sysv/linux/tile/sysdep.h [HAVE_GETTIMEOFDAY_VSYSCALL]: Likewise. * sysdeps/unix/sysv/linux/gettimeofday.c: New file: gettimeofday using vDSO syscall macro. --- diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c deleted file mode 100644 index daa6538..0000000 --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2005-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 -#include - -#undef __gettimeofday - -#define HAVE_VSYSCALL -#include - -/* Get the current time of day and timezone information, - putting it into *tv and *tz. If tz is null, *tz is not filled. - Returns 0 on success, -1 on errors. */ -int -__gettimeofday (tv, tz) - struct timeval *tv; - struct timezone *tz; -{ - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); -} -libc_hidden_def (__gettimeofday) -weak_alias (__gettimeofday, gettimeofday) -libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 80716c7..0a0a278 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -155,6 +155,7 @@ /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETRES_VSYSCALL 1 # define HAVE_CLOCK_GETTIME_VSYSCALL 1 +# define HAVE_GETTIMEOFDAY_VSYSCALL 1 # define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \ ({ \ diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c new file mode 100644 index 0000000..d88c39f --- /dev/null +++ b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -0,0 +1,39 @@ +/* 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 +#include + +#undef __gettimeofday + +#ifdef HAVE_GETTIMEOFDAY_VSYSCALL +# define HAVE_VSYSCALL +#endif +#include + +/* Get the current time of day and timezone information, + putting it into *tv and *tz. If tz is null, *tz is not filled. + Returns 0 on success, -1 on errors. */ +int +__gettimeofday (struct timeval *tv, struct timezone *tz) +{ + return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); +} +libc_hidden_def (__gettimeofday) +weak_alias (__gettimeofday, gettimeofday) +libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/s390/gettimeofday.c b/sysdeps/unix/sysv/linux/s390/gettimeofday.c deleted file mode 100644 index 9f98f29..0000000 --- a/sysdeps/unix/sysv/linux/s390/gettimeofday.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 2008-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 -#include -#include -#include -#include - -#define HAVE_VSYSCALL -#include - -/* Get the current time of day and timezone information, - putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. - Returns 0 on success, -1 on errors. */ - -int -__gettimeofday (tv, tz) - struct timeval *tv; - struct timezone *tz; -{ - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); -} -libc_hidden_def (__gettimeofday) -weak_alias (__gettimeofday, gettimeofday) -libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index a773a28..c768df1 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -281,6 +281,7 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETRES_VSYSCALL 1 #define HAVE_CLOCK_GETTIME_VSYSCALL 1 +#define HAVE_GETTIMEOFDAY_VSYSCALL 1 /* This version is for internal uses when there is no desire to set errno */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index c944634..c041153 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -287,6 +287,7 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETRES_VSYSCALL 1 #define HAVE_CLOCK_GETTIME_VSYSCALL 1 +#define HAVE_GETTIMEOFDAY_VSYSCALL 1 /* This version is for internal uses when there is no desire to set errno */ diff --git a/sysdeps/unix/sysv/linux/tile/gettimeofday.c b/sysdeps/unix/sysv/linux/tile/gettimeofday.c deleted file mode 100644 index 13382ab..0000000 --- a/sysdeps/unix/sysv/linux/tile/gettimeofday.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2012-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 -#include -#include -#include - -#define HAVE_VSYSCALL -#include - -int -__gettimeofday (struct timeval *tv, struct timezone *tz) -{ - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); -} - -libc_hidden_def (__gettimeofday) -weak_alias (__gettimeofday, gettimeofday) -libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h index 30d52e3..1f4122c 100644 --- a/sysdeps/unix/sysv/linux/tile/sysdep.h +++ b/sysdeps/unix/sysv/linux/tile/sysdep.h @@ -212,6 +212,7 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL 1 +#define HAVE_GETTIMEOFDAY_VSYSCALL 1 #endif /* __ASSEMBLER__ */