1*5a122e6eSmillert /* $OpenBSD: grp.h,v 1.13 2018/09/13 12:31:15 millert Exp $ */ 2df930be7Sderaadt /* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */ 3df930be7Sderaadt 4df930be7Sderaadt /*- 5df930be7Sderaadt * Copyright (c) 1989, 1993 6df930be7Sderaadt * The Regents of the University of California. All rights reserved. 7df930be7Sderaadt * (c) UNIX System Laboratories, Inc. 8df930be7Sderaadt * All or some portions of this file are derived from material licensed 9df930be7Sderaadt * to the University of California by American Telephone and Telegraph 10df930be7Sderaadt * Co. or Unix System Laboratories, Inc. and are reproduced herein with 11df930be7Sderaadt * the permission of UNIX System Laboratories, Inc. 12df930be7Sderaadt * 13df930be7Sderaadt * Redistribution and use in source and binary forms, with or without 14df930be7Sderaadt * modification, are permitted provided that the following conditions 15df930be7Sderaadt * are met: 16df930be7Sderaadt * 1. Redistributions of source code must retain the above copyright 17df930be7Sderaadt * notice, this list of conditions and the following disclaimer. 18df930be7Sderaadt * 2. Redistributions in binary form must reproduce the above copyright 19df930be7Sderaadt * notice, this list of conditions and the following disclaimer in the 20df930be7Sderaadt * documentation and/or other materials provided with the distribution. 21e33d3bd3Smillert * 3. Neither the name of the University nor the names of its contributors 22df930be7Sderaadt * may be used to endorse or promote products derived from this software 23df930be7Sderaadt * without specific prior written permission. 24df930be7Sderaadt * 25df930be7Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26df930be7Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27df930be7Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28df930be7Sderaadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29df930be7Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30df930be7Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31df930be7Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32df930be7Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33df930be7Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34df930be7Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35df930be7Sderaadt * SUCH DAMAGE. 36df930be7Sderaadt * 37df930be7Sderaadt * @(#)grp.h 8.2 (Berkeley) 1/21/94 38df930be7Sderaadt */ 39df930be7Sderaadt 40df930be7Sderaadt #ifndef _GRP_H_ 41df930be7Sderaadt #define _GRP_H_ 42df930be7Sderaadt 437602f5f9Sderaadt #include <sys/types.h> 447602f5f9Sderaadt 4552a0e603Smillert #if __BSD_VISIBLE 46df930be7Sderaadt #define _PATH_GROUP "/etc/group" 47cabdb1caSsthen #define _GR_BUF_LEN (1024+200*sizeof(char*)) 48df930be7Sderaadt #endif 49df930be7Sderaadt 50df930be7Sderaadt struct group { 51df930be7Sderaadt char *gr_name; /* group name */ 52df930be7Sderaadt char *gr_passwd; /* group password */ 533a4d0b15Smillert gid_t gr_gid; /* group id */ 54df930be7Sderaadt char **gr_mem; /* group members */ 55df930be7Sderaadt }; 56df930be7Sderaadt 57df930be7Sderaadt __BEGIN_DECLS 58c72b5b24Smillert struct group *getgrgid(gid_t); 59c72b5b24Smillert struct group *getgrnam(const char *); 602c79e7ccSguenther #if __BSD_VISIBLE || __XPG_VISIBLE 61c72b5b24Smillert struct group *getgrent(void); 62c72b5b24Smillert void setgrent(void); 63c72b5b24Smillert void endgrent(void); 642c79e7ccSguenther #endif 652c79e7ccSguenther #if __BSD_VISIBLE || __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE 6652a0e603Smillert int getgrgid_r(gid_t, struct group *, char *, 6752a0e603Smillert size_t, struct group **); 6852a0e603Smillert int getgrnam_r(const char *, struct group *, char *, 6952a0e603Smillert size_t, struct group **); 7052a0e603Smillert #endif 7152a0e603Smillert #if __BSD_VISIBLE 72c72b5b24Smillert int setgroupent(int); 73*5a122e6eSmillert int gid_from_group(const char *, gid_t *); 74*5a122e6eSmillert const char *group_from_gid(gid_t, int); 7552a0e603Smillert #endif 76df930be7Sderaadt __END_DECLS 77df930be7Sderaadt 78df930be7Sderaadt #endif /* !_GRP_H_ */ 79