Files
glibc/grp/grp.h
T

149 lines
4.5 KiB
C
Raw Normal View History

2000-02-28 05:08:01 +00:00
/* Copyright (C) 1991,92,95,96,97,98,99,2000 Free Software Foundation, Inc.
1996-11-06 04:24:40 +00:00
This file is part of the GNU C Library.
1995-02-18 01:27:10 +00:00
1996-11-06 04:24:40 +00:00
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
1995-02-18 01:27:10 +00:00
1996-11-06 04:24:40 +00:00
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
1995-02-18 01:27:10 +00:00
1996-11-06 04:24:40 +00:00
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
1995-02-18 01:27:10 +00:00
/*
* POSIX Standard: 9.2.1 Group Database Access <grp.h>
*/
#ifndef _GRP_H
#define _GRP_H 1
1997-06-21 02:59:26 +00:00
1995-02-18 01:27:10 +00:00
#include <features.h>
__BEGIN_DECLS
1997-06-21 02:59:26 +00:00
#include <bits/types.h>
1995-02-18 01:27:10 +00:00
1996-11-05 05:07:48 +00:00
#define __need_size_t
#include <stddef.h>
1995-02-18 01:27:10 +00:00
1997-12-22 20:53:38 +00:00
/* For the Single Unix specification we must define this type here. */
1999-06-23 11:04:09 +00:00
#if defined __USE_XOPEN && !defined __gid_t_defined
1997-12-22 20:53:38 +00:00
typedef __gid_t gid_t;
1999-06-23 11:04:09 +00:00
# define __gid_t_defined
1997-12-22 20:53:38 +00:00
#endif
1995-02-18 01:27:10 +00:00
/* The group structure. */
struct group
{
char *gr_name; /* Group name. */
char *gr_passwd; /* Password. */
__gid_t gr_gid; /* Group ID. */
char **gr_mem; /* Member list. */
};
1997-10-12 04:05:44 +00:00
#if defined __USE_SVID || defined __USE_GNU
# define __need_FILE
# include <stdio.h>
1995-02-18 01:27:10 +00:00
#endif
1997-10-12 04:05:44 +00:00
#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
1995-02-18 01:27:10 +00:00
/* Rewind the group-file stream. */
1999-10-09 21:56:43 +00:00
extern void setgrent (void) __THROW;
1995-02-18 01:27:10 +00:00
/* Close the group-file stream. */
1999-10-09 21:56:43 +00:00
extern void endgrent (void) __THROW;
1995-02-18 01:27:10 +00:00
/* Read an entry from the group-file stream, opening it if necessary. */
1999-10-09 21:56:43 +00:00
extern struct group *getgrent (void) __THROW;
1995-02-18 01:27:10 +00:00
#endif
#ifdef __USE_SVID
/* Read a group entry from STREAM. */
1999-10-09 21:56:43 +00:00
extern struct group *fgetgrent (FILE *__stream) __THROW;
1995-02-18 01:27:10 +00:00
#endif
1998-08-08 20:02:34 +00:00
#ifdef __USE_GNU
/* Write the given entry onto the given stream. */
1999-10-09 21:56:43 +00:00
extern int putgrent (__const struct group *__restrict __p,
FILE *__restrict __f) __THROW;
1998-08-08 20:02:34 +00:00
#endif
1995-02-18 01:27:10 +00:00
/* Search for an entry with a matching group ID. */
1999-10-09 21:56:43 +00:00
extern struct group *getgrgid (__gid_t __gid) __THROW;
1995-02-18 01:27:10 +00:00
/* Search for an entry with a matching group name. */
1999-10-09 21:56:43 +00:00
extern struct group *getgrnam (__const char *__name) __THROW;
1995-02-18 01:27:10 +00:00
1997-01-30 04:09:36 +00:00
#if defined __USE_POSIX || defined __USE_MISC
1997-10-12 04:05:44 +00:00
# ifdef __USE_MISC
1996-08-07 23:50:59 +00:00
/* Reasonable value for the buffer sized used in the reentrant
functions below. But better use `sysconf'. */
1997-10-12 04:05:44 +00:00
# define NSS_BUFLEN_GROUP 1024
# endif
1996-08-07 23:50:59 +00:00
/* Reentrant versions of some of the functions above.
1996-11-20 03:45:51 +00:00
PLEASE NOTE: the `getgrent_r' function is not (yet) standardized.
The interface may change in later versions of this library. But
the interface is designed following the principals used for the
other reentrant functions so the chances are good this is what the
POSIX people would choose. */
1996-08-07 23:50:59 +00:00
2000-02-28 05:08:01 +00:00
# ifdef __USE_GNU
1999-10-09 21:56:43 +00:00
extern int getgrent_r (struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result) __THROW;
1997-10-12 04:05:44 +00:00
# endif
1996-08-07 23:50:59 +00:00
/* Search for an entry with a matching group ID. */
1999-10-09 21:56:43 +00:00
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result) __THROW;
1996-08-07 23:50:59 +00:00
/* Search for an entry with a matching group name. */
1999-10-09 21:56:43 +00:00
extern int getgrnam_r (__const char *__restrict __name,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result) __THROW;
1996-08-07 23:50:59 +00:00
1997-10-12 04:05:44 +00:00
# ifdef __USE_SVID
1996-11-20 03:45:51 +00:00
/* Read a group entry from STREAM. This function is not standardized
an probably never will. */
1999-10-09 21:56:43 +00:00
extern int fgetgrent_r (FILE *__restrict __stream,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result) __THROW;
1997-10-12 04:05:44 +00:00
# endif
1996-08-10 00:00:16 +00:00
1997-01-24 02:23:54 +00:00
#endif /* POSIX or reentrant */
1996-08-07 23:50:59 +00:00
1995-02-18 01:27:10 +00:00
#ifdef __USE_BSD
1997-10-12 04:05:44 +00:00
# define __need_size_t
# include <stddef.h>
1995-02-18 01:27:10 +00:00
/* Set the group set for the current user to GROUPS (N of them). */
1999-10-09 21:56:43 +00:00
extern int setgroups (size_t __n, __const __gid_t *__groups) __THROW;
1995-02-18 01:27:10 +00:00
/* Initialize the group set for the current user
by reading the group database and using all groups
of which USER is a member. Also include GROUP. */
1999-10-09 21:56:43 +00:00
extern int initgroups (__const char *__user, __gid_t __group) __THROW;
1995-02-18 01:27:10 +00:00
#endif /* Use BSD. */
__END_DECLS
#endif /* grp.h */