From patchwork Fri Oct 25 12:08:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 177732 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3601493ill; Fri, 25 Oct 2019 05:09:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsJVDTUZSR8aMeDCSouOFX9C7GD097kCX0w7kRPsPwvyVvrwGSv4xXqIpCTgNX566Gbkdy X-Received: by 2002:a17:906:3746:: with SMTP id e6mr3034137ejc.170.1572005346058; Fri, 25 Oct 2019 05:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572005346; cv=none; d=google.com; s=arc-20160816; b=vHNyZYTtqooGlqI0Q1Uch3pEFYe+KrD2lOdqkJ1GdQNjB4fi2GzJjuW5cqZgaxEt1g lMKGkH06DNMFgUJ8WKMcS4wAlO/+JIkUDgmHOumGEZmotvo+iw3qia0+QuuzOotfNcgG vd6lWjYdrin9/VqZmkDm8nhGMvGU6KFfObcS2fCI45gsrb3eSbTQxIlXdFLuA6OEIZIM hNGYaxQWMqn+GaIFagCPHrz/anjSpUwzhH0ZESAfCdmm39cAw4vzKg2QWwwy5eXrKDb9 Nww+IHA09nslEnUhN+jn4nc7q/Zf/8RiVhFDaJeGG9kG+zICuU/raQCcmnHSSYw6/XlN iYbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=APXkdpaTZNm9nD89B8jZ5tBCK/W+zlQ/9JEkC0sr+qY=; b=QQ6htV8vj8IenvS5eQ0lsAT09o9tOlpvY7zccAr7s3N339392Q4JpmD437fwyOg/e4 v1fvtc/arGyTfZFUwWIALrmzNMx8QCUcs+atxbv+w3W3h7PS/Jj50zf8xJdMXw/2FJT2 vbc7najguqTMVI0mFm8+B9BGATctSzv6WheVCU+o9pbdD5T8+Q4l03MJPNJw6oShIN11 zbShz9xD+slouKZOxHmxSl9/bPj++UGM7MeuqnjNNdT950aHHqXai89cVapkRHQlqoKP mztjLLx0L81MYT+1vl/qdFyS8aE3+pluxFcQ1MH9q1vxjAAWAPF5YnoDgOg2Cr8QFL0W rfcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mCJW2gof; dkim=pass header.i=@linaro.org header.s=google header.b=jlnyXYnb; spf=pass (google.com: domain of libc-alpha-return-106282-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-106282-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y42si1104751edd.191.2019.10.25.05.09.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Oct 2019 05:09:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-106282-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mCJW2gof; dkim=pass header.i=@linaro.org header.s=google header.b=jlnyXYnb; spf=pass (google.com: domain of libc-alpha-return-106282-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-106282-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=g14JUsYQdHm57IQnXk4faZOq0MDHboy X+DApW5WOj0zqrvB9HwPzULkJKzJO4GUk02lGUIw/ucfy5qJ1SIpGOyjYFsRYWhn Nx6qBMMTDYfHe6+YRxmh/oEk454Q+vJypbKpl6RbfbzS8sk3xXZBkC0uLU4qFio+ CgYLBysllrcE= 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:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=69ibD8x3LLDh5wUBXL1uYqlb/Es=; b=mCJW2 gofp3b+DcyPjDQSB4N72LXZYziW05tPmsk0IndsxY8f5NNsS+BJ+FKo5NAiGOaS0 8IiuirBgmMyWE5hUYlBXhVCo8rf82AoUm/QdsNvnyYKnxZNPyv01EPol6ng1xd+E xaEBNNcIB8jIbvlRg0ojGvQD12Cb6ILhPLzRsA= Received: (qmail 77139 invoked by alias); 25 Oct 2019 12:08:53 -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 77045 invoked by uid 89); 25 Oct 2019 12:08:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=ports X-HELO: mail-qk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=APXkdpaTZNm9nD89B8jZ5tBCK/W+zlQ/9JEkC0sr+qY=; b=jlnyXYnbWq95pYlYl2KNfTUDMoea2Rn+NgD4aUv6qWML4TGPraBPR6GC0gTc9S3Pon HurXjZkNM3gsyLN1iT29rrDu8RR+Ur577OnxquQdQ8En7sOSS5nHVi5f9lyfWWHtBPl5 OzxJN5Pz5sa+NF6fUDQkaSQ8xxLiWguLFobnLn5soOLiSO8l6b7s7tYKoU/T3LbDE3eg QEx2pK5wQbKSXvh/m2FDXx/53R1+GMIO/ZTOojeVbaDBF6gTRZ8+cZfHjHaJntWsjkKM 5QCyUEsT1MP+s7D3sSjxhJM8G+4ZVmz4rJgVuDANgBsst65p0YlLtC3MHgHdcCqbFjUl Bmyg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Lukasz Majewski , Zack Weinberg Subject: [PATCH v2 03/11] Use clock_settime to implement stime; withdraw stime. Date: Fri, 25 Oct 2019 09:08:24 -0300 Message-Id: <20191025120832.27667-4-adhemerval.zanella@linaro.org> In-Reply-To: <20191025120832.27667-1-adhemerval.zanella@linaro.org> References: <20191025120832.27667-1-adhemerval.zanella@linaro.org> From: Zack Weinberg Use clock_settime to implement stime; withdraw stime. Changes from previous version: - Added a NEWS entry. -- Unconditionally, on all ports, use clock_settime to implement stime, not settimeofday or a direct syscall. Then convert stime into a compatibility symbol and remove its prototype from time.h. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Adhemerval Zanella --- NEWS | 4 +++ sysdeps/unix/stime.c | 39 --------------------------- sysdeps/unix/sysv/linux/syscalls.list | 1 - time/stime.c | 25 ++++++++--------- time/time.h | 6 ----- 5 files changed, 17 insertions(+), 58 deletions(-) delete mode 100644 sysdeps/unix/stime.c -- 2.17.1 Reviewed-by: Lukasz Majewski diff --git a/NEWS b/NEWS index d7286841c9..8727b5e7f0 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,10 @@ Deprecated and removed features, and other changes affecting compatibility: Request 25 to TS 18661-1, as applied for C2X. Existing binaries that pass floating-point arguments directly will continue to work. +* The obsolete function stime is no longer available to newly linked + binaries and it has been removed from header. This function + has been deprecated in favor of clock_settime. + Changes to build and runtime requirements: [Add changes to build and runtime requirements here] diff --git a/sysdeps/unix/stime.c b/sysdeps/unix/stime.c deleted file mode 100644 index b40c33454a..0000000000 --- a/sysdeps/unix/stime.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1992-2019 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 /* For NULL. */ -#include -#include - -/* Set the system clock to *WHEN. */ - -int -stime (const time_t *when) -{ - struct timeval tv; - - if (when == NULL) - { - __set_errno (EINVAL); - return -1; - } - - tv.tv_sec = *when; - tv.tv_usec = 0; - return __settimeofday (&tv, (struct timezone *) 0); -} diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index cdcf6c127b..70b110979b 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -61,7 +61,6 @@ setfsgid EXTRA setfsgid i:i setfsgid setfsuid EXTRA setfsuid i:i setfsuid setpgid - setpgid i:ii __setpgid setpgid sigaltstack - sigaltstack i:PP __sigaltstack sigaltstack -stime - stime i:p stime sysinfo EXTRA sysinfo i:p __sysinfo sysinfo swapon - swapon i:si __swapon swapon swapoff - swapoff i:s __swapoff swapoff diff --git a/time/stime.c b/time/stime.c index a53c0e86ae..6ea3b6dcc1 100644 --- a/time/stime.c +++ b/time/stime.c @@ -15,23 +15,24 @@ License along with the GNU C Library; if not, see . */ -#include +#include + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31) + #include -#include /* Set the system clock to *WHEN. */ int -stime (const time_t *when) +attribute_compat_text_section +__stime (const time_t *when) { - if (when == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; + struct timespec ts; + ts.tv_sec = *when; + ts.tv_nsec = 0; + + return __clock_settime (CLOCK_REALTIME, &ts); } -stub_warning (stime) +compat_symbol (libc, __stime, stime, GLIBC_2_0); +#endif diff --git a/time/time.h b/time/time.h index 72a1078d2c..7daaacce16 100644 --- a/time/time.h +++ b/time/time.h @@ -175,12 +175,6 @@ extern int daylight; extern long int timezone; #endif -#ifdef __USE_MISC -/* Set the system time to *WHEN. - This call is restricted to the superuser. */ -extern int stime (const time_t *__when) __THROW; -#endif - /* Nonzero if YEAR is a leap year (every 4 years, except every 100th isn't, and every 400th is). */