Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/stdlib.h
+++ new/usr/src/head/stdlib.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 + * Copyright (c) 2013 Gary Mills
24 + *
23 25 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 26 */
25 27
26 28 /* Copyright (c) 1988 AT&T */
27 29 /* All Rights Reserved */
28 30
29 31 #ifndef _STDLIB_H
30 32 #define _STDLIB_H
31 33
32 34 #include <iso/stdlib_iso.h>
33 35 #include <iso/stdlib_c99.h>
34 36
35 37 #if defined(__EXTENSIONS__) || defined(_XPG4)
36 38 #include <sys/wait.h>
37 39 #endif
38 40
39 41 /*
40 42 * Allow global visibility for symbols defined in
41 43 * C++ "std" namespace in <iso/stdlib_iso.h>.
42 44 */
43 45 #if __cplusplus >= 199711L
44 46 using std::div_t;
45 47 using std::ldiv_t;
46 48 using std::size_t;
47 49 using std::abort;
48 50 using std::abs;
49 51 using std::atexit;
50 52 using std::atof;
51 53 using std::atoi;
52 54 using std::atol;
53 55 using std::bsearch;
54 56 using std::calloc;
55 57 using std::div;
56 58 using std::exit;
57 59 using std::free;
58 60 using std::getenv;
59 61 using std::labs;
60 62 using std::ldiv;
61 63 using std::malloc;
62 64 using std::mblen;
63 65 using std::mbstowcs;
64 66 using std::mbtowc;
65 67 using std::qsort;
66 68 using std::rand;
67 69 using std::realloc;
68 70 using std::srand;
69 71 using std::strtod;
70 72 using std::strtol;
71 73 using std::strtoul;
72 74 using std::system;
73 75 using std::wcstombs;
74 76 using std::wctomb;
75 77 #endif
76 78
77 79 #ifdef __cplusplus
78 80 extern "C" {
79 81 #endif
80 82
81 83 #ifndef _UID_T
82 84 #define _UID_T
83 85 typedef unsigned int uid_t; /* UID type */
84 86 #endif /* !_UID_T */
85 87
86 88 #if defined(__STDC__)
87 89
88 90 /* large file compilation environment setup */
89 91 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
90 92
91 93 #ifdef __PRAGMA_REDEFINE_EXTNAME
92 94 #pragma redefine_extname mkstemp mkstemp64
93 95 #pragma redefine_extname mkstemps mkstemps64
94 96 #else /* __PRAGMA_REDEFINE_EXTNAME */
95 97 #define mkstemp mkstemp64
96 98 #define mkstemps mkstemps64
97 99 #endif /* __PRAGMA_REDEFINE_EXTNAME */
98 100
99 101 #endif /* _FILE_OFFSET_BITS == 64 */
100 102
101 103 /* In the LP64 compilation environment, all APIs are already large file */
102 104 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
103 105
104 106 #ifdef __PRAGMA_REDEFINE_EXTNAME
105 107 #pragma redefine_extname mkstemp64 mkstemp
106 108 #pragma redefine_extname mkstemps64 mkstemps
107 109 #else /* __PRAGMA_REDEFINE_EXTNAME */
108 110 #define mkstemp64 mkstemp
109 111 #define mkstemps64 mkstemps
110 112 #endif /* __PRAGMA_REDEFINE_EXTNAME */
111 113
112 114 #endif /* _LP64 && _LARGEFILE64_SOURCE */
113 115
114 116 #if defined(__EXTENSIONS__) || \
115 117 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
116 118 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
117 119 extern int rand_r(unsigned int *);
118 120 #endif
119 121
120 122 extern void _exithandle(void);
121 123
122 124 #if defined(__EXTENSIONS__) || \
123 125 (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
124 126 defined(_XPG4)
125 127 extern double drand48(void);
126 128 extern double erand48(unsigned short *);
127 129 extern long jrand48(unsigned short *);
128 130 extern void lcong48(unsigned short *);
129 131 extern long lrand48(void);
130 132 extern long mrand48(void);
131 133 extern long nrand48(unsigned short *);
132 134 extern unsigned short *seed48(unsigned short *);
133 135 extern void srand48(long);
134 136 extern int putenv(char *);
135 137 extern void setkey(const char *);
136 138 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
137 139
138 140 /*
139 141 * swab() has historically been in <stdlib.h> as delivered from AT&T
140 142 * and continues to be visible in the default compilation environment.
141 143 * As of Issue 4 of the X/Open Portability Guides, swab() was declared
142 144 * in <unistd.h>. As a result, with respect to X/Open namespace the
143 145 * swab() declaration in this header is only visible for the XPG3
144 146 * environment.
145 147 */
146 148 #if (defined(__EXTENSIONS__) || \
147 149 (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \
148 150 (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4)))
149 151 #ifndef _SSIZE_T
150 152 #define _SSIZE_T
151 153 #if defined(_LP64) || defined(_I32LPx)
152 154 typedef long ssize_t; /* size of something in bytes or -1 */
153 155 #else
154 156 typedef int ssize_t; /* (historical version) */
155 157 #endif
156 158 #endif /* !_SSIZE_T */
157 159
158 160 extern void swab(const char *, char *, ssize_t);
159 161 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
160 162
161 163 #if defined(__EXTENSIONS__) || \
162 164 !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
163 165 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64)
164 166 extern int mkstemp(char *);
165 167 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
166 168 extern int mkstemps(char *, int);
167 169 #endif
168 170 #endif /* defined(__EXTENSIONS__) ... */
169 171
170 172 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
171 173 !defined(__PRAGMA_REDEFINE_EXTNAME))
172 174 extern int mkstemp64(char *);
173 175 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
174 176 extern int mkstemps64(char *, int);
175 177 #endif
176 178 #endif /* _LARGEFILE64_SOURCE... */
177 179
178 180 #if defined(__EXTENSIONS__) || \
179 181 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
180 182 defined(_XPG4_2)
181 183 extern long a64l(const char *);
182 184 extern char *ecvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
183 185 extern char *fcvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
184 186 extern char *gcvt(double, int, char *);
185 187 extern int getsubopt(char **, char *const *, char **);
186 188 extern int grantpt(int);
187 189 extern char *initstate(unsigned, char *, size_t);
188 190 extern char *l64a(long);
189 191 extern char *mktemp(char *);
190 192 extern char *ptsname(int);
191 193 extern long random(void);
192 194 extern char *realpath(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
193 195 extern char *setstate(const char *);
194 196 extern void srandom(unsigned);
195 197 extern int unlockpt(int);
196 198 /* Marked LEGACY in SUSv2 and removed in SUSv3 */
197 199 #if !defined(_XPG6) || defined(__EXTENSIONS__)
198 200 extern int ttyslot(void);
199 201 extern void *valloc(size_t);
200 202 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
201 203 #endif /* defined(__EXTENSIONS__) || ... || defined(_XPG4_2) */
202 204
203 205 #if defined(__EXTENSIONS__) || \
204 206 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
205 207 defined(_XPG6)
206 208 extern int posix_memalign(void **, size_t, size_t);
207 209 extern int posix_openpt(int);
208 210 extern int setenv(const char *, const char *, int);
209 211 extern int unsetenv(const char *);
210 212 #endif
211 213
212 214 #if defined(__EXTENSIONS__) || \
213 215 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
214 216 extern char *canonicalize_file_name(const char *);
↓ open down ↓ |
182 lines elided |
↑ open up ↑ |
215 217 extern int clearenv(void);
216 218 extern void closefrom(int);
217 219 extern int daemon(int, int);
218 220 extern int dup2(int, int);
219 221 extern int fdwalk(int (*)(void *, int), void *);
220 222 extern char *qecvt(long double, int, int *, int *);
221 223 extern char *qfcvt(long double, int, int *, int *);
222 224 extern char *qgcvt(long double, int, char *);
223 225 extern char *getcwd(char *, size_t);
224 226 extern const char *getexecname(void);
227 +
228 +#ifndef __GETLOGIN_DEFINED /* Avoid duplicate in unistd.h */
229 +#define __GETLOGIN_DEFINED
230 +#ifndef __USE_LEGACY_LOGNAME__
231 +#ifdef __PRAGMA_REDEFINE_EXTNAME
232 +#pragma redefine_extname getlogin getloginx
233 +#else /* __PRAGMA_REDEFINE_EXTNAME */
234 +extern char *getloginx(void);
235 +#define getlogin getloginx
236 +#endif /* __PRAGMA_REDEFINE_EXTNAME */
237 +#endif /* __USE_LEGACY_LOGNAME__ */
225 238 extern char *getlogin(void);
239 +#endif /* __GETLOGIN_DEFINED */
240 +
226 241 extern int getopt(int, char *const *, const char *);
227 242 extern char *optarg;
228 243 extern int optind, opterr, optopt;
229 244 extern char *getpass(const char *);
230 245 extern char *getpassphrase(const char *);
231 246 extern int getpw(uid_t, char *);
232 247 extern int isatty(int);
233 248 extern void *memalign(size_t, size_t);
234 249 extern char *ttyname(int);
235 250 extern char *mkdtemp(char *);
236 251 extern const char *getprogname(void);
237 252 extern void setprogname(const char *);
238 253
239 254 #if !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE)
240 255 extern char *lltostr(long long, char *);
241 256 extern char *ulltostr(unsigned long long, char *);
242 257 #endif /* !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE) */
243 258
244 259 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
245 260
246 261 #else /* not __STDC__ */
247 262
248 263 #if defined(__EXTENSIONS__) || !defined(_XOPEN_OR_POSIX) || \
249 264 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
250 265 extern int rand_r();
251 266 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT) ... */
252 267
253 268 extern void _exithandle();
254 269
255 270 #if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || defined(_XPG4)
256 271 extern double drand48();
257 272 extern double erand48();
258 273 extern long jrand48();
259 274 extern void lcong48();
260 275 extern long lrand48();
261 276 extern long mrand48();
262 277 extern long nrand48();
263 278 extern unsigned short *seed48();
264 279 extern void srand48();
265 280 extern int putenv();
266 281 extern void setkey();
267 282 #endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
268 283
269 284 #if (defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE)) && \
270 285 (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4)))
271 286 extern void swab();
272 287 #endif
273 288
274 289 #if defined(__EXTENSIONS__) || \
275 290 !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
276 291 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64)
277 292 extern int mkstemp();
278 293 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
279 294 extern int mkstemps();
280 295 #endif
281 296 #endif /* defined(__EXTENSIONS__) ... */
282 297
283 298 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
284 299 !defined(__PRAGMA_REDEFINE_EXTNAME))
285 300 extern int mkstemp64();
286 301 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
287 302 extern int mkstemps64();
288 303 #endif
289 304 #endif /* _LARGEFILE64_SOURCE... */
290 305
291 306 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)
292 307 extern long a64l();
293 308 extern char *ecvt();
294 309 extern char *fcvt();
295 310 extern char *gcvt();
296 311 extern int getsubopt();
297 312 extern int grantpt();
298 313 extern char *initstate();
299 314 extern char *l64a();
300 315 extern char *mktemp();
301 316 extern char *ptsname();
302 317 extern long random();
303 318 extern char *realpath();
304 319 extern char *setstate();
305 320 extern void srandom();
306 321 /* Marked LEGACY in SUSv2 and removed in SUSv3 */
307 322 #if !defined(_XPG6) || defined(__EXTENSIONS__)
308 323 extern int ttyslot();
309 324 extern void *valloc();
310 325 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
311 326 #endif /* defined(__EXTENSIONS__) || ... || defined(_XPG4_2) */
312 327
313 328 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG6)
314 329 extern int posix_memalign();
315 330 extern int posix_openpt();
316 331 extern int setenv();
317 332 extern int unsetenv();
318 333 #endif
319 334
320 335 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
321 336 extern char *canonicalize_file_name();
↓ open down ↓ |
86 lines elided |
↑ open up ↑ |
322 337 extern int clearenv();
323 338 extern void closefrom();
324 339 extern int daemon();
325 340 extern int dup2();
326 341 extern int fdwalk();
327 342 extern char *qecvt();
328 343 extern char *qfcvt();
329 344 extern char *qgcvt();
330 345 extern char *getcwd();
331 346 extern char *getexecname();
347 +
348 +#ifndef __GETLOGIN_DEFINED /* Avoid duplicate in unistd.h */
349 +#define __GETLOGIN_DEFINED
350 +#ifndef __USE_LEGACY_LOGNAME__
351 +#ifdef __PRAGMA_REDEFINE_EXTNAME
352 +#pragma redefine_extname getlogin getloginx
353 +#else /* __PRAGMA_REDEFINE_EXTNAME */
354 +extern char *getloginx();
355 +#define getlogin getloginx
356 +#endif /* __PRAGMA_REDEFINE_EXTNAME */
357 +#endif /* __USE_LEGACY_LOGNAME__ */
332 358 extern char *getlogin();
359 +#endif /* __GETLOGIN_DEFINED */
360 +
333 361 extern int getopt();
334 362 extern char *optarg;
335 363 extern int optind, opterr, optopt;
336 364 extern char *getpass();
337 365 extern char *getpassphrase();
338 366 extern int getpw();
339 367 extern int isatty();
340 368 extern void *memalign();
341 369 extern char *ttyname();
342 370 extern char *mkdtemp();
343 371 extern char *getprogname();
344 372 extern void setprogname();
345 373
346 374 #if defined(_LONGLONG_TYPE)
347 375 extern char *lltostr();
348 376 extern char *ulltostr();
349 377 #endif /* defined(_LONGLONG_TYPE) */
350 378 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */
351 379
352 380 #endif /* __STDC__ */
353 381
354 382 #ifdef __cplusplus
355 383 }
356 384 #endif
357 385
358 386 #endif /* _STDLIB_H */
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX