From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18222 invoked by alias); 28 Aug 2019 13:04:43 -0000 Mailing-List: contact glibc-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: glibc-cvs-owner@sourceware.org List-Subscribe: Received: (qmail 18205 invoked by uid 9014); 28 Aug 2019 13:04:43 -0000 Date: Wed, 28 Aug 2019 13:04:00 -0000 Message-ID: <20190828130443.18204.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Zack Weinberg To: glibc-cvs@sourceware.org Subject: [glibc/zack/y2038-preliminaries] Use clock_settime to implement stime; withdraw stime. X-Act-Checkin: glibc X-Git-Author: Zack Weinberg X-Git-Refname: refs/heads/zack/y2038-preliminaries X-Git-Oldrev: 941672697c7e20605e5ba401dc5486fe42648e16 X-Git-Newrev: 819549fb3be40c00934de156b8ab993d84696319 X-SW-Source: 2019-q3/txt/msg00421.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=819549fb3be40c00934de156b8ab993d84696319 commit 819549fb3be40c00934de156b8ab993d84696319 Author: Zack Weinberg Date: Fri Aug 16 15:03:16 2019 -0400 Use clock_settime to implement stime; withdraw stime. 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. * time/stime.c (stime): No longer a stub implementation. Call __clock_settime. Demote to a compatibility symbol. * sysdeps/unix/stime.c: Delete file. * sysdeps/unix/sysv/linux/syscalls.list: Remove entry for stime. * time/time.h: Remove prototype for stime. Diff: --- sysdeps/unix/stime.c | 39 ----------------------------------- sysdeps/unix/sysv/linux/syscalls.list | 1 - time/stime.c | 25 +++++++++++----------- time/time.h | 6 ------ 4 files changed, 13 insertions(+), 58 deletions(-) diff --git a/sysdeps/unix/stime.c b/sysdeps/unix/stime.c deleted file mode 100644 index b0809be..0000000 --- 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 cdcf6c1..70b1109 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 de58c49..754e2da 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 cba6d15..57cfd4d 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). */