unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 1/2] Reinstate ftime and move define it for POSIX.1-2001 or older
Date: Wed, 21 Oct 2020 08:03:33 -0300	[thread overview]
Message-ID: <e39db04c-4a51-b735-a41a-b99f82a6c5bf@linaro.org> (raw)
In-Reply-To: <87h7qo2m4d.fsf@oldenburg2.str.redhat.com>



On 21/10/2020 02:17, Florian Weimer wrote:
> * 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 <sys/timeb.h> 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.

I removed the entry.

> 
>> 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.

Not a strong position here, I will remove since it will defined anyway
for most scenarios.

> 
>> 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
>> +   <https://www.gnu.org/licenses/>.  */
>> +
>> +#ifndef _SYS_TIMEB_H
>> +#define _SYS_TIMEB_H	1
>> +
>> +#include <features.h>
>> +
>> +#include <bits/types/time_t.h>
>> +
>> +__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.

Indeed.

> 
>> +
>> +/* 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__.

Ack.

> 
>> +
>> +/* 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?

I think we should enforce these interface are really deprecated, and
clock_gettime is provided with _POSIX_C_SOURCE >= 199309L.

> 
> Thanks,
> Florian
> 

  reply	other threads:[~2020-10-21 11:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 19:13 [PATCH 1/2] Reinstate ftime and move define it for POSIX.1-2001 or older Adhemerval Zanella via Libc-alpha
2020-10-19 19:13 ` [PATCH 2/2] time: Add 64-bit time_t support for ftime Adhemerval Zanella via Libc-alpha
2020-10-20  8:18   ` Lukasz Majewski
2020-10-27 17:38   ` Joseph Myers
2020-10-27 17:44     ` Adhemerval Zanella via Libc-alpha
2020-10-20  8:14 ` [PATCH 1/2] Reinstate ftime and move define it for POSIX.1-2001 or older Lukasz Majewski
2020-10-20 20:33   ` Adhemerval Zanella via Libc-alpha
2020-10-20 18:04 ` Szabolcs Nagy via Libc-alpha
2020-10-20 18:20   ` Adhemerval Zanella via Libc-alpha
2020-10-21  5:17 ` Florian Weimer via Libc-alpha
2020-10-21 11:03   ` Adhemerval Zanella via Libc-alpha [this message]
2020-10-21 11:05     ` Florian Weimer via Libc-alpha
2020-10-21 12:35       ` [PATCH v2] " Adhemerval Zanella via Libc-alpha
2020-10-26 12:17         ` Adhemerval Zanella via Libc-alpha
2020-10-26 16:03           ` Szabolcs Nagy via Libc-alpha
2020-10-26 16:13             ` Adhemerval Zanella via Libc-alpha
2020-10-26 16:19         ` Florian Weimer via Libc-alpha
2020-10-26 16:23           ` Adhemerval Zanella via Libc-alpha
2020-10-26 16:29             ` Florian Weimer via Libc-alpha
2020-10-26 17:09               ` Adhemerval Zanella via Libc-alpha
2020-10-28 13:54                 ` Florian Weimer via Libc-alpha
2020-10-28 14:12                   ` Zack Weinberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e39db04c-4a51-b735-a41a-b99f82a6c5bf@linaro.org \
    --to=libc-alpha@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).