324 need serbian locale support
[illumos-gate.git] / usr / src / head / grp.h
blob947328f91256a9dc9424c548891a186abdc5db77
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
31 #ifndef _GRP_H
32 #define _GRP_H
34 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.3.1 */
36 #include <sys/feature_tests.h>
38 #include <sys/types.h>
40 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
41 #include <stdio.h>
42 #endif
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
48 struct group { /* see getgrent(3C) */
49 char *gr_name;
50 char *gr_passwd;
51 gid_t gr_gid;
52 char **gr_mem;
55 #if defined(__STDC__)
57 extern struct group *getgrgid(gid_t); /* MT-unsafe */
58 extern struct group *getgrnam(const char *); /* MT-unsafe */
60 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
61 extern struct group *getgrent_r(struct group *, char *, int);
62 extern struct group *fgetgrent_r(FILE *, struct group *, char *, int);
65 extern struct group *fgetgrent(FILE *); /* MT-unsafe */
66 extern int initgroups(const char *, gid_t);
67 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
69 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)
70 extern void endgrent(void);
71 extern void setgrent(void);
72 extern struct group *getgrent(void); /* MT-unsafe */
73 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)... */
75 #else
77 extern struct group *getgrgid(); /* MT-unsafe */
78 extern struct group *getgrnam(); /* MT-unsafe */
80 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
81 extern struct group *getgrent_r();
82 extern struct group *fgetgrent_r();
84 extern struct group *fgetgrent(); /* MT-unsafe */
85 extern int initgroups();
86 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
88 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)
89 extern void endgrent();
90 extern void setgrent();
91 extern struct group *getgrent(); /* MT-unsafe */
92 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)... */
94 #endif /* __STDC__ */
98 * getgrgid_r() & getgrnam_r() prototypes are defined here.
102 * Previous releases of Solaris, starting at 2.3, provided definitions of
103 * various functions as specified in POSIX.1c, Draft 6. For some of these
104 * functions, the final POSIX 1003.1c standard had a different number of
105 * arguments and return values.
107 * The following segment of this header provides support for the standard
108 * interfaces while supporting applications written under earlier
109 * releases. The application defines appropriate values of the feature
110 * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
111 * whether it was written to expect the Draft 6 or standard versions of
112 * these interfaces, before including this header. This header then
113 * provides a mapping from the source version of the interface to an
114 * appropriate binary interface. Such mappings permit an application
115 * to be built from libraries and objects which have mixed expectations
116 * of the definitions of these functions.
118 * For applications using the Draft 6 definitions, the binary symbol is the
119 * same as the source symbol, and no explicit mapping is needed. For the
120 * standard interface, the function func() is mapped to the binary symbol
121 * _posix_func(). The preferred mechanism for the remapping is a compiler
122 * #pragma. If the compiler does not provide such a #pragma, the header file
123 * defines a static function func() which calls the _posix_func() version;
124 * this has to be done instead of #define since POSIX specifies that an
125 * application can #undef the symbol and still be bound to the correct
126 * implementation. Unfortunately, the statics confuse lint so we fallback to
127 * #define in that case.
129 * NOTE: Support for the Draft 6 definitions is provided for compatibility
130 * only. New applications/libraries should use the standard definitions.
133 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
134 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
136 #if defined(__STDC__)
138 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
140 #ifdef __PRAGMA_REDEFINE_EXTNAME
141 #pragma redefine_extname getgrgid_r __posix_getgrgid_r
142 #pragma redefine_extname getgrnam_r __posix_getgrnam_r
143 extern int getgrgid_r(gid_t, struct group *, char *, int, struct group **);
144 extern int getgrnam_r(const char *, struct group *, char *, int,
145 struct group **);
146 #else /* __PRAGMA_REDEFINE_EXTNAME */
148 extern int __posix_getgrgid_r(gid_t, struct group *, char *, size_t,
149 struct group **);
150 extern int __posix_getgrnam_r(const char *, struct group *, char *, size_t,
151 struct group **);
153 #ifdef __lint
155 #define getgrgid_r __posix_getgrgid_r
156 #define getgrnam_r __posix_getgrnam_r
158 #else /* !__lint */
160 static int
161 getgrgid_r(gid_t __gid, struct group *__grp, char *__buf, int __len,
162 struct group **__res)
164 return (__posix_getgrgid_r(__gid, __grp, __buf, __len, __res));
166 static int
167 getgrnam_r(const char *__cb, struct group *__grp, char *__buf, int __len,
168 struct group **__res)
170 return (__posix_getgrnam_r(__cb, __grp, __buf, __len, __res));
173 #endif /* !__lint */
174 #endif /* __PRAGMA_REDEFINE_EXTNAME */
176 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
178 extern struct group *getgrgid_r(gid_t, struct group *, char *, int);
179 extern struct group *getgrnam_r(const char *, struct group *, char *, int);
181 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
183 #else /* __STDC__ */
185 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
187 #ifdef __PRAGMA_REDEFINE_EXTNAME
188 #pragma redefine_extname getgrgid_r __posix_getgrgid_r
189 #pragma redefine_extname getgrnam_r __posix_getgrnam_r
190 extern int getgrgid_r();
191 extern int getgrnam_r();
192 #else /* __PRAGMA_REDEFINE_EXTNAME */
194 extern int __posix_getgrgid_r();
195 extern int __posix_getgrnam_r();
197 #ifdef __lint
199 #define getgrgid_r __posix_getgrgid_r
200 #define getgrnam_r __posix_getgrnam_r
202 #else /* !__lint */
204 static int
205 getgrgid_r(__gid, __grp, __buf, __len, __res)
206 gid_t __gid;
207 struct group *__grp;
208 char *__buf;
209 int __len;
210 struct group **__res;
212 return (__posix_getgrgid_r(__gid, __grp, __buf, __len, __res));
214 static int
215 getgrnam_r(__cb, __grp, __buf, __len, __res)
216 char *__cb;
217 struct group *__grp;
218 char *__buf;
219 int __len;
220 struct group **__res;
222 return (__posix_getgrnam_r(__cb, __grp, __buf, __len, __res));
225 #endif /* !__lint */
226 #endif /* __PRAGMA_REDEFINE_EXTNAME */
228 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
230 extern struct group *getgrgid_r();
231 extern struct group *getgrnam_r();
233 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
235 #endif /* __STDC__ */
237 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)... */
239 #ifdef __cplusplus
241 #endif
243 #endif /* _GRP_H */