[v2,9/9] dirent: Deprecate getdirentries
Commit Message
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 | 11 +++++++----
sysdeps/unix/sysv/linux/Makefile | 3 +++
3 files changed, 13 insertions(+), 4 deletions(-)
@@ -33,6 +33,9 @@ Deprecated and removed features, and other changes affecting compatibility:
* The mallinfo function is marked deprecated. Callers should call
mallinfo2 instead.
+* 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]
@@ -348,29 +348,32 @@ 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__;
# 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
# 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__;
# endif
#endif /* Use misc. */
@@ -260,6 +260,9 @@ ifeq ($(subdir),dirent)
sysdep_routines += getdirentries getdirentries64
tests += tst-getdents64
tests-internal += tst-readdir64-compat
+
+# Avoid the warning for the weak_alias for _DIRENT_MATCHES_DIRENT64
+CFLAGS-getdirentries64.c = -Wno-deprecated-declarations
endif
ifeq ($(subdir),nis)