From patchwork Mon Apr 20 16:48:11 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: 47367 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5080720553 for ; Mon, 20 Apr 2015 16:48:57 +0000 (UTC) Received: by wiun10 with SMTP id n10sf19488420wiu.1 for ; Mon, 20 Apr 2015 09:48:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-subscribe:list-archive:list-post:list-help :sender:delivered-to:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding:x-original-sender :x-original-authentication-results; bh=UH9uwHZPbV3f9CK8FsUfptQgWB87IkQL7uWpD6XpQcU=; b=CW23y9kbS2TbA4ydst3iwZB4kWCZ680qo2q9bHIpZqF3QIwqkdeeQToYVOsZm/kfuQ K7ghmwW1CZCsY+jtXhe8p3aOjwxkapfe8F2G4a9YaZNBeA1SGxVQJ6uE95S+MXm9/gNi dWoRfnOUwBy9Jpl0X/qPzA9ERWTL5Kmu1bm8JdBKbmQ2E4yXKKFlkFsCNv2L9yLX+c2C Qo9ERqlxyIN6Gbw5/Ts3i44EsCg0NRAYR208KLIv1sSQp67iP4eiWTZ5WMf2KDVS2m9p MFcC2GaWTz+RLnPvxPUrrbShSTlyIh8nn2yzYyCnzrBFIxjv94mLLRyr+cSdIZ/n9biD Nesg== X-Gm-Message-State: ALoCoQkxr5rHunIP7TnOc0JH3VL3/Z4fIpm2PHVtvrUsfchZRDW3DfutAK3wQCbfIwuKDB14HtTL X-Received: by 10.180.73.137 with SMTP id l9mr6366120wiv.5.1429548536644; Mon, 20 Apr 2015 09:48:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.97 with SMTP id 1ls183536lat.57.gmail; Mon, 20 Apr 2015 09:48:56 -0700 (PDT) X-Received: by 10.112.126.162 with SMTP id mz2mr16098899lbb.97.1429548536481; Mon, 20 Apr 2015 09:48:56 -0700 (PDT) Received: from mail-lb0-x234.google.com (mail-lb0-x234.google.com. [2a00:1450:4010:c04::234]) by mx.google.com with ESMTPS id we5si15401085lbb.30.2015.04.20.09.48.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 09:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::234 as permitted sender) client-ip=2a00:1450:4010:c04::234; Received: by lbbzk7 with SMTP id zk7so135442528lbb.0 for ; Mon, 20 Apr 2015 09:48:56 -0700 (PDT) X-Received: by 10.152.23.70 with SMTP id k6mr16044308laf.76.1429548536386; Mon, 20 Apr 2015 09:48:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp132019lbt; Mon, 20 Apr 2015 09:48:55 -0700 (PDT) X-Received: by 10.68.137.7 with SMTP id qe7mr29890789pbb.40.1429548534171; Mon, 20 Apr 2015 09:48:54 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id cu5si28945248pbc.126.2015.04.20.09.48.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 09:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-58508-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 7837 invoked by alias); 20 Apr 2015 16:48:20 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 7720 invoked by uid 89); 20 Apr 2015 16:48:19 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f178.google.com X-Received: by 10.140.196.141 with SMTP id r135mr18591367qha.60.1429548494150; Mon, 20 Apr 2015 09:48:14 -0700 (PDT) Message-ID: <55352DCB.4020807@linaro.org> Date: Mon, 20 Apr 2015 13:48:11 -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 v2 2/3] Consolidate gettimeofday across aarch64/s390/tile X-Original-Sender: adhemerval.zanella@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::234 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 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. --- * 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_VSYSCAL]: Define. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h [HAVE_GETTIMEOFDAY_VSYSCAL]: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h [HAVE_GETTIMEOFDAY_VSYSCAL]: Likewise. * sysdeps/unix/sysv/linux/tile/sysdep.h [HAVE_GETTIMEOFDAY_VSYSCAL]: 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 6808651..7b1c0a3 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 be76452..31c3b05 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 019e800..0866fc7 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__ */