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: 48312 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8AB2D2121F for ; Mon, 11 May 2015 19:12:15 +0000 (UTC) Received: by wgiv13 with SMTP id v13sf41493639wgi.3 for ; Mon, 11 May 2015 12:12:14 -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=V2fqk5ngD8rWGYnrJIyAOhDHa87c/qrVfWJSmd5ImPg=; b=UCuCB1TJEWKbxpF0uCjOHRrAebPUzSSRF7gU9qqMPLUZO5a0Md9CYQu7k6WB4PCRs5 ZCC32T1ShHgG8p0JfrtlicRMqhBZXe13TQuOnyYECsMfAjtj0T9BB1P8NYWXu8Lz8aqV rns0HLE7FI15Sj/qWzp2NVYkWwdr1qkn/oE6wUC5KtwK8w/OJICOqLzY0ZTU56DtULlA WqZrOF8urozrdT+jlSVPEVzdcx8KhYsO0ySiOXlUH5DGCaAH+DDVg6cYahu9SP0/Ri38 QhLalFicuMvduo3tkBGR01Ib+ll7gMc5DiIrHR3kmuuP1/gQ5uEaRTbJe0IAgd2KEwty oh2g== X-Gm-Message-State: ALoCoQm7xSlmcLM5qhW63gcV8wXQf3o2L9j1rIaGaNp67WeY+3S1AIMmbe6vCPkaB/T/jvew0nXV X-Received: by 10.112.118.162 with SMTP id kn2mr8280198lbb.22.1431371534822; Mon, 11 May 2015 12:12:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.163.200 with SMTP id yk8ls635601lab.95.gmail; Mon, 11 May 2015 12:12:14 -0700 (PDT) X-Received: by 10.152.43.110 with SMTP id v14mr9092408lal.4.1431371534681; Mon, 11 May 2015 12:12:14 -0700 (PDT) Received: from mail-lb0-x235.google.com (mail-lb0-x235.google.com. [2a00:1450:4010:c04::235]) by mx.google.com with ESMTPS id dc7si8843551lad.153.2015.05.11.12.12.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 12:12:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::235 as permitted sender) client-ip=2a00:1450:4010:c04::235; Received: by lbcga7 with SMTP id ga7so101242556lbc.1 for ; Mon, 11 May 2015 12:12:14 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr9427226lbc.32.1431371534537; Mon, 11 May 2015 12:12:14 -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.108.230 with SMTP id hn6csp1675546lbb; Mon, 11 May 2015 12:12:12 -0700 (PDT) X-Received: by 10.70.62.97 with SMTP id x1mr21213400pdr.41.1431371531563; Mon, 11 May 2015 12:12:11 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i1si8673663pat.73.2015.05.11.12.12.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 12:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-58773-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 37579 invoked by alias); 11 May 2015 19:12:00 -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 37563 invoked by uid 89); 11 May 2015 19:11:59 -0000 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-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 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::235 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. 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__ */