From patchwork Wed Apr 15 20:21:51 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: 6245 Received: (qmail 59108 invoked by alias); 15 Apr 2015 20:22:35 -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 59051 invoked by uid 89); 15 Apr 2015 20:22:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-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=ExA1y9rC3FozS13DET0UElhVZ8LpKlLCdYKMmfPJbaA=; b=iq9hSyu+Lm54gyu2g1dgNlT303Y3MpOHtx2srYUVYpFqCDKegXI8q1ENtlYCgrGtJ5 3EFR155QNA9mKsR3b6x8XrI0kL8NCl8ljn60yO+2h+YIr1i8MsCSpYG2x0htfzb+MnAD l3AlF7+FZWdcVeW+hcNrItY/kmvPeTpB6rfcHC5b72xwJpw6HJK0PIwJ2S3skFXnVd/G vwNHzvm3MjTRMmkXXTGRWgw+KK17pct9M14gwDlzycuqm5A9dUHseAyOSp7QGbZMBmE0 MyERU5g5wVPhC4T2R2+vIMFaDTiId9JbCjkpG6q8NFo4kFnjUVf5CXAvPUzzkuy7GFyy +LQw== X-Gm-Message-State: ALoCoQlFcR/5fomViGwbsl0MzmrSrEllfJoY94/qo32lgPGEkQT3r23LGZy4OKp2xFpWt4tkB28V X-Received: by 10.140.94.104 with SMTP id f95mr33191145qge.38.1429129315981; Wed, 15 Apr 2015 13:21:55 -0700 (PDT) Message-ID: <552EC85F.6080506@linaro.org> Date: Wed, 15 Apr 2015 17:21:51 -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 2/4] 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. --- * 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 950666f..0000000 --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c +++ /dev/null @@ -1,38 +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 - -#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 91e03fc..58884cd 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -208,6 +208,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_VSYSCAL 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..5eaafc0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -0,0 +1,35 @@ +/* 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 +#if HAVE_GETTIMEOFDAY_VSYSCAL +# include +#endif + +/* 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 68acca4..0000000 --- a/sysdeps/unix/sysv/linux/s390/gettimeofday.c +++ /dev/null @@ -1,39 +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 - -#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 9c194b8..072c00e 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_VSYSCAL 1 /* This version is for kernels that implement system calls that behave like function calls as far as register saving. diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 4631cb1..a5cc17d 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_VSYSCAL 1 /* This version is for kernels that implement system calls that behave like function calls as far as register saving. diff --git a/sysdeps/unix/sysv/linux/tile/gettimeofday.c b/sysdeps/unix/sysv/linux/tile/gettimeofday.c deleted file mode 100644 index 05c6298..0000000 --- a/sysdeps/unix/sysv/linux/tile/gettimeofday.c +++ /dev/null @@ -1,32 +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 -#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 64c8920..c4a291e 100644 --- a/sysdeps/unix/sysv/linux/tile/sysdep.h +++ b/sysdeps/unix/sysv/linux/tile/sysdep.h @@ -266,6 +266,7 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL 1 +#define HAVE_GETTIMEOFDAY_VSYSCAL 1 /* Pointer mangling support. */ #if IS_IN (rtld)