From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id D675C3857C67 for ; Wed, 21 Oct 2020 05:18:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D675C3857C67 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-579-kU0ByAr8MU-iBTIQOT7NOg-1; Wed, 21 Oct 2020 01:17:58 -0400 X-MC-Unique: kU0ByAr8MU-iBTIQOT7NOg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F207B8064AF; Wed, 21 Oct 2020 05:17:56 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-112-83.ams2.redhat.com [10.36.112.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 427CA19C4F; Wed, 21 Oct 2020 05:17:56 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 1/2] Reinstate ftime and move define it for POSIX.1-2001 or older References: <20201019191304.3471080-1-adhemerval.zanella@linaro.org> Date: Wed, 21 Oct 2020 07:17:54 +0200 In-Reply-To: <20201019191304.3471080-1-adhemerval.zanella@linaro.org> (Adhemerval Zanella's message of "Mon, 19 Oct 2020 16:13:03 -0300") Message-ID: <87h7qo2m4d.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Oct 2020 05:18:07 -0000 * Adhemerval Zanella: > diff --git a/NEWS b/NEWS > index 6eb577a669..6105eb0b3e 100644 > --- a/NEWS > +++ b/NEWS > @@ -37,10 +37,8 @@ Deprecated and removed features, and other changes affecting compatibility: > implementations from HWCAP subdirectories are no longer loaded. > Instead, the default implementation is used. > > -* The deprecated header and the ftime function have been > - removed. To support old binaries, the ftime function continue to exist > - as a compatibility symbol (on those architectures which had it). All > - programs should use gettimeofday or clock_gettime instead. > +* The deprecated ftime function is now only declared for POSIX.1-2001 or > + older standard. It is also declared for _GNU_SOURCE, so the NEWS entry is not correct. > diff --git a/include/features.h b/include/features.h > index f3e62d3362..aec149ed10 100644 > --- a/include/features.h > +++ b/include/features.h > @@ -143,6 +143,7 @@ > #undef __GLIBC_USE_ISOC2X > #undef __GLIBC_USE_DEPRECATED_GETS > #undef __GLIBC_USE_DEPRECATED_SCANF > +#undef __GLIBC_USE_DEPRECATED_FTIME > > /* Suppress kernel-name space pollution unless user expressedly asks > for it. */ > @@ -438,6 +439,15 @@ > # define __GLIBC_USE_DEPRECATED_SCANF 0 > #endif > > +/* The function 'ftime' appeared in Version 7 AT&T UNIX, it was marked > + as LEGACY on IEEE 1003.1-2004, and removed on IEEE 1003.1-2008. */ > +#if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) <= 200112L) \ > + || defined _XOPEN_SOURCE_EXTENDED > +# define __GLIBC_USE_DEPRECATED_FTIME 1 > +#else > +# define __GLIBC_USE_DEPRECATED_FTIME 0 > +#endif Due to the _XOPEN_SOURCE_EXTENDED part, this does not seem particularly useful. > diff --git a/time/sys/timeb.h b/time/sys/timeb.h > new file mode 100644 > index 0000000000..be7b46c178 > --- /dev/null > +++ b/time/sys/timeb.h > @@ -0,0 +1,48 @@ > +/* Copyright (C) 1994-2020 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 > + . */ > + > +#ifndef _SYS_TIMEB_H > +#define _SYS_TIMEB_H 1 > + > +#include > + > +#include > + > +__BEGIN_DECLS > + > +#if __GLIBC_USE (DEPRECATED_FTIME) I'm not sure if that #if is particularly useful. For later POSIX, this is a non-standard header, so there is no conformance issue. > + > +/* Structure returned by the `ftime' function. */ > + > +struct timeb > + { > + time_t time; /* Seconds since epoch, as from `time'. */ > + unsigned short int millitm; /* Additional milliseconds. */ > + short int timezone; /* Minutes west of GMT. */ > + short int dstflag; /* Nonzero if Daylight Savings Time used. */ > + }; Missing __attribute_deprecated_msg__. > + > +/* Fill in TIMEBUF with information about the current time. */ > + > +extern int ftime (struct timeb *__timebuf) > + __nonnull ((1)) __attribute_deprecated__; Please use __attribute_deprecated_msg__, pointing towards clock_gettime. Should these deprecations be disabled for older POSIX? Thanks, Florian -- Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill