Print this page
12306 XPG4v2 slave pty behaviour should generally be disabled
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Change-ID: I7ccd399c22866f34dd20c6bb9d28e77ba4e24c67
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 *
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 */
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21
22 22 /*
23 23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 24 * Copyright (c) 2013 Gary Mills
25 25 *
26 26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
27 27 */
28 28
29 29 /*
30 30 * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
31 - * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
31 + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
32 32 */
33 33
34 34 /* Copyright (c) 1988 AT&T */
35 35 /* All Rights Reserved */
36 36
37 37 #ifndef _STDLIB_H
38 38 #define _STDLIB_H
39 39
40 40 #include <iso/stdlib_iso.h>
41 41 #include <iso/stdlib_c99.h>
42 42 #include <iso/stdlib_c11.h>
43 43
44 44 #if defined(__EXTENSIONS__) || defined(_XPG4)
45 45 #include <sys/wait.h>
46 46 #endif
47 47
48 48 /*
49 49 * Allow global visibility for symbols defined in
50 50 * C++ "std" namespace in <iso/stdlib_iso.h>.
51 51 */
52 52 #if __cplusplus >= 199711L
53 53 using std::div_t;
54 54 using std::ldiv_t;
55 55 using std::size_t;
56 56 using std::abort;
57 57 using std::abs;
58 58 using std::atexit;
59 59 using std::atof;
60 60 using std::atoi;
61 61 using std::atol;
62 62 using std::bsearch;
63 63 using std::calloc;
64 64 using std::div;
65 65 using std::exit;
66 66 using std::free;
67 67 using std::getenv;
68 68 using std::labs;
69 69 using std::ldiv;
70 70 using std::malloc;
71 71 using std::mblen;
72 72 using std::mbstowcs;
73 73 using std::mbtowc;
74 74 using std::qsort;
75 75 using std::rand;
76 76 using std::realloc;
77 77 using std::srand;
78 78 using std::strtod;
79 79 using std::strtol;
80 80 using std::strtoul;
81 81 using std::system;
82 82 using std::wcstombs;
83 83 using std::wctomb;
84 84 #endif
85 85
86 86 /*
87 87 * Allow global visibility for symbols defined in
88 88 * C++ "std" namespace in <iso/stdlib_c11.h>.
89 89 */
90 90 #if __cplusplus >= 201103L
91 91 using std::at_quick_exit;
92 92 using std::quick_exit;
93 93 #endif
94 94 #if __cplusplus >= 201703L
95 95 using std::aligned_alloc;
96 96 #endif
97 97
98 98 #ifdef __cplusplus
99 99 extern "C" {
100 100 #endif
101 101
102 102 #ifndef _UID_T
103 103 #define _UID_T
104 104 typedef unsigned int uid_t; /* UID type */
105 105 #endif /* !_UID_T */
106 106
107 107 /* large file compilation environment setup */
108 108 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
109 109
110 110 #ifdef __PRAGMA_REDEFINE_EXTNAME
111 111 #pragma redefine_extname mkstemp mkstemp64
112 112 #pragma redefine_extname mkstemps mkstemps64
113 113 #pragma redefine_extname mkostemp mkostemp64
114 114 #pragma redefine_extname mkostemps mkostemps64
115 115 #else /* __PRAGMA_REDEFINE_EXTNAME */
116 116 #define mkstemp mkstemp64
117 117 #define mkstemps mkstemps64
118 118 #define mkostemp mkostemp64
119 119 #define mkostemps mkostemps64
120 120 #endif /* __PRAGMA_REDEFINE_EXTNAME */
121 121
122 122 #endif /* _FILE_OFFSET_BITS == 64 */
123 123
124 124 /* In the LP64 compilation environment, all APIs are already large file */
125 125 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
126 126
127 127 #ifdef __PRAGMA_REDEFINE_EXTNAME
128 128 #pragma redefine_extname mkstemp64 mkstemp
129 129 #pragma redefine_extname mkstemps64 mkstemps
130 130 #pragma redefine_extname mkostemp64 mkostemp
131 131 #pragma redefine_extname mkostemps64 mkostemps
132 132 #else /* __PRAGMA_REDEFINE_EXTNAME */
133 133 #define mkstemp64 mkstemp
134 134 #define mkstemps64 mkstemps
135 135 #define mkostemp64 mkostemp
136 136 #define mkostemps64 mkostemps
137 137 #endif /* __PRAGMA_REDEFINE_EXTNAME */
138 138
139 139 #endif /* _LP64 && _LARGEFILE64_SOURCE */
140 140
141 141 #if defined(__EXTENSIONS__) || \
142 142 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
143 143 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
144 144 extern int rand_r(unsigned int *);
145 145 #endif
146 146
147 147 extern void _exithandle(void);
148 148
149 149 #if defined(__EXTENSIONS__) || \
150 150 (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
151 151 defined(_XPG4)
152 152 extern double drand48(void);
153 153 extern double erand48(unsigned short *);
154 154 extern long jrand48(unsigned short *);
155 155 extern void lcong48(unsigned short *);
156 156 extern long lrand48(void);
157 157 extern long mrand48(void);
158 158 extern long nrand48(unsigned short *);
159 159 extern unsigned short *seed48(unsigned short *);
160 160 extern void srand48(long);
161 161 extern int putenv(char *);
162 162 extern void setkey(const char *);
163 163 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
164 164
165 165 /*
166 166 * swab() has historically been in <stdlib.h> as delivered from AT&T
167 167 * and continues to be visible in the default compilation environment.
168 168 * As of Issue 4 of the X/Open Portability Guides, swab() was declared
169 169 * in <unistd.h>. As a result, with respect to X/Open namespace the
170 170 * swab() declaration in this header is only visible for the XPG3
171 171 * environment.
172 172 */
173 173 #if (defined(__EXTENSIONS__) || \
174 174 (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \
175 175 (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4)))
176 176 #ifndef _SSIZE_T
177 177 #define _SSIZE_T
178 178 #if defined(_LP64) || defined(_I32LPx)
179 179 typedef long ssize_t; /* size of something in bytes or -1 */
180 180 #else
181 181 typedef int ssize_t; /* (historical version) */
182 182 #endif
183 183 #endif /* !_SSIZE_T */
184 184
185 185 extern void swab(const char *, char *, ssize_t);
186 186 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
187 187
188 188 #if defined(__EXTENSIONS__) || \
189 189 !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
190 190 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64)
191 191 extern int mkstemp(char *);
192 192 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
193 193 extern int mkstemps(char *, int);
194 194 #endif
195 195 #endif /* defined(__EXTENSIONS__) ... */
196 196
197 197 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
198 198 !defined(__PRAGMA_REDEFINE_EXTNAME))
199 199 extern int mkstemp64(char *);
200 200 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
201 201 extern int mkstemps64(char *, int);
202 202 #endif
203 203 #endif /* _LARGEFILE64_SOURCE... */
204 204
205 205 #if !defined(_STRICT_SYMBOLS) || defined(_XPG7)
206 206 extern char *mkdtemp(char *);
207 207 #endif /* !defined(_STRICT_SYMBOLS) || defined(_XPG7) */
208 208
209 209 #if !defined(_STRICT_SYMBOLS)
210 210 extern int mkostemp(char *, int);
211 211 extern int mkostemps(char *, int, int);
212 212 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
213 213 !defined(__PRAGMA_REDEFINE_EXTNAME))
214 214 extern int mkostemp64(char *, int);
215 215 extern int mkostemps64(char *, int, int);
216 216 #endif /* defined(_LARGEFILE64_SOURCE) || !((_FILE_OFFSET_BITS == 64) ... */
217 217 #endif /* !defined(_STRICT_SYMBOLS) */
218 218
219 219 #if defined(__EXTENSIONS__) || \
220 220 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
221 221 defined(_XPG4_2)
222 222 extern long a64l(const char *);
223 223 extern char *ecvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
224 224 extern char *fcvt(double, int, int *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
225 225 extern char *gcvt(double, int, char *);
226 226 extern int getsubopt(char **, char *const *, char **);
227 227 extern int grantpt(int);
228 228 extern char *initstate(unsigned, char *, size_t);
229 229 extern char *l64a(long);
230 230 extern char *mktemp(char *);
231 231 extern char *ptsname(int);
232 232 extern long random(void);
233 233 extern char *realpath(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
234 234 extern char *setstate(const char *);
235 235 extern void srandom(unsigned);
236 236 extern int unlockpt(int);
237 237 /* Marked LEGACY in SUSv2 and removed in SUSv3 */
238 238 #if !defined(_XPG6) || defined(__EXTENSIONS__)
239 239 extern int ttyslot(void);
240 240 extern void *valloc(size_t);
241 241 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
242 242 #endif /* defined(__EXTENSIONS__) || ... || defined(_XPG4_2) */
↓ open down ↓ |
201 lines elided |
↑ open up ↑ |
243 243
244 244 #if defined(__EXTENSIONS__) || \
245 245 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
246 246 defined(_XPG6)
247 247 extern int posix_memalign(void **, size_t, size_t);
248 248 extern int posix_openpt(int);
249 249 extern int setenv(const char *, const char *, int);
250 250 extern int unsetenv(const char *);
251 251 #endif
252 252
253 +/*
254 + * In strict XPG4v2 mode, slave pseudo terminal devices behave differently.
255 + * See the block comment in usr/src/lib/libc/port/gen/pt.c
256 + */
257 +#if defined(_STRICT_SYMBOLS) && defined(_XPG4_2)
258 +#ifdef __PRAGMA_REDEFINE_EXTNAME
259 +#pragma redefine_extname unlockpt __unlockpt_xpg4
260 +#else
261 +extern int __unlockpt_xpg4(int);
262 +#define unlockpt __unlockpt_xpg4
263 +#endif
264 +#endif /* defined(_STRICT_SYMBOLS) && defined(_XPG4_2) */
265 +
253 266 #if defined(__EXTENSIONS__) || \
254 267 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
255 268 extern char *canonicalize_file_name(const char *);
256 269 extern int clearenv(void);
257 270 extern void closefrom(int);
258 271 extern int daemon(int, int);
259 272 extern int dup2(int, int);
260 273 extern int dup3(int, int, int);
261 274 extern int fdwalk(int (*)(void *, int), void *);
262 275 extern char *qecvt(long double, int, int *, int *);
263 276 extern char *qfcvt(long double, int, int *, int *);
264 277 extern char *qgcvt(long double, int, char *);
265 278 extern char *getcwd(char *, size_t);
266 279 extern const char *getexecname(void);
267 280
268 281 #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in unistd.h */
269 282 #define __GETLOGIN_DEFINED
270 283 #ifndef __USE_LEGACY_LOGNAME__
271 284 #ifdef __PRAGMA_REDEFINE_EXTNAME
272 285 #pragma redefine_extname getlogin getloginx
273 286 #else /* __PRAGMA_REDEFINE_EXTNAME */
274 287 extern char *getloginx(void);
275 288 #define getlogin getloginx
276 289 #endif /* __PRAGMA_REDEFINE_EXTNAME */
277 290 #endif /* __USE_LEGACY_LOGNAME__ */
278 291 extern char *getlogin(void);
279 292 #endif /* __GETLOGIN_DEFINED */
280 293
281 294 extern int getopt(int, char *const *, const char *);
282 295 extern char *optarg;
283 296 extern int optind, opterr, optopt;
284 297 extern char *getpass(const char *);
285 298 extern char *getpassphrase(const char *);
286 299 extern int getpw(uid_t, char *);
287 300 extern int isatty(int);
288 301 extern void *memalign(size_t, size_t);
289 302 extern char *ttyname(int);
290 303 extern char *mkdtemp(char *);
291 304 extern const char *getprogname(void);
292 305 extern void setprogname(const char *);
293 306
294 307 #if !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE)
295 308 extern char *lltostr(long long, char *);
296 309 extern char *ulltostr(unsigned long long, char *);
297 310 #endif /* !defined(_STRICT_STDC) && defined(_LONGLONG_TYPE) */
298 311
299 312 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
300 313
301 314 /* OpenBSD compatibility functions */
302 315 #if !defined(_STRICT_SYMBOLS)
303 316
304 317 #include <inttypes.h>
305 318 extern uint32_t arc4random(void);
306 319 extern void arc4random_buf(void *, size_t);
307 320 extern uint32_t arc4random_uniform(uint32_t);
308 321 extern void freezero(void *, size_t);
309 322 extern void *reallocarray(void *, size_t, size_t);
310 323 extern void *recallocarray(void *, size_t, size_t, size_t);
311 324 extern long long strtonum(const char *, long long, long long, const char **);
312 325 extern void *reallocf(void *, size_t);
313 326
314 327 #endif /* !_STRICT_SYBMOLS */
315 328
316 329
317 330 #ifdef __cplusplus
318 331 }
319 332 #endif
320 333
321 334 #endif /* _STDLIB_H */
↓ open down ↓ |
59 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX