Blame grp/grp.h

Packit Service 82fcde
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
/*
Packit Service 82fcde
 *	POSIX Standard: 9.2.1 Group Database Access	<grp.h>
Packit Service 82fcde
 */
Packit Service 82fcde
Packit Service 82fcde
#ifndef	_GRP_H
Packit Service 82fcde
#define	_GRP_H	1
Packit Service 82fcde
Packit Service 82fcde
#include <features.h>
Packit Service 82fcde
Packit Service 82fcde
__BEGIN_DECLS
Packit Service 82fcde
Packit Service 82fcde
#include <bits/types.h>
Packit Service 82fcde
Packit Service 82fcde
#define __need_size_t
Packit Service 82fcde
#include <stddef.h>
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
/* For the Single Unix specification we must define this type here.  */
Packit Service 82fcde
#if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined
Packit Service 82fcde
typedef __gid_t gid_t;
Packit Service 82fcde
# define __gid_t_defined
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
/* The group structure.	 */
Packit Service 82fcde
struct group
Packit Service 82fcde
  {
Packit Service 82fcde
    char *gr_name;		/* Group name.	*/
Packit Service 82fcde
    char *gr_passwd;		/* Password.	*/
Packit Service 82fcde
    __gid_t gr_gid;		/* Group ID.	*/
Packit Service 82fcde
    char **gr_mem;		/* Member list.	*/
Packit Service 82fcde
  };
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
#ifdef __USE_MISC
Packit Service 82fcde
# include <bits/types/FILE.h>
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
Packit Service 82fcde
/* Rewind the group-file stream.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern void setgrent (void);
Packit Service 82fcde
Packit Service 82fcde
/* Close the group-file stream.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern void endgrent (void);
Packit Service 82fcde
Packit Service 82fcde
/* Read an entry from the group-file stream, opening it if necessary.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern struct group *getgrent (void);
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#ifdef	__USE_MISC
Packit Service 82fcde
/* Read a group entry from STREAM.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern struct group *fgetgrent (FILE *__stream);
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#ifdef __USE_GNU
Packit Service 82fcde
/* Write the given entry onto the given stream.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int putgrent (const struct group *__restrict __p,
Packit Service 82fcde
		     FILE *__restrict __f);
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
/* Search for an entry with a matching group ID.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern struct group *getgrgid (__gid_t __gid);
Packit Service 82fcde
Packit Service 82fcde
/* Search for an entry with a matching group name.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern struct group *getgrnam (const char *__name);
Packit Service 82fcde
Packit Service 82fcde
#ifdef __USE_POSIX
Packit Service 82fcde
Packit Service 82fcde
# ifdef __USE_MISC
Packit Service 82fcde
/* Reasonable value for the buffer sized used in the reentrant
Packit Service 82fcde
   functions below.  But better use `sysconf'.  */
Packit Service 82fcde
#  define NSS_BUFLEN_GROUP	1024
Packit Service 82fcde
# endif
Packit Service 82fcde
Packit Service 82fcde
/* Reentrant versions of some of the functions above.
Packit Service 82fcde
Packit Service 82fcde
   PLEASE NOTE: the `getgrent_r' function is not (yet) standardized.
Packit Service 82fcde
   The interface may change in later versions of this library.  But
Packit Service 82fcde
   the interface is designed following the principals used for the
Packit Service 82fcde
   other reentrant functions so the chances are good this is what the
Packit Service 82fcde
   POSIX people would choose.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
Packit Service 82fcde
# ifdef __USE_GNU
Packit Service 82fcde
extern int getgrent_r (struct group *__restrict __resultbuf,
Packit Service 82fcde
		       char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
		       struct group **__restrict __result);
Packit Service 82fcde
# endif
Packit Service 82fcde
Packit Service 82fcde
/* Search for an entry with a matching group ID.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
Packit Service 82fcde
		       char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
		       struct group **__restrict __result);
Packit Service 82fcde
Packit Service 82fcde
/* Search for an entry with a matching group name.
Packit Service 82fcde
Packit Service 82fcde
   This function is a possible cancellation point and therefore not
Packit Service 82fcde
   marked with __THROW.  */
Packit Service 82fcde
extern int getgrnam_r (const char *__restrict __name,
Packit Service 82fcde
		       struct group *__restrict __resultbuf,
Packit Service 82fcde
		       char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
		       struct group **__restrict __result);
Packit Service 82fcde
Packit Service 82fcde
# ifdef	__USE_MISC
Packit Service 82fcde
/* Read a group entry from STREAM.  This function is not standardized
Packit Service 82fcde
   an probably never will.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int fgetgrent_r (FILE *__restrict __stream,
Packit Service 82fcde
			struct group *__restrict __resultbuf,
Packit Service 82fcde
			char *__restrict __buffer, size_t __buflen,
Packit Service 82fcde
			struct group **__restrict __result);
Packit Service 82fcde
# endif
Packit Service 82fcde
Packit Service 82fcde
#endif	/* POSIX or reentrant */
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
#ifdef	__USE_MISC
Packit Service 82fcde
Packit Service 82fcde
# define __need_size_t
Packit Service 82fcde
# include <stddef.h>
Packit Service 82fcde
Packit Service 82fcde
/* Set the group set for the current user to GROUPS (N of them).  */
Packit Service 82fcde
extern int setgroups (size_t __n, const __gid_t *__groups) __THROW;
Packit Service 82fcde
Packit Service 82fcde
/* Store at most *NGROUPS members of the group set for USER into
Packit Service 82fcde
   *GROUPS.  Also include GROUP.  The actual number of groups found is
Packit Service 82fcde
   returned in *NGROUPS.  Return -1 if the if *NGROUPS is too small.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int getgrouplist (const char *__user, __gid_t __group,
Packit Service 82fcde
			 __gid_t *__groups, int *__ngroups);
Packit Service 82fcde
Packit Service 82fcde
/* Initialize the group set for the current user
Packit Service 82fcde
   by reading the group database and using all groups
Packit Service 82fcde
   of which USER is a member.  Also include GROUP.
Packit Service 82fcde
Packit Service 82fcde
   This function is not part of POSIX and therefore no official
Packit Service 82fcde
   cancellation point.  But due to similarity with an POSIX interface
Packit Service 82fcde
   or due to the implementation it is a cancellation point and
Packit Service 82fcde
   therefore not marked with __THROW.  */
Packit Service 82fcde
extern int initgroups (const char *__user, __gid_t __group);
Packit Service 82fcde
Packit Service 82fcde
#endif /* Use misc.  */
Packit Service 82fcde
Packit Service 82fcde
__END_DECLS
Packit Service 82fcde
Packit Service 82fcde
#endif /* grp.h  */