unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 2/3] Move ftime to a compatibility symbol
Date: Fri, 16 Oct 2020 11:05:20 +0200	[thread overview]
Message-ID: <20201016110520.0636256f@jawa> (raw)
In-Reply-To: <20201015130632.90961-2-adhemerval.zanella@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 7875 bytes --]

Hi Adhemerval,

> It was made deprecated on 2.31, so it moves to compat symbol after
> two releases.  It was also removed from exported symbol for riscv32
> (since ABI will be supported on for 2.33).
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.
> ---
>  include/sys/timeb.h                           |  1 -
>  .../unix/sysv/linux/riscv/rv32/libc.abilist   |  1 -
>  time/Makefile                                 |  5 +-
>  time/ftime.c                                  | 19 +++++-
>  time/sys/timeb.h                              | 44 --------------
>  time/tst-ftime.c                              | 59
> ++++++++++--------- 6 files changed, 50 insertions(+), 79 deletions(-)
>  delete mode 100644 include/sys/timeb.h
>  delete mode 100644 time/sys/timeb.h
> 
> diff --git a/include/sys/timeb.h b/include/sys/timeb.h
> deleted file mode 100644
> index 9f4509c35e..0000000000
> --- a/include/sys/timeb.h
> +++ /dev/null
> @@ -1 +0,0 @@
> -#include <time/sys/timeb.h>
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
> b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist index
> 36aa34a5e7..e977715088 100644 ---
> a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist @@ -795,7 +795,6 @@
> GLIBC_2.33 fsync F GLIBC_2.33 ftell F
>  GLIBC_2.33 ftello F
>  GLIBC_2.33 ftello64 F
> -GLIBC_2.33 ftime F
>  GLIBC_2.33 ftok F
>  GLIBC_2.33 ftruncate F
>  GLIBC_2.33 ftruncate64 F
> diff --git a/time/Makefile b/time/Makefile
> index a4fb13d6a3..ab8fb3303b 100644
> --- a/time/Makefile
> +++ b/time/Makefile
> @@ -22,7 +22,7 @@ subdir	:= time
>  
>  include ../Makeconfig
>  
> -headers := time.h sys/time.h sys/timeb.h bits/time.h
> 	\ +headers := time.h sys/time.h bits/time.h
> 		\ bits/types/clockid_t.h bits/types/clock_t.h
> 		\ bits/types/struct_itimerspec.h
> 		\ bits/types/struct_timespec.h
> bits/types/struct_timeval.h	\ @@ -45,9 +45,10 @@ aux :=
>     era alt_digit lc-time-cleanup tests	:= test_time clocktest
> tst-posixtz tst-strptime tst_wcsftime \ tst-getdate tst-mktime
> tst-mktime2 tst-ftime_l tst-strftime \ tst-mktime3 tst-strptime2
> bug-asctime bug-asctime_r bug-mktime1 \
> -	   tst-strptime3 bug-getdate1 tst-strptime-whitespace
> tst-ftime \
> +	   tst-strptime3 bug-getdate1 tst-strptime-whitespace \
>  	   tst-tzname tst-y2039 bug-mktime4 tst-strftime2
> tst-strftime3 \ tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1
> +tests-internal := tst-ftime
>  
>  include ../Rules
>  
> diff --git a/time/ftime.c b/time/ftime.c
> index 93f485bbf7..be3295ef76 100644
> --- a/time/ftime.c
> +++ b/time/ftime.c
> @@ -16,11 +16,23 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <sys/timeb.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
> +
>  #include <time.h>
>  
> +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.  */
> +  };
> +
>  int
> -ftime (struct timeb *timebuf)
> +attribute_compat_text_section
> +__ftime (struct timeb *timebuf)
>  {
>    struct timespec ts;
>    __clock_gettime (CLOCK_REALTIME, &ts);
> @@ -31,3 +43,6 @@ ftime (struct timeb *timebuf)
>    timebuf->dstflag = 0;
>    return 0;
>  }
> +
> +compat_symbol (libc, __ftime, ftime, GLIBC_2_0);
> +#endif
> diff --git a/time/sys/timeb.h b/time/sys/timeb.h
> deleted file mode 100644
> index 641c333450..0000000000
> --- a/time/sys/timeb.h
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/* 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
> -
> -/* 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.  */
> -  };
> -
> -/* Fill in TIMEBUF with information about the current time.  */
> -
> -extern int ftime (struct timeb *__timebuf)
> -  __nonnull ((1)) __attribute_deprecated__;
> -
> -__END_DECLS
> -
> -#endif	/* sys/timeb.h */

One less exported header to maintain. Good :-)

> diff --git a/time/tst-ftime.c b/time/tst-ftime.c
> index 08916c0c65..6978feb0f1 100644
> --- a/time/tst-ftime.c
> +++ b/time/tst-ftime.c
> @@ -16,9 +16,23 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <sys/timeb.h>
> -#include <stdio.h>
> -#include <libc-diag.h>
> +
> +#include <shlib-compat.h>
> +#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
> +#include <time.h>
> +#include <support/check.h>
> +
> +compat_symbol_reference (libc, ftime, ftime, GLIBC_2_0);
> +
> +struct timeb
> +  {
> +    time_t time;
> +    unsigned short int millitm;
> +    short int timezone;
> +    short int dstflag;
> +  };
> +
> +extern int ftime (struct timeb *__timebuf);
>  
>  static int
>  do_test (void)
> @@ -30,36 +44,23 @@ do_test (void)
>      {
>        prev = curr;
>  
> -      /* ftime was deprecated on 2.31.  */
> -      DIAG_PUSH_NEEDS_COMMENT;
> -      DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
> -
> -      if (ftime (&curr))
> -        {
> -          printf ("ftime returned an error\n");
> -          return 1;
> -        }
> -
> -      DIAG_POP_NEEDS_COMMENT;
> -
> -      if (curr.time < prev.time)
> -        {
> -          printf ("ftime's time flowed backwards\n");
> -          return 1;
> -        }
> -
> -      if (curr.time == prev.time
> -          && curr.millitm < prev.millitm)
> -        {
> -          printf ("ftime's millitm flowed backwards\n");
> -          return 1;
> -        }
> +      /* ftime was deprecated on 2.31 and removed on 2.33.  */
> +      TEST_COMPARE (ftime (&curr), 0);
> +      TEST_VERIFY_EXIT (curr.time >= prev.time);
> +      if (curr.time == prev.time)
> +	TEST_VERIFY_EXIT (curr.millitm >= prev.millitm);
>  
>        if (curr.time > prev.time)
>          sec ++;
>      }
>    return 0;
>  }
> +#else
> +static int
> +do_test (void)
> +{
> +  return EXIT_UNSUPPORTED;
> +}
> +#endif
>  
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> +#include <support/test-driver.c>

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-10-16  9:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 13:06 [PATCH 1/3] linux: Fix time64 support for futimesat Adhemerval Zanella via Libc-alpha
2020-10-15 13:06 ` [PATCH 2/3] Move ftime to a compatibility symbol Adhemerval Zanella via Libc-alpha
2020-10-16  9:05   ` Lukasz Majewski [this message]
2020-10-16 18:18   ` [COMMITTED] Add NEWS entry for ftime compatibility move Adhemerval Zanella via Libc-alpha
2020-10-19  7:55   ` [PATCH 2/3] Move ftime to a compatibility symbol Szabolcs Nagy via Libc-alpha
2020-10-19  8:17     ` Andreas Schwab
2020-10-19  8:30     ` Florian Weimer via Libc-alpha
2020-10-19  9:18       ` Tamar Christina via Libc-alpha
2020-10-19  9:51         ` Florian Weimer via Libc-alpha
2020-10-19 10:20           ` Tamar Christina via Libc-alpha
2020-10-19 10:46             ` Florian Weimer via Libc-alpha
2020-10-19 10:49   ` Florian Weimer via Libc-alpha
2020-10-19 11:56     ` Andreas Schwab
2020-10-19 11:58       ` Florian Weimer via Libc-alpha
2020-10-19 12:30         ` Adhemerval Zanella via Libc-alpha
2020-10-19 12:31           ` Adhemerval Zanella via Libc-alpha
2020-10-19 17:56     ` Joseph Myers
2020-10-15 13:06 ` [PATCH 3/3] linux: Add 64-bit time_t support for wait3 Adhemerval Zanella via Libc-alpha
2020-10-15 14:43   ` Alistair Francis via Libc-alpha
2020-10-16  9:14   ` Lukasz Majewski
2020-10-16 17:02     ` Adhemerval Zanella via Libc-alpha
2020-10-18 19:55       ` Lukasz Majewski
2020-10-16  8:41 ` [PATCH 1/3] linux: Fix time64 support for futimesat Lukasz Majewski
2020-10-16 14:20   ` Adhemerval Zanella via Libc-alpha

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=20201016110520.0636256f@jawa \
    --to=lukma@denx.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /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).