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