.\" -*- coding: UTF-8 -*- '\" t .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH getgrent_r 3 "28 juin 2025" "Pages du manuel de Linux 6.15" .SH NOM getgrent_r, fgetgrent_r \- Obtenir un enregistrement du fichier de groupes 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 getgrent_r(\fPsize_t size; \fB struct group *restrict \fP\fIgbuf\fP\fB,\fP \fB char \fP\fIbuf\fP\fB[restrict \fP\fIsize\fP\fB], size_t \fP\fIsize\fP\fB,\fP \fB struct group **restrict \fP\fIgbufp\fP\fB);\fP \fBint fgetgrent_r(\fPsize_t size; \fB FILE *restrict \fP\fIstream\fP\fB, struct group *restrict \fP\fIgbuf\fP\fB,\fP \fB char \fP\fIbuf\fP\fB[restrict \fP\fIsize\fP\fB], size_t \fP\fIsize\fP\fB,\fP \fB struct group **restrict \fP\fIgbufp\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 \fBgetgrent_r\fP() : .nf _GNU_SOURCE .fi .\" FIXME . The FTM requirements seem inconsistent here. File a glibc bug? .P \fBfgetgrent_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 \fBgetgrent_r\fP() et \fBfgetgrent_r\fP() sont les versions réentrantes des fonctions \fBgetgrent\fP(3) et \fBfgetgrent\fP(3). La première lit l'enregistrement de groupe suivant à partir du flux initialisé par \fBsetgrent\fP(3). La seconde lit l'enregistrement de groupe suivant à partir du \fIflux\fP. .P La structure \fIgroup\fP est définie dans \fI\fP comme ceci\ : .P .in +4n .EX struct group { char *gr_name; /* nom de groupe */ char *gr_passwd; /* mot de passe de groupe */ gid_t gr_gid; /* identifiant de groupe */ char **gr_mem; /* tableau de pointeurs de nom des membres de groupe terminé par un pointeur NULL */ }; .EE .in .P Pour plus d'informations à propos des champs de cette structure, consultez \fBgroup\fP(5). .P The nonreentrant functions return a pointer to static storage, where this static storage contains further pointers to group name, password, and members. The reentrant functions described here return all of that in caller\-provided buffers. First of all there is the buffer \fIgbuf\fP that can hold a \fIstruct\ group\fP. And next the buffer \fIbuf\fP of size \fIsize\fP that can hold additional strings. The result of these functions, the \fIstruct\ group\fP read from the stream, is stored in the provided buffer \fI*gbuf\fP, and a pointer to this \fIstruct\ group\fP is returned in \fI*gbufp\fP. .SH "VALEUR RENVOYÉE" On success, these functions return 0 and \fI*gbufp\fP is a pointer to the \fIstruct\ group\fP. On error, these functions return an error value and \fI*gbufp\fP is NULL. .SH ERREURS .TP \fBENOENT\fP Il n'y a plus d'entrées. .TP \fBERANGE\fP L'espace tampon fourni est insuffisant. 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 \fBgetgrent_r\fP() T} Sécurité des threads T{ .na .nh MT\-Unsafe race:grent locale T} T{ .na .nh \fBfgetgrent_r\fP() T} Sécurité des threads T{ .na .nh MT\-Safe T} .TE .P Dans la table ci\-dessus, \fIgrent\fP dans \fIrace:grent\fP signifie que si des fonctions parmi \fBsetgrent\fP(3), \fBgetgrent\fP(3), \fBendgrent\fP(3) ou \fBgetgrent_r\fP() sont utilisées en parallèle dans différents threads d'un programme, des situations de compétition de données pourraient se produire. .SH VERSIONS D'autres systèmes utilisent le prototype .P .in +4n .EX struct group *getgrent_r(struct group *grp, char tampon[.taille], int taille); .EE .in .P ou mieux, .P .in +4n .EX int getgrent_r(struct group *grp, char *tampon[.taille], int taille, FILE **gr_fp); .EE .in .SH STANDARDS GNU. .SH HISTORIQUE Ces fonctions sont écrites dans un style ressemblant à la version POSIX de fonctions comme \fBgetpwnam_r\fP(3). .SH NOTES La fonction \fBgetgrent_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 (getgrent_r.c) .EX #define _GNU_SOURCE #include #include #include #include #define BUFLEN 4096 \& int main(void) { struct group grp; struct group *grpp; char buf[BUFLEN]; int i; \& setgrent(); while (1) { i = getgrent_r(&grp, buf, sizeof(buf), &grpp); if (i) break; printf("%s (%jd):", grpp\->gr_name, (intmax_t) grpp\->gr_gid); for (size_t j = 0; ; j++) { if (grpp\->gr_mem[j] == NULL) break; printf(" %s", grpp\->gr_mem[j]); } printf("\[rs]n"); } endgrent(); exit(EXIT_SUCCESS); } .EE .\" perhaps add error checking - should use strerror_r .\" #include .\" #include .\" if (i) { .\" if (i == ENOENT) .\" break; .\" printf("getgrent_r: %s", strerror(i)); .\" exit(EXIT_FAILURE); .\" } .\" SRC END .SH "VOIR AUSSI" \fBfgetgrent\fP(3), \fBgetgrent\fP(3), \fBgetgrgid\fP(3), \fBgetgrnam\fP(3), \fBputgrent\fP(3), \fBgroup\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 .