Scroll to navigation

readdir_r(3) Library Functions Manual readdir_r(3)

NOM

readdir_r - Consulter un rpertoire

BIBLIOTHÈQUE

Bibliothèque C standard (libc, -lc)

SYNOPSIS

#include <dirent.h>
[[obsolte]] int readdir_r(DIR *restrict dirp,
                           struct dirent *restrict entry,
                           struct dirent **restrict result);

Exigences de macros de test de fonctionnalités pour la glibc (consulter feature_test_macros(7)) :

readdir_r():


_POSIX_C_SOURCE
|| /* glibc <= 2.19 : */ _BSD_SOURCE || _SVID_SOURCE

DESCRIPTION

Cette fonction est obsolte; utilisez readdir(3) la place.

La fonction readdir_r() est la version rentrante de readdir(3). Elle lit la prochaine entre de rpertoire partir du flux rpertoire dirp et la renvoie dans le tampon de l'appelant point par entry. Pour des dtails sur la structure dirent, consultez readdir(3).

Un pointeur vers le tampon renvoy est plac dans *result; si la fin du flux de rpertoire est rencontre, NULL est renvoy dans *result.

Il est recommand que les applications utilisent readdir(3) la place de readdir_r(). De plus, depuis la glibc2.24, la glibc rend readdir_r() obsolte pour les raisons suivantes:

  • Pour les systmes sur lesquels NAME_MAX n'est pas dfinit, appeler readdir_r() peut tre non sr parce que l'interface ne permet pas l'appelant de fournir la longueur du tampon utilis pour l'entre de rpertoire renvoye.
  • Sur certains systmes, readdir_r() ne peut pas lire les entres de rpertoire dont le nom est trs long. Lorsque l'implmentation de la glibc rencontre un tel nom, readdir_r() choue avec l'erreur ENAMETOOLONG aprs que la dernire entre du rpertoire ait t lue. Sur d'autres systmes, readdir_r() peut renvoyer un tat de russite mais le champ d_name renvoy peut ne pas tre termin par l'octet NULL ou peut tre tronqu.
  • Dans la spcification POSIX.1 courante (POSIX.1-2008), il n'est pas requis que readdir(3) soit sr vis--vis des threads. Cependant, dans les implmentations modernes, incluant la glibc, des appels concurrents readdir(3) pour des flux rpertoire diffrents sont srs vis--vis des threads. Par consquent, l'utilisation de readdir_r() n'est gnralement pas ncessaire dans les programmes multi-threads. Dans le cas o de multiples threads doivent lire depuis un flux rpertoire identique, l'utilisation de readdir(3) avec une synchronisation externe est toujours prfrable l'utilisation de readdir_r() pour les raisons cites dans le point ci-dessus.
  • Il est attendu qu'une future version de POSIX.1 rende readdir_r() obsolte et require que readdir(3) soit sre du point de vue des threads lorsqu'elle est employe de faon simultane sur des flux rpertoire diffrents.

VALEUR RENVOYÉE

La fonction readdir_r() renvoie 0 si elle russit. Si elle choue, elle renvoie un code d'erreur positif (document dans ERREURS). Si la fin du flux rpertoire est atteinte, readdir_r() renvoie 0 et renvoie NULL dans *result.

ERREURS

Le descripteur de flux rpertoire dirp n'est pas valable.
Une entre de rpertoire dont le nom est trop long pour tre lu a t rencontre.

ATTRIBUTS

Pour une explication des termes utilisés dans cette section, consulter attributes(7).

Interface Attribut Valeur
readdir_r() Sécurité des threads MT-Safe

STANDARDS

POSIX.1-2008.

HISTORIQUE

POSIX.1-2001.

VOIR AUSSI

readdir(3)

TRADUCTION

La traduction française de cette page de manuel a été créée par #-#-#-#-# min-002-occurences.po (perkamon) #-#-#-#-#, Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Jean-Philippe MENGUAL <jpmengual@debian.org>, Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>, #-#-#-#-# min-003-occurences.po (perkamon) #-#-#-#-#, Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Jean-Philippe MENGUAL <jpmengual@debian.org>, Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>, #-#-#-#-# min-004-occurences.po (perkamon) #-#-#-#-#, Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Jean-Philippe MENGUAL <jpmengual@debian.org>, Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>, #-#-#-#-# min-010-occurences.po (perkamon) #-#-#-#-#, Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Thomas Vincent <tvincent@debian.org>, #-#-#-#-# min-020-occurences.po (perkamon) #-#-#-#-#, Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Jean-Philippe MENGUAL <jpmengual@debian.org>, Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>, #-#-#-#-# min-100-occurences.po (perkamon) #-#-#-#-#, Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Jean-Philippe MENGUAL <jpmengual@debian.org>, Jean-Pierre Giraud <jean-pierregiraud@neuf.fr> et #

Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à debian-l10n-french@lists.debian.org.

20 juillet 2023 Pages du manuel de Linux 6.05.01