modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/grp.h (about)

     1  /* Copyright (C) 1991-2018 Free Software Foundation, Inc.
     2     This file is part of the GNU C Library.
     3  
     4     The GNU C Library is free software; you can redistribute it and/or
     5     modify it under the terms of the GNU Lesser General Public
     6     License as published by the Free Software Foundation; either
     7     version 2.1 of the License, or (at your option) any later version.
     8  
     9     The GNU C Library is distributed in the hope that it will be useful,
    10     but WITHOUT ANY WARRANTY; without even the implied warranty of
    11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12     Lesser General Public License for more details.
    13  
    14     You should have received a copy of the GNU Lesser General Public
    15     License along with the GNU C Library; if not, see
    16     <http://www.gnu.org/licenses/>.  */
    17  
    18  /*
    19   *	POSIX Standard: 9.2.1 Group Database Access	<grp.h>
    20   */
    21  
    22  #ifndef	_GRP_H
    23  #define	_GRP_H	1
    24  
    25  #include <features.h>
    26  
    27  __BEGIN_DECLS
    28  #include <bits/types.h>
    29  #define __need_size_t
    30  #include <stddef.h>
    31  /* For the Single Unix specification we must define this type here.  */
    32  #if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined
    33  typedef __gid_t gid_t;
    34  # define __gid_t_defined
    35  #endif
    36  
    37  /* The group structure.	 */
    38  struct group {
    39  	char *gr_name;		/* Group name.  */
    40  	char *gr_passwd;	/* Password.    */
    41  	__gid_t gr_gid;		/* Group ID.    */
    42  	char **gr_mem;		/* Member list. */
    43  };
    44  
    45  #ifdef __USE_MISC
    46  # include <bits/types/FILE.h>
    47  #endif
    48  
    49  #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
    50  /* Rewind the group-file stream.
    51  
    52     This function is a possible cancellation point and therefore not
    53     marked with __THROW.  */
    54  extern void setgrent(void);
    55  
    56  /* Close the group-file stream.
    57  
    58     This function is a possible cancellation point and therefore not
    59     marked with __THROW.  */
    60  extern void endgrent(void);
    61  
    62  /* Read an entry from the group-file stream, opening it if necessary.
    63  
    64     This function is a possible cancellation point and therefore not
    65     marked with __THROW.  */
    66  extern struct group *getgrent(void);
    67  #endif
    68  
    69  #ifdef	__USE_MISC
    70  /* Read a group entry from STREAM.
    71  
    72     This function is not part of POSIX and therefore no official
    73     cancellation point.  But due to similarity with an POSIX interface
    74     or due to the implementation it is a cancellation point and
    75     therefore not marked with __THROW.  */
    76  extern struct group *fgetgrent(FILE * __stream);
    77  #endif
    78  
    79  #ifdef __USE_GNU
    80  /* Write the given entry onto the given stream.
    81  
    82     This function is not part of POSIX and therefore no official
    83     cancellation point.  But due to similarity with an POSIX interface
    84     or due to the implementation it is a cancellation point and
    85     therefore not marked with __THROW.  */
    86  extern int putgrent(const struct group *__restrict __p, FILE * __restrict __f);
    87  #endif
    88  
    89  /* Search for an entry with a matching group ID.
    90  
    91     This function is a possible cancellation point and therefore not
    92     marked with __THROW.  */
    93  extern struct group *getgrgid(__gid_t __gid);
    94  
    95  /* Search for an entry with a matching group name.
    96  
    97     This function is a possible cancellation point and therefore not
    98     marked with __THROW.  */
    99  extern struct group *getgrnam(const char *__name);
   100  
   101  #ifdef __USE_POSIX
   102  
   103  # ifdef __USE_MISC
   104  /* Reasonable value for the buffer sized used in the reentrant
   105     functions below.  But better use `sysconf'.  */
   106  #  define NSS_BUFLEN_GROUP	1024
   107  # endif
   108  
   109  /* Reentrant versions of some of the functions above.
   110  
   111     PLEASE NOTE: the `getgrent_r' function is not (yet) standardized.
   112     The interface may change in later versions of this library.  But
   113     the interface is designed following the principals used for the
   114     other reentrant functions so the chances are good this is what the
   115     POSIX people would choose.
   116  
   117     This function is not part of POSIX and therefore no official
   118     cancellation point.  But due to similarity with an POSIX interface
   119     or due to the implementation it is a cancellation point and
   120     therefore not marked with __THROW.  */
   121  
   122  # ifdef __USE_GNU
   123  extern int getgrent_r(struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result);
   124  # endif
   125  
   126  /* Search for an entry with a matching group ID.
   127  
   128     This function is a possible cancellation point and therefore not
   129     marked with __THROW.  */
   130  extern int getgrgid_r(__gid_t __gid, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result);
   131  
   132  /* Search for an entry with a matching group name.
   133  
   134     This function is a possible cancellation point and therefore not
   135     marked with __THROW.  */
   136  extern int getgrnam_r(const char *__restrict __name, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result);
   137  
   138  # ifdef	__USE_MISC
   139  /* Read a group entry from STREAM.  This function is not standardized
   140     an probably never will.
   141  
   142     This function is not part of POSIX and therefore no official
   143     cancellation point.  But due to similarity with an POSIX interface
   144     or due to the implementation it is a cancellation point and
   145     therefore not marked with __THROW.  */
   146  extern int fgetgrent_r(FILE * __restrict __stream, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result);
   147  # endif
   148  
   149  #endif				/* POSIX or reentrant */
   150  
   151  #ifdef	__USE_MISC
   152  
   153  # define __need_size_t
   154  # include <stddef.h>
   155  
   156  /* Set the group set for the current user to GROUPS (N of them).  */
   157  extern int setgroups(size_t __n, const __gid_t * __groups) __THROW;
   158  
   159  /* Store at most *NGROUPS members of the group set for USER into
   160     *GROUPS.  Also include GROUP.  The actual number of groups found is
   161     returned in *NGROUPS.  Return -1 if the if *NGROUPS is too small.
   162  
   163     This function is not part of POSIX and therefore no official
   164     cancellation point.  But due to similarity with an POSIX interface
   165     or due to the implementation it is a cancellation point and
   166     therefore not marked with __THROW.  */
   167  extern int getgrouplist(const char *__user, __gid_t __group, __gid_t * __groups, int *__ngroups);
   168  
   169  /* Initialize the group set for the current user
   170     by reading the group database and using all groups
   171     of which USER is a member.  Also include GROUP.
   172  
   173     This function is not part of POSIX and therefore no official
   174     cancellation point.  But due to similarity with an POSIX interface
   175     or due to the implementation it is a cancellation point and
   176     therefore not marked with __THROW.  */
   177  extern int initgroups(const char *__user, __gid_t __group);
   178  
   179  #endif				/* Use misc.  */
   180  
   181  __END_DECLS
   182  #endif				/* grp.h  */