grp.h revision 272461
1292639Sdavidcs/*-
2292639Sdavidcs * Copyright (c) 1989, 1993
3292639Sdavidcs *	The Regents of the University of California.  All rights reserved.
4292639Sdavidcs * (c) UNIX System Laboratories, Inc.
5292639Sdavidcs * All or some portions of this file are derived from material licensed
6292639Sdavidcs * to the University of California by American Telephone and Telegraph
7292639Sdavidcs * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8292639Sdavidcs * the permission of UNIX System Laboratories, Inc.
9292639Sdavidcs *
10292639Sdavidcs * Redistribution and use in source and binary forms, with or without
11292639Sdavidcs * modification, are permitted provided that the following conditions
12292639Sdavidcs * are met:
13292639Sdavidcs * 1. Redistributions of source code must retain the above copyright
14292639Sdavidcs *    notice, this list of conditions and the following disclaimer.
15292639Sdavidcs * 2. Redistributions in binary form must reproduce the above copyright
16292639Sdavidcs *    notice, this list of conditions and the following disclaimer in the
17292639Sdavidcs *    documentation and/or other materials provided with the distribution.
18292639Sdavidcs * 3. Neither the name of the University nor the names of its contributors
19292639Sdavidcs *    may be used to endorse or promote products derived from this software
20292639Sdavidcs *    without specific prior written permission.
21292639Sdavidcs *
22292639Sdavidcs * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23292639Sdavidcs * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24292639Sdavidcs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25292639Sdavidcs * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26292639Sdavidcs * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27292639Sdavidcs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28292639Sdavidcs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29292639Sdavidcs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30292639Sdavidcs * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31292639Sdavidcs * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32292639Sdavidcs * SUCH DAMAGE.
33292639Sdavidcs *
34292639Sdavidcs *	@(#)grp.h	8.2 (Berkeley) 1/21/94
35292639Sdavidcs * $FreeBSD: releng/10.1/include/grp.h 241731 2012-10-19 12:44:22Z brooks $
36292639Sdavidcs */
37292639Sdavidcs
38292639Sdavidcs#ifndef _GRP_H_
39292639Sdavidcs#define	_GRP_H_
40292639Sdavidcs
41292639Sdavidcs#include <sys/cdefs.h>
42292639Sdavidcs#include <sys/_types.h>
43292639Sdavidcs
44292639Sdavidcs#define	_PATH_GROUP		"/etc/group"
45292639Sdavidcs
46292639Sdavidcs#ifndef _GID_T_DECLARED
47292639Sdavidcstypedef	__gid_t		gid_t;
48292639Sdavidcs#define	_GID_T_DECLARED
49292639Sdavidcs#endif
50292639Sdavidcs
51292639Sdavidcs#ifndef _SIZE_T_DECLARED
52292639Sdavidcstypedef __size_t	size_t;
53292639Sdavidcs#define _SIZE_T_DECLARED
54292639Sdavidcs#endif
55292639Sdavidcs
56292639Sdavidcsstruct group {
57292639Sdavidcs	char	*gr_name;		/* group name */
58292639Sdavidcs	char	*gr_passwd;		/* group password */
59292639Sdavidcs	gid_t	gr_gid;			/* group id */
60292639Sdavidcs	char	**gr_mem;		/* group members */
61292639Sdavidcs};
62292639Sdavidcs
63292639Sdavidcs__BEGIN_DECLS
64292639Sdavidcs#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
65292639Sdavidcsvoid		 endgrent(void);
66292639Sdavidcsstruct group	*getgrent(void);
67292639Sdavidcs#endif
68292639Sdavidcsstruct group	*getgrgid(gid_t);
69292639Sdavidcsstruct group	*getgrnam(const char *);
70292639Sdavidcs#if __BSD_VISIBLE
71292639Sdavidcsconst char	*group_from_gid(gid_t, int);
72292639Sdavidcsint		 gid_from_group(const char *, gid_t *);
73292639Sdavidcsint		 pwcache_groupdb(int (*)(int), void (*)(void),
74292639Sdavidcs		    struct group * (*)(const char *),
75292639Sdavidcs		    struct group * (*)(gid_t));
76292639Sdavidcs#endif
77292639Sdavidcs#if __BSD_VISIBLE || __XSI_VISIBLE
78292639Sdavidcs/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */
79292639Sdavidcsint		 setgrent(void);
80292639Sdavidcs#endif
81292639Sdavidcs#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
82292639Sdavidcsint		 getgrgid_r(gid_t, struct group *, char *, size_t,
83292639Sdavidcs		    struct group **);
84292639Sdavidcsint		 getgrnam_r(const char *, struct group *, char *, size_t,
85292639Sdavidcs		    struct group **);
86292639Sdavidcs#endif
87292639Sdavidcs#if __BSD_VISIBLE
88292639Sdavidcsint		 getgrent_r(struct group *, char *, size_t, struct group **);
89292639Sdavidcsint		 setgroupent(int);
90292639Sdavidcs#endif
91292639Sdavidcs__END_DECLS
92292639Sdavidcs
93292639Sdavidcs#endif /* !_GRP_H_ */
94292639Sdavidcs