public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/bz23960-dirent] dirent: Deprecate getdirentries
@ 2023-01-26 12:17 Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2023-01-26 12:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8587ae4a679d317d5ee4ba83af35e9105198bada

commit 8587ae4a679d317d5ee4ba83af35e9105198bada
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Apr 17 09:59:51 2020 -0300

    dirent: Deprecate getdirentries
    
    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.

Diff:
---
 NEWS                             |  3 +++
 dirent/dirent.h                  | 14 ++++++++++----
 sysdeps/unix/sysv/linux/Makefile |  4 ++++
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 5c276dacb3..0e893bd9db 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,9 @@ Deprecated and removed features, and other changes affecting compatibility:
   corresponds to the AT_PLATFORM system name, or employs the legacy AT_HWCAP
   search mechanism, which was deprecated in version 2.33.
 
+* The function getdirentries is now deprecated, applications should use
+  either getdents64, readdir64 or readdir.
+
 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 37be2030df..1465b7d9d5 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -350,29 +350,35 @@ extern int alphasort64 (const struct dirent64 **__e1,
 /* Read directory entries from FD into BUF, reading at most NBYTES.
    Reading starts at offset *BASEP, and *BASEP is updated with the new
    position after reading.  Returns the number of bytes read; zero when at
-   end of directory; or -1 for errors.  */
+   end of directory; or -1 for errors.
+   This is deprecated and getdents64 or readdir should be used instead.  */
 # ifndef __USE_FILE_OFFSET64
 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_msg__ ("Use getdents64 instead");
 # 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)
+     __nonnull ((2, 4))
+     __attribute_deprecated_msg__ ("Use getdents64 instead");
 #  else
 #   define getdirentries getdirentries64
 #  endif
 # endif
 
 # ifdef __USE_LARGEFILE64
+/* This is deprecated and getdents64 or readdir64 should be used instead.  */
 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_msg__ ("Use getdents64 instead");
 # endif
 #endif /* Use misc.  */
 
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index f298878e8f..41e5341450 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -467,6 +467,10 @@ tests += \
   tst-getdents64 \
   tst-readdir64-compat \
   # tests
+
+# Avoid the warning for the weak_alias for _DIRENT_MATCHES_DIRENT64
+CFLAGS-getdirentries64.o = -Wno-deprecated-declarations
+CFLAGS-getdirentries64.os = -Wno-deprecated-declarations
 endif # $(subdir) == dirent
 
 ifeq ($(subdir),nis)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [glibc/azanella/bz23960-dirent] dirent: Deprecate getdirentries
@ 2022-11-02 13:07 Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2022-11-02 13:07 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cd10b078d06b86fecee4ded196cda84051cb7a93

commit cd10b078d06b86fecee4ded196cda84051cb7a93
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Apr 17 09:59:51 2020 -0300

    dirent: Deprecate getdirentries
    
    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.

Diff:
---
 NEWS                             |  3 +++
 dirent/dirent.h                  | 14 ++++++++++----
 sysdeps/unix/sysv/linux/Makefile |  4 ++++
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index a10bb08fb0..2b4ed6bbc1 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,9 @@ Deprecated and removed features, and other changes affecting compatibility:
   corresponds to the AT_PLATFORM system name, or employs the legacy AT_HWCAP
   search mechanism, which was deprecated in version 2.33.
 
+* The function getdirentries is now deprecated, applications should use
+  either getdents64, readdir64 or readdir.
+
 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 c47d3273b2..1c299e5be8 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -350,29 +350,35 @@ extern int alphasort64 (const struct dirent64 **__e1,
 /* Read directory entries from FD into BUF, reading at most NBYTES.
    Reading starts at offset *BASEP, and *BASEP is updated with the new
    position after reading.  Returns the number of bytes read; zero when at
-   end of directory; or -1 for errors.  */
+   end of directory; or -1 for errors.
+   This is deprecated and getdents64 or readdir should be used instead.  */
 # ifndef __USE_FILE_OFFSET64
 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_msg__ ("Use getdents64 instead");
 # 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)
+     __nonnull ((2, 4))
+     __attribute_deprecated_msg__ ("Use getdents64 instead");
 #  else
 #   define getdirentries getdirentries64
 #  endif
 # endif
 
 # ifdef __USE_LARGEFILE64
+/* This is deprecated and getdents64 or readdir64 should be used instead.  */
 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_msg__ ("Use getdents64 instead");
 # endif
 #endif /* Use misc.  */
 
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 60e4cb1521..37f227e550 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -373,6 +373,10 @@ tests += \
   tst-getdents64 \
   tst-readdir64-compat \
   # tests
+
+# Avoid the warning for the weak_alias for _DIRENT_MATCHES_DIRENT64
+CFLAGS-getdirentries64.o = -Wno-deprecated-declarations
+CFLAGS-getdirentries64.os = -Wno-deprecated-declarations
 endif # $(subdir) == dirent
 
 ifeq ($(subdir),nis)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-26 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 12:17 [glibc/azanella/bz23960-dirent] dirent: Deprecate getdirentries Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2022-11-02 13:07 Adhemerval Zanella

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