11539Srgrimes/*-
21539Srgrimes * Copyright (c) 1989, 1993
31539Srgrimes *	The Regents of the University of California.  All rights reserved.
41539Srgrimes * (c) UNIX System Laboratories, Inc.
51539Srgrimes * All or some portions of this file are derived from material licensed
61539Srgrimes * to the University of California by American Telephone and Telegraph
71539Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81539Srgrimes * the permission of UNIX System Laboratories, Inc.
91539Srgrimes *
101539Srgrimes * Redistribution and use in source and binary forms, with or without
111539Srgrimes * modification, are permitted provided that the following conditions
121539Srgrimes * are met:
131539Srgrimes * 1. Redistributions of source code must retain the above copyright
141539Srgrimes *    notice, this list of conditions and the following disclaimer.
151539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161539Srgrimes *    notice, this list of conditions and the following disclaimer in the
171539Srgrimes *    documentation and/or other materials provided with the distribution.
18203964Simp * 3. Neither the name of the University nor the names of its contributors
191539Srgrimes *    may be used to endorse or promote products derived from this software
201539Srgrimes *    without specific prior written permission.
211539Srgrimes *
221539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251539Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321539Srgrimes * SUCH DAMAGE.
331539Srgrimes *
341539Srgrimes *	@(#)grp.h	8.2 (Berkeley) 1/21/94
3589663Smarkm * $FreeBSD$
361539Srgrimes */
371539Srgrimes
381539Srgrimes#ifndef _GRP_H_
391539Srgrimes#define	_GRP_H_
401539Srgrimes
4191245Ssobomax#include <sys/cdefs.h>
4294722Smike#include <sys/_types.h>
4391245Ssobomax
441539Srgrimes#define	_PATH_GROUP		"/etc/group"
451539Srgrimes
46102227Smike#ifndef _GID_T_DECLARED
47102227Smiketypedef	__gid_t		gid_t;
48102227Smike#define	_GID_T_DECLARED
4991325Smike#endif
5091325Smike
51113596Snectar#ifndef _SIZE_T_DECLARED
52113596Snectartypedef __size_t	size_t;
53113596Snectar#define _SIZE_T_DECLARED
54113596Snectar#endif
55113596Snectar
561539Srgrimesstruct group {
571539Srgrimes	char	*gr_name;		/* group name */
581539Srgrimes	char	*gr_passwd;		/* group password */
5989663Smarkm	gid_t	gr_gid;			/* group id */
601539Srgrimes	char	**gr_mem;		/* group members */
611539Srgrimes};
621539Srgrimes
631539Srgrimes__BEGIN_DECLS
64103515Smike#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
65103515Smikevoid		 endgrent(void);
66103515Smikestruct group	*getgrent(void);
67103515Smike#endif
68103509Smikestruct group	*getgrgid(gid_t);
69103509Smikestruct group	*getgrnam(const char *);
70103515Smike#if __BSD_VISIBLE
71103515Smikeconst char	*group_from_gid(gid_t, int);
72241731Sbrooksint		 gid_from_group(const char *, gid_t *);
73241731Sbrooksint		 pwcache_groupdb(int (*)(int), void (*)(void),
74241731Sbrooks		    struct group * (*)(const char *),
75241731Sbrooks		    struct group * (*)(gid_t));
76103515Smike#endif
77189812Sdas#if __BSD_VISIBLE || __XSI_VISIBLE
78113596Snectar/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */
79103509Smikeint		 setgrent(void);
80189812Sdas#endif
81189812Sdas#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
82113596Snectarint		 getgrgid_r(gid_t, struct group *, char *, size_t,
83113596Snectar		    struct group **);
84113596Snectarint		 getgrnam_r(const char *, struct group *, char *, size_t,
85113596Snectar		    struct group **);
86103515Smike#endif
87103515Smike#if __BSD_VISIBLE
88113596Snectarint		 getgrent_r(struct group *, char *, size_t, struct group **);
89103509Smikeint		 setgroupent(int);
901539Srgrimes#endif
911539Srgrimes__END_DECLS
921539Srgrimes
931539Srgrimes#endif /* !_GRP_H_ */
94