diff mbox series

[10/10] dirent: Deprecate getdirentries

Message ID 20200417132209.22065-10-adhemerval.zanella@linaro.org
State New
Headers show
Series [01/10] linux: Move posix dir implementations to Linux | expand

Commit Message

Adhemerval Zanella April 17, 2020, 1:22 p.m. UTC
The interface has some issues:

  1. It is build on top getdents on Linux and requires handling
     non-LFS call using LFS getdents.

  2. It is not wildly used and the non-LFS support is as problematic
     as non-LFS readdir.  glibc only exports the LFS getdents.

  3. It is not a direct replacement over BSD since on some plataform
     its signature has changed (FreeBSD 11, for instance, used to
     set the offset as a 'long' and changed to 'off_t' on version 12).

The idea is to eventually move the symbols to compat ones.
---
 NEWS            | 3 +++
 dirent/dirent.h | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Florian Weimer April 22, 2020, 10:10 a.m. UTC | #1
* Adhemerval Zanella via Libc-alpha:

> diff --git a/NEWS b/NEWS
> index 2424fecdc0..58d9db6d00 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -22,6 +22,9 @@ Deprecated and removed features, and other changes affecting compatibility:
>    but always fails with ENOSYS.  This reflects the removal of the system
>    call from all architectures, starting with Linux 5.5.
>  
> +* The function getdirentries is now deprecated, applications should use
> +  either getdents or POSIX readdir instead.

getdents64, readdir64 or readdir

> diff --git a/dirent/dirent.h b/dirent/dirent.h
> index 92d0925047..4ee60471f7 100644
> --- a/dirent/dirent.h
> +++ b/dirent/dirent.h
> @@ -353,14 +353,15 @@ extern int alphasort64 (const struct dirent64 **__e1,
>  extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
>  				size_t __nbytes,
>  				__off_t *__restrict __basep)
> -     __THROW __nonnull ((2, 4));
> +     __THROW __nonnull ((2, 4)) __attribute_deprecated__;
>  # else
>  #  ifdef __REDIRECT
>  extern __ssize_t __REDIRECT_NTH (getdirentries,
>  				 (int __fd, char *__restrict __buf,
>  				  size_t __nbytes,
>  				  __off64_t *__restrict __basep),
> -				 getdirentries64) __nonnull ((2, 4));
> +				 getdirentries64)
> +     __THROW __nonnull ((2, 4)) __attribute_deprecated__;
>  #  else
>  #   define getdirentries getdirentries64
>  #  endif
> @@ -370,7 +371,7 @@ extern __ssize_t __REDIRECT_NTH (getdirentries,
>  extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
>  				  size_t __nbytes,
>  				  __off64_t *__restrict __basep)
> -     __THROW __nonnull ((2, 4));
> +     __THROW __nonnull ((2, 4)) __attribute_deprecated__;
>  # endif
>  #endif /* Use misc.  */

Please add a message pointing to readdir64 (probably in both cases).
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index 2424fecdc0..58d9db6d00 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@  Deprecated and removed features, and other changes affecting compatibility:
   but always fails with ENOSYS.  This reflects the removal of the system
   call from all architectures, starting with Linux 5.5.
 
+* The function getdirentries is now deprecated, applications should use
+  either getdents or POSIX readdir instead.
+
 Changes to build and runtime requirements:
 
   [Add changes to build and runtime requirements here]
diff --git a/dirent/dirent.h b/dirent/dirent.h
index 92d0925047..4ee60471f7 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -353,14 +353,15 @@  extern int alphasort64 (const struct dirent64 **__e1,
 extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
 				size_t __nbytes,
 				__off_t *__restrict __basep)
-     __THROW __nonnull ((2, 4));
+     __THROW __nonnull ((2, 4)) __attribute_deprecated__;
 # else
 #  ifdef __REDIRECT
 extern __ssize_t __REDIRECT_NTH (getdirentries,
 				 (int __fd, char *__restrict __buf,
 				  size_t __nbytes,
 				  __off64_t *__restrict __basep),
-				 getdirentries64) __nonnull ((2, 4));
+				 getdirentries64)
+     __THROW __nonnull ((2, 4)) __attribute_deprecated__;
 #  else
 #   define getdirentries getdirentries64
 #  endif
@@ -370,7 +371,7 @@  extern __ssize_t __REDIRECT_NTH (getdirentries,
 extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
 				  size_t __nbytes,
 				  __off64_t *__restrict __basep)
-     __THROW __nonnull ((2, 4));
+     __THROW __nonnull ((2, 4)) __attribute_deprecated__;
 # endif
 #endif /* Use misc.  */