.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH getpwent_r 3 "24 décembre 2024" "Pages du manuel de Linux 6.12" .SH NOM getpwent_r, fgetpwent_r – Obtenir un enregistrement du fichier passwd de manière réentrante .SH BIBLIOTHÈQUE Bibliothèque C standard (\fIlibc\fP,\ \fI\-lc\fP) .SH SYNOPSIS .nf \fB#include \fP .P \fBint getpwent_r(struct passwd *restrict \fP\fIpwbuf\fP\fB,\fP \fB char \fP\fIbuf\fP\fB[restrict .\fP\fIsize\fP\fB], size_t \fP\fIsize\fP\fB,\fP \fB struct passwd **restrict \fP\fIpwbufp\fP\fB);\fP \fBint fgetpwent_r(FILE *restrict \fP\fIstream\fP\fB, struct passwd *restrict \fP\fIpwbuf\fP\fB,\fP \fB char \fP\fIbuf\fP\fB[restrict .\fP\fIsize\fP\fB], size_t \fP\fIsize\fP\fB,\fP \fB struct passwd **restrict \fP\fIpwbufp\fP\fB);\fP .fi .P .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7)) : .RE .P \fBgetpwent_r\fP() : .nf Depuis la glibc 2.19 : _DEFAULT_SOURCE glibc 2.19 et antérieures : _BSD_SOURCE || _SVID_SOURCE .fi .P \fBfgetpwent_r\fP() : .nf Depuis la glibc 2.19 : _POSIX_C_SOURCE >= 200809L glibc 2.19 et antérieures : _ATFILE_SOURCE .fi .SH DESCRIPTION Les fonctions \fBgetpwent_r\fP() et \fBfgetpwent_r\fP() sont les versions réentrantes des fonctions \fBgetpwent\fP(3) et \fBfgetpwent\fP(3). La première lit l'enregistrement passwd suivant à partir du flux initialisé par \fBsetpwent\fP(3). La seconde lit l'enregistrement passwd suivant à partir du flux \fIflux\fP. .P La structure \fIpasswd\fP est définie dans \fI\fP comme ceci\ : .P .in +4n .EX struct passwd { char *pw_name; /* Nom d'utilisateur */ char *pw_passwd; /* Mot de passe de l'utilisateur */ uid_t pw_uid; /* ID de l'utilisateur */ gid_t pw_gid; /* ID du groupe */ char *pw_gecos; /* Information utilisateur */ char *pw_dir; /* Répertoire personnel */ char *pw_shell; /* Interpréteur de commande */ }; .EE .in .P Pour plus d'informations à propos des champs de cette structure, consultez \fBpasswd\fP(5). .P The nonreentrant functions return a pointer to static storage, where this static storage contains further pointers to user name, password, gecos field, home directory and shell. The reentrant functions described here return all of that in caller\-provided buffers. First of all there is the buffer \fIpwbuf\fP that can hold a \fIstruct passwd\fP. And next the buffer \fIbuf\fP of size \fIsize\fP that can hold additional strings. The result of these functions, the \fIstruct passwd\fP read from the stream, is stored in the provided buffer \fI*pwbuf\fP, and a pointer to this \fIstruct passwd\fP is returned in \fI*pwbufp\fP. .SH "VALEUR RENVOYÉE" Si elles réussissent, ces fonctions renvoient \fB0\fP et \fI*pointeur_tampon_pw\fP est un pointeur vers la structure \fIpasswd\fP. Si elles échouent, ces fonctions renvoient une valeur d'erreur et \fI*pointeur_tampon_pw\fP est NULL. .SH ERREURS .TP \fBENOENT\fP Il n'y a plus d'entrées. .TP \fBERANGE\fP La taille du tampon fourni est insuffisante. Veuillez essayer à nouveau avec un tampon plus grand. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lb lb lbx l l l. Interface Attribut Valeur T{ .na .nh \fBgetpwent_r\fP() T} Sécurité des threads T{ .na .nh MT\-Unsafe race:pwent locale T} T{ .na .nh \fBfgetpwent_r\fP() T} Sécurité des threads MT\-Safe .TE .P Dans la table ci\-dessus, \fIpwent\fP dans \fIrace:pwent\fP signifie que si une des fonctions \fBsetpwent\fP(), \fBgetpwent\fP(), \fBendpwent\fP() ou \fBgetpwent_r\fP() est utilisée en parallèle dans différents threads d'un programme, des situations de compétition entre données peuvent apparaître. .SH VERSIONS D'autres systèmes utilisent le prototype .P .in +4n .EX struct passwd * getpwent_r(struct passwd *pwd, char buf[.size], int size); .EE .in .P ou mieux .P .in +4n .EX int getpwent_r(struct passwd *pwd, char buf[.size], int size, FILE **pw_fp); .EE .in .SH STANDARDS Aucun. .SH HISTORIQUE Ces fonctions sont effectuées dans un style ressemblant à la version POSIX de fonctions comme \fBgetpwnam_r\fP(3). .SH NOTES La fonction \fBgetpwent_r\fP() n'est pas vraiment réentrante puisqu'elle partage la position de lecture dans le flux avec tous les autres threads. .SH EXEMPLES .\" SRC BEGIN (getpwent_r.c) .EX #define _GNU_SOURCE #include #include #include #include \& #define BUFLEN 4096 \& int main(void) { struct passwd pw; struct passwd *pwp; char buf[BUFLEN]; int i; \& setpwent(); while (1) { i = getpwent_r(&pw, buf, sizeof(buf), &pwp); if (i) break; printf("%s (%jd)\[rs]tHOME %s\[rs]tSHELL %s\[rs]n", pwp\->pw_name, (intmax_t) pwp\->pw_uid, pwp\->pw_dir, pwp\->pw_shell); } endpwent(); exit(EXIT_SUCCESS); } .EE .\" perhaps add error checking - should use strerror_r .\" #include .\" #include .\" if (i) { .\" if (i == ENOENT) .\" break; .\" printf("getpwent_r: %s", strerror(i)); .\" exit(EXIT_SUCCESS); .\" } .\" SRC END .SH "VOIR AUSSI" \fBfgetpwent\fP(3), \fBgetpw\fP(3), \fBgetpwent\fP(3), \fBgetpwnam\fP(3), \fBgetpwuid\fP(3), \fBputpwent\fP(3), \fBpasswd\fP(5) .PP .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot et Lucien Gentis . .PP Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. .PP Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .