1 /* 2 * reentr.h 3 * 4 * Copyright (C) 2002, 2003, by Larry Wall and others 5 * 6 * You may distribute under the terms of either the GNU General Public 7 * License or the Artistic License, as specified in the README file. 8 * 9 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! 10 * This file is built by reentrl.pl from data in reentr.pl. 11 */ 12 13 #ifndef REENTR_H 14 #define REENTR_H 15 16 #ifdef USE_REENTRANT_API 17 18 #ifdef PERL_CORE 19 # define PL_REENTRANT_RETINT PL_reentrant_retint 20 #endif 21 22 /* Deprecations: some platforms have the said reentrant interfaces 23 * but they are declared obsolete and are not to be used. Often this 24 * means that the platform has threadsafed the interfaces (hopefully). 25 * All this is OS version dependent, so we are of course fooling ourselves. 26 * If you know of more deprecations on some platforms, please add your own. */ 27 28 #ifdef __hpux 29 # undef HAS_CRYPT_R 30 # undef HAS_DRAND48_R 31 # undef HAS_ENDGRENT_R 32 # undef HAS_ENDPWENT_R 33 # undef HAS_GETGRENT_R 34 # undef HAS_GETPWENT_R 35 # undef HAS_SETLOCALE_R 36 # undef HAS_SRAND48_R 37 # undef HAS_STRERROR_R 38 # define NETDB_R_OBSOLETE 39 #endif 40 41 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */ 42 # undef HAS_CRYPT_R 43 # undef HAS_STRERROR_R 44 # define NETDB_R_OBSOLETE 45 #endif 46 47 #ifdef NETDB_R_OBSOLETE 48 # undef HAS_ENDHOSTENT_R 49 # undef HAS_ENDNETENT_R 50 # undef HAS_ENDPROTOENT_R 51 # undef HAS_ENDSERVENT_R 52 # undef HAS_GETHOSTBYADDR_R 53 # undef HAS_GETHOSTBYNAME_R 54 # undef HAS_GETHOSTENT_R 55 # undef HAS_GETNETBYADDR_R 56 # undef HAS_GETNETBYNAME_R 57 # undef HAS_GETNETENT_R 58 # undef HAS_GETPROTOBYNAME_R 59 # undef HAS_GETPROTOBYNUMBER_R 60 # undef HAS_GETPROTOENT_R 61 # undef HAS_GETSERVBYNAME_R 62 # undef HAS_GETSERVBYPORT_R 63 # undef HAS_GETSERVENT_R 64 # undef HAS_SETHOSTENT_R 65 # undef HAS_SETNETENT_R 66 # undef HAS_SETPROTOENT_R 67 # undef HAS_SETSERVENT_R 68 #endif 69 70 #ifdef I_PWD 71 # include <pwd.h> 72 #endif 73 #ifdef I_GRP 74 # include <grp.h> 75 #endif 76 #ifdef I_NETDB 77 # include <netdb.h> 78 #endif 79 #ifdef I_STDLIB 80 # include <stdlib.h> /* drand48_data */ 81 #endif 82 #ifdef I_CRYPT 83 # ifdef I_CRYPT 84 # include <crypt.h> 85 # endif 86 #endif 87 #ifdef HAS_GETSPNAM_R 88 # ifdef I_SHADOW 89 # include <shadow.h> 90 # endif 91 #endif 92 93 #define REENTRANT_PROTO_B_B 1 94 #define REENTRANT_PROTO_B_BI 2 95 #define REENTRANT_PROTO_B_BW 3 96 #define REENTRANT_PROTO_B_CCD 4 97 #define REENTRANT_PROTO_B_CCS 5 98 #define REENTRANT_PROTO_B_IBI 6 99 #define REENTRANT_PROTO_B_IBW 7 100 #define REENTRANT_PROTO_B_SB 8 101 #define REENTRANT_PROTO_B_SBI 9 102 #define REENTRANT_PROTO_I_BI 10 103 #define REENTRANT_PROTO_I_BW 11 104 #define REENTRANT_PROTO_I_CCSBWR 12 105 #define REENTRANT_PROTO_I_CCSD 13 106 #define REENTRANT_PROTO_I_CII 14 107 #define REENTRANT_PROTO_I_CIISD 15 108 #define REENTRANT_PROTO_I_CSBI 16 109 #define REENTRANT_PROTO_I_CSBIR 17 110 #define REENTRANT_PROTO_I_CSBWR 18 111 #define REENTRANT_PROTO_I_CSBWRE 19 112 #define REENTRANT_PROTO_I_CSD 20 113 #define REENTRANT_PROTO_I_CWISBWRE 21 114 #define REENTRANT_PROTO_I_CWISD 22 115 #define REENTRANT_PROTO_I_D 23 116 #define REENTRANT_PROTO_I_H 24 117 #define REENTRANT_PROTO_I_IBI 25 118 #define REENTRANT_PROTO_I_IBW 26 119 #define REENTRANT_PROTO_I_ICBI 27 120 #define REENTRANT_PROTO_I_ICSBWR 28 121 #define REENTRANT_PROTO_I_ICSD 29 122 #define REENTRANT_PROTO_I_ID 30 123 #define REENTRANT_PROTO_I_IISD 31 124 #define REENTRANT_PROTO_I_ISBWR 32 125 #define REENTRANT_PROTO_I_ISD 33 126 #define REENTRANT_PROTO_I_LISBI 34 127 #define REENTRANT_PROTO_I_LISD 35 128 #define REENTRANT_PROTO_I_LS 36 129 #define REENTRANT_PROTO_I_SB 37 130 #define REENTRANT_PROTO_I_SBI 38 131 #define REENTRANT_PROTO_I_SBIE 39 132 #define REENTRANT_PROTO_I_SBIH 40 133 #define REENTRANT_PROTO_I_SBIR 41 134 #define REENTRANT_PROTO_I_SBWR 42 135 #define REENTRANT_PROTO_I_SBWRE 43 136 #define REENTRANT_PROTO_I_SD 44 137 #define REENTRANT_PROTO_I_ST 45 138 #define REENTRANT_PROTO_I_St 46 139 #define REENTRANT_PROTO_I_TISD 47 140 #define REENTRANT_PROTO_I_TS 48 141 #define REENTRANT_PROTO_I_TSBI 49 142 #define REENTRANT_PROTO_I_TSBIR 50 143 #define REENTRANT_PROTO_I_TSBWR 51 144 #define REENTRANT_PROTO_I_TSR 52 145 #define REENTRANT_PROTO_I_TsISBWRE 53 146 #define REENTRANT_PROTO_I_UISBWRE 54 147 #define REENTRANT_PROTO_I_iS 55 148 #define REENTRANT_PROTO_I_lS 56 149 #define REENTRANT_PROTO_I_uISBWRE 57 150 #define REENTRANT_PROTO_S_CBI 58 151 #define REENTRANT_PROTO_S_CCSBI 59 152 #define REENTRANT_PROTO_S_CIISBIE 60 153 #define REENTRANT_PROTO_S_CSBI 61 154 #define REENTRANT_PROTO_S_CSBIE 62 155 #define REENTRANT_PROTO_S_CWISBIE 63 156 #define REENTRANT_PROTO_S_CWISBWIE 64 157 #define REENTRANT_PROTO_S_ICSBI 65 158 #define REENTRANT_PROTO_S_ISBI 66 159 #define REENTRANT_PROTO_S_LISBI 67 160 #define REENTRANT_PROTO_S_SBI 68 161 #define REENTRANT_PROTO_S_SBIE 69 162 #define REENTRANT_PROTO_S_SBW 70 163 #define REENTRANT_PROTO_S_TISBI 71 164 #define REENTRANT_PROTO_S_TS 72 165 #define REENTRANT_PROTO_S_TSBI 73 166 #define REENTRANT_PROTO_S_TSBIE 74 167 #define REENTRANT_PROTO_S_TWISBIE 75 168 #define REENTRANT_PROTO_V_D 76 169 #define REENTRANT_PROTO_V_H 77 170 #define REENTRANT_PROTO_V_ID 78 171 172 /* Defines for indicating which special features are supported. */ 173 174 /* The getgrent getgrgid getgrnam using buffer? */ 175 176 #if defined(HAS_GETGRENT_R) && (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIR || GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBW || GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIH) 177 # define GETGRENT_R_HAS_BUFFER 178 #else 179 # undef GETGRENT_R_HAS_BUFFER 180 #endif 181 #if defined(HAS_GETGRGID_R) && (GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBIR || GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBI || GETGRGID_R_PROTO == REENTRANT_PROTO_S_TSBI) 182 # define GETGRGID_R_HAS_BUFFER 183 #else 184 # undef GETGRGID_R_HAS_BUFFER 185 #endif 186 #if defined(HAS_GETGRNAM_R) && (GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR || GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CBI || GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBI || GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CSBI) 187 # define GETGRNAM_R_HAS_BUFFER 188 #else 189 # undef GETGRNAM_R_HAS_BUFFER 190 #endif 191 192 /* Any of the getgrent getgrgid getgrnam using buffer? */ 193 194 #if (defined(GETGRENT_R_HAS_BUFFER) || defined(GETGRGID_R_HAS_BUFFER) || defined(GETGRNAM_R_HAS_BUFFER)) 195 # define USE_GRENT_BUFFER 196 #else 197 # undef USE_GRENT_BUFFER 198 #endif 199 200 /* The getgrent getgrgid getgrnam using ptr? */ 201 202 #if defined(HAS_GETGRENT_R) && (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIR) 203 # define GETGRENT_R_HAS_PTR 204 #else 205 # undef GETGRENT_R_HAS_PTR 206 #endif 207 #if defined(HAS_GETGRGID_R) && (GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBIR) 208 # define GETGRGID_R_HAS_PTR 209 #else 210 # undef GETGRGID_R_HAS_PTR 211 #endif 212 #if defined(HAS_GETGRNAM_R) && (GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR) 213 # define GETGRNAM_R_HAS_PTR 214 #else 215 # undef GETGRNAM_R_HAS_PTR 216 #endif 217 218 /* Any of the getgrent getgrgid getgrnam using ptr? */ 219 220 #if (defined(GETGRENT_R_HAS_PTR) || defined(GETGRGID_R_HAS_PTR) || defined(GETGRNAM_R_HAS_PTR)) 221 # define USE_GRENT_PTR 222 #else 223 # undef USE_GRENT_PTR 224 #endif 225 226 /* The getpwent getpwnam getpwuid using ptr? */ 227 228 #if defined(HAS_GETPWENT_R) && (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIR) 229 # define GETPWENT_R_HAS_PTR 230 #else 231 # undef GETPWENT_R_HAS_PTR 232 #endif 233 #if defined(HAS_GETPWNAM_R) && (GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR) 234 # define GETPWNAM_R_HAS_PTR 235 #else 236 # undef GETPWNAM_R_HAS_PTR 237 #endif 238 #if defined(HAS_GETPWUID_R) && (GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBIR) 239 # define GETPWUID_R_HAS_PTR 240 #else 241 # undef GETPWUID_R_HAS_PTR 242 #endif 243 244 /* Any of the getpwent getpwnam getpwuid using ptr? */ 245 246 #if (defined(GETPWENT_R_HAS_PTR) || defined(GETPWNAM_R_HAS_PTR) || defined(GETPWUID_R_HAS_PTR)) 247 # define USE_PWENT_PTR 248 #else 249 # undef USE_PWENT_PTR 250 #endif 251 252 /* The getspent getspnam using ptr? */ 253 254 #if defined(HAS_GETSPNAM_R) && (GETSPNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR) 255 # define GETSPNAM_R_HAS_PTR 256 #else 257 # undef GETSPNAM_R_HAS_PTR 258 #endif 259 260 /* Any of the getspent getspnam using ptr? */ 261 262 #if (defined(GETSPENT_R_HAS_PTR) || defined(GETSPNAM_R_HAS_PTR)) 263 # define USE_SPENT_PTR 264 #else 265 # undef USE_SPENT_PTR 266 #endif 267 268 /* The getgrent getgrgid getgrnam setgrent endgrent using fptr? */ 269 270 #if defined(HAS_GETGRENT_R) && (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIH) 271 # define GETGRENT_R_HAS_FPTR 272 #else 273 # undef GETGRENT_R_HAS_FPTR 274 #endif 275 #if defined(HAS_SETGRENT_R) && (SETGRENT_R_PROTO == REENTRANT_PROTO_I_H || SETGRENT_R_PROTO == REENTRANT_PROTO_V_H) 276 # define SETGRENT_R_HAS_FPTR 277 #else 278 # undef SETGRENT_R_HAS_FPTR 279 #endif 280 #if defined(HAS_ENDGRENT_R) && (ENDGRENT_R_PROTO == REENTRANT_PROTO_I_H || ENDGRENT_R_PROTO == REENTRANT_PROTO_V_H) 281 # define ENDGRENT_R_HAS_FPTR 282 #else 283 # undef ENDGRENT_R_HAS_FPTR 284 #endif 285 286 /* Any of the getgrent getgrgid getgrnam setgrent endgrent using fptr? */ 287 288 #if (defined(GETGRENT_R_HAS_FPTR) || defined(GETGRGID_R_HAS_FPTR) || defined(GETGRNAM_R_HAS_FPTR) || defined(SETGRENT_R_HAS_FPTR) || defined(ENDGRENT_R_HAS_FPTR)) 289 # define USE_GRENT_FPTR 290 #else 291 # undef USE_GRENT_FPTR 292 #endif 293 294 /* The getpwent getpwnam getpwuid setpwent endpwent using fptr? */ 295 296 #if defined(HAS_GETPWENT_R) && (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIH) 297 # define GETPWENT_R_HAS_FPTR 298 #else 299 # undef GETPWENT_R_HAS_FPTR 300 #endif 301 #if defined(HAS_SETPWENT_R) && (SETPWENT_R_PROTO == REENTRANT_PROTO_I_H || SETPWENT_R_PROTO == REENTRANT_PROTO_V_H) 302 # define SETPWENT_R_HAS_FPTR 303 #else 304 # undef SETPWENT_R_HAS_FPTR 305 #endif 306 #if defined(HAS_ENDPWENT_R) && (ENDPWENT_R_PROTO == REENTRANT_PROTO_I_H || ENDPWENT_R_PROTO == REENTRANT_PROTO_V_H) 307 # define ENDPWENT_R_HAS_FPTR 308 #else 309 # undef ENDPWENT_R_HAS_FPTR 310 #endif 311 312 /* Any of the getpwent getpwnam getpwuid setpwent endpwent using fptr? */ 313 314 #if (defined(GETPWENT_R_HAS_FPTR) || defined(GETPWNAM_R_HAS_FPTR) || defined(GETPWUID_R_HAS_FPTR) || defined(SETPWENT_R_HAS_FPTR) || defined(ENDPWENT_R_HAS_FPTR)) 315 # define USE_PWENT_FPTR 316 #else 317 # undef USE_PWENT_FPTR 318 #endif 319 320 /* The getpwent getpwgid getpwnam using buffer? */ 321 322 #if defined(HAS_GETPWENT_R) && (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIR || GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBW || GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIH) 323 # define GETPWENT_R_HAS_BUFFER 324 #else 325 # undef GETPWENT_R_HAS_BUFFER 326 #endif 327 #if defined(HAS_GETPWNAM_R) && (GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR || GETPWNAM_R_PROTO == REENTRANT_PROTO_S_CSBI || GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBI) 328 # define GETPWNAM_R_HAS_BUFFER 329 #else 330 # undef GETPWNAM_R_HAS_BUFFER 331 #endif 332 333 /* Any of the getpwent getpwgid getpwnam using buffer? */ 334 335 #if (defined(GETPWENT_R_HAS_BUFFER) || defined(GETPWGID_R_HAS_BUFFER) || defined(GETPWNAM_R_HAS_BUFFER)) 336 # define USE_PWENT_BUFFER 337 #else 338 # undef USE_PWENT_BUFFER 339 #endif 340 341 /* The gethostent gethostbyaddr gethostbyname using ptr? */ 342 343 #if defined(HAS_GETHOSTENT_R) && (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE) 344 # define GETHOSTENT_R_HAS_PTR 345 #else 346 # undef GETHOSTENT_R_HAS_PTR 347 #endif 348 #if defined(HAS_GETHOSTBYADDR_R) && (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_TsISBWRE) 349 # define GETHOSTBYADDR_R_HAS_PTR 350 #else 351 # undef GETHOSTBYADDR_R_HAS_PTR 352 #endif 353 #if defined(HAS_GETHOSTBYNAME_R) && (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE) 354 # define GETHOSTBYNAME_R_HAS_PTR 355 #else 356 # undef GETHOSTBYNAME_R_HAS_PTR 357 #endif 358 359 /* Any of the gethostent gethostbyaddr gethostbyname using ptr? */ 360 361 #if (defined(GETHOSTENT_R_HAS_PTR) || defined(GETHOSTBYADDR_R_HAS_PTR) || defined(GETHOSTBYNAME_R_HAS_PTR)) 362 # define USE_HOSTENT_PTR 363 #else 364 # undef USE_HOSTENT_PTR 365 #endif 366 367 /* The getnetent getnetbyaddr getnetbyname using ptr? */ 368 369 #if defined(HAS_GETNETENT_R) && (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE) 370 # define GETNETENT_R_HAS_PTR 371 #else 372 # undef GETNETENT_R_HAS_PTR 373 #endif 374 #if defined(HAS_GETNETBYADDR_R) && (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_uISBWRE) 375 # define GETNETBYADDR_R_HAS_PTR 376 #else 377 # undef GETNETBYADDR_R_HAS_PTR 378 #endif 379 #if defined(HAS_GETNETBYNAME_R) && (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE) 380 # define GETNETBYNAME_R_HAS_PTR 381 #else 382 # undef GETNETBYNAME_R_HAS_PTR 383 #endif 384 385 /* Any of the getnetent getnetbyaddr getnetbyname using ptr? */ 386 387 #if (defined(GETNETENT_R_HAS_PTR) || defined(GETNETBYADDR_R_HAS_PTR) || defined(GETNETBYNAME_R_HAS_PTR)) 388 # define USE_NETENT_PTR 389 #else 390 # undef USE_NETENT_PTR 391 #endif 392 393 /* The getprotoent getprotobyname getprotobynumber using ptr? */ 394 395 #if defined(HAS_GETPROTOENT_R) && (GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBWR) 396 # define GETPROTOENT_R_HAS_PTR 397 #else 398 # undef GETPROTOENT_R_HAS_PTR 399 #endif 400 #if defined(HAS_GETPROTOBYNAME_R) && (GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWR) 401 # define GETPROTOBYNAME_R_HAS_PTR 402 #else 403 # undef GETPROTOBYNAME_R_HAS_PTR 404 #endif 405 #if defined(HAS_GETPROTOBYNUMBER_R) && (GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISBWR) 406 # define GETPROTOBYNUMBER_R_HAS_PTR 407 #else 408 # undef GETPROTOBYNUMBER_R_HAS_PTR 409 #endif 410 411 /* Any of the getprotoent getprotobyname getprotobynumber using ptr? */ 412 413 #if (defined(GETPROTOENT_R_HAS_PTR) || defined(GETPROTOBYNAME_R_HAS_PTR) || defined(GETPROTOBYNUMBER_R_HAS_PTR)) 414 # define USE_PROTOENT_PTR 415 #else 416 # undef USE_PROTOENT_PTR 417 #endif 418 419 /* The getservent getservbyname getservbyport using ptr? */ 420 421 #if defined(HAS_GETSERVENT_R) && (GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBWR) 422 # define GETSERVENT_R_HAS_PTR 423 #else 424 # undef GETSERVENT_R_HAS_PTR 425 #endif 426 #if defined(HAS_GETSERVBYNAME_R) && (GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSBWR) 427 # define GETSERVBYNAME_R_HAS_PTR 428 #else 429 # undef GETSERVBYNAME_R_HAS_PTR 430 #endif 431 #if defined(HAS_GETSERVBYPORT_R) && (GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSBWR) 432 # define GETSERVBYPORT_R_HAS_PTR 433 #else 434 # undef GETSERVBYPORT_R_HAS_PTR 435 #endif 436 437 /* Any of the getservent getservbyname getservbyport using ptr? */ 438 439 #if (defined(GETSERVENT_R_HAS_PTR) || defined(GETSERVBYNAME_R_HAS_PTR) || defined(GETSERVBYPORT_R_HAS_PTR)) 440 # define USE_SERVENT_PTR 441 #else 442 # undef USE_SERVENT_PTR 443 #endif 444 445 /* The gethostent gethostbyaddr gethostbyname using buffer? */ 446 447 #if defined(HAS_GETHOSTENT_R) && (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBIE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBI) 448 # define GETHOSTENT_R_HAS_BUFFER 449 #else 450 # undef GETHOSTENT_R_HAS_BUFFER 451 #endif 452 #if defined(HAS_GETHOSTBYADDR_R) && (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBWIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CIISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_TsISBWRE) 453 # define GETHOSTBYADDR_R_HAS_BUFFER 454 #else 455 # undef GETHOSTBYADDR_R_HAS_BUFFER 456 #endif 457 #if defined(HAS_GETHOSTBYNAME_R) && (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE || GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBIE) 458 # define GETHOSTBYNAME_R_HAS_BUFFER 459 #else 460 # undef GETHOSTBYNAME_R_HAS_BUFFER 461 #endif 462 463 /* Any of the gethostent gethostbyaddr gethostbyname using buffer? */ 464 465 #if (defined(GETHOSTENT_R_HAS_BUFFER) || defined(GETHOSTBYADDR_R_HAS_BUFFER) || defined(GETHOSTBYNAME_R_HAS_BUFFER)) 466 # define USE_HOSTENT_BUFFER 467 #else 468 # undef USE_HOSTENT_BUFFER 469 #endif 470 471 /* The getnetent getnetbyaddr getnetbyname using buffer? */ 472 473 #if defined(HAS_GETNETENT_R) && (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBIE || GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBI) 474 # define GETNETENT_R_HAS_BUFFER 475 #else 476 # undef GETNETENT_R_HAS_BUFFER 477 #endif 478 #if defined(HAS_GETNETBYADDR_R) && (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_LISBI || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_TISBI || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_LISBI || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_uISBWRE) 479 # define GETNETBYADDR_R_HAS_BUFFER 480 #else 481 # undef GETNETBYADDR_R_HAS_BUFFER 482 #endif 483 #if defined(HAS_GETNETBYNAME_R) && (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE || GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBI || GETNETBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI) 484 # define GETNETBYNAME_R_HAS_BUFFER 485 #else 486 # undef GETNETBYNAME_R_HAS_BUFFER 487 #endif 488 489 /* Any of the getnetent getnetbyaddr getnetbyname using buffer? */ 490 491 #if (defined(GETNETENT_R_HAS_BUFFER) || defined(GETNETBYADDR_R_HAS_BUFFER) || defined(GETNETBYNAME_R_HAS_BUFFER)) 492 # define USE_NETENT_BUFFER 493 #else 494 # undef USE_NETENT_BUFFER 495 #endif 496 497 /* The getprotoent getprotobyname getprotobynumber using buffer? */ 498 499 #if defined(HAS_GETPROTOENT_R) && (GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETPROTOENT_R_PROTO == REENTRANT_PROTO_S_SBI) 500 # define GETPROTOENT_R_HAS_BUFFER 501 #else 502 # undef GETPROTOENT_R_HAS_BUFFER 503 #endif 504 #if defined(HAS_GETPROTOBYNAME_R) && (GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI) 505 # define GETPROTOBYNAME_R_HAS_BUFFER 506 #else 507 # undef GETPROTOBYNAME_R_HAS_BUFFER 508 #endif 509 #if defined(HAS_GETPROTOBYNUMBER_R) && (GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISBWR || GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_S_ISBI) 510 # define GETPROTOBYNUMBER_R_HAS_BUFFER 511 #else 512 # undef GETPROTOBYNUMBER_R_HAS_BUFFER 513 #endif 514 515 /* Any of the getprotoent getprotobyname getprotobynumber using buffer? */ 516 517 #if (defined(GETPROTOENT_R_HAS_BUFFER) || defined(GETPROTOBYNAME_R_HAS_BUFFER) || defined(GETPROTOBYNUMBER_R_HAS_BUFFER)) 518 # define USE_PROTOENT_BUFFER 519 #else 520 # undef USE_PROTOENT_BUFFER 521 #endif 522 523 /* The getservent getservbyname getservbyport using buffer? */ 524 525 #if defined(HAS_GETSERVENT_R) && (GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETSERVENT_R_PROTO == REENTRANT_PROTO_S_SBI) 526 # define GETSERVENT_R_HAS_BUFFER 527 #else 528 # undef GETSERVENT_R_HAS_BUFFER 529 #endif 530 #if defined(HAS_GETSERVBYNAME_R) && (GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSBWR || GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_S_CCSBI) 531 # define GETSERVBYNAME_R_HAS_BUFFER 532 #else 533 # undef GETSERVBYNAME_R_HAS_BUFFER 534 #endif 535 #if defined(HAS_GETSERVBYPORT_R) && (GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSBWR || GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_S_ICSBI) 536 # define GETSERVBYPORT_R_HAS_BUFFER 537 #else 538 # undef GETSERVBYPORT_R_HAS_BUFFER 539 #endif 540 541 /* Any of the getservent getservbyname getservbyport using buffer? */ 542 543 #if (defined(GETSERVENT_R_HAS_BUFFER) || defined(GETSERVBYNAME_R_HAS_BUFFER) || defined(GETSERVBYPORT_R_HAS_BUFFER)) 544 # define USE_SERVENT_BUFFER 545 #else 546 # undef USE_SERVENT_BUFFER 547 #endif 548 549 /* The gethostent gethostbyaddr gethostbyname using errno? */ 550 551 #if defined(HAS_GETHOSTENT_R) && (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBIE) 552 # define GETHOSTENT_R_HAS_ERRNO 553 #else 554 # undef GETHOSTENT_R_HAS_ERRNO 555 #endif 556 #if defined(HAS_GETHOSTBYADDR_R) && (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBWIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CIISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_TsISBWRE) 557 # define GETHOSTBYADDR_R_HAS_ERRNO 558 #else 559 # undef GETHOSTBYADDR_R_HAS_ERRNO 560 #endif 561 #if defined(HAS_GETHOSTBYNAME_R) && (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE || GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBIE) 562 # define GETHOSTBYNAME_R_HAS_ERRNO 563 #else 564 # undef GETHOSTBYNAME_R_HAS_ERRNO 565 #endif 566 567 /* Any of the gethostent gethostbyaddr gethostbyname using errno? */ 568 569 #if (defined(GETHOSTENT_R_HAS_ERRNO) || defined(GETHOSTBYADDR_R_HAS_ERRNO) || defined(GETHOSTBYNAME_R_HAS_ERRNO)) 570 # define USE_HOSTENT_ERRNO 571 #else 572 # undef USE_HOSTENT_ERRNO 573 #endif 574 575 /* The getnetent getnetbyaddr getnetbyname using errno? */ 576 577 #if defined(HAS_GETNETENT_R) && (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBIE) 578 # define GETNETENT_R_HAS_ERRNO 579 #else 580 # undef GETNETENT_R_HAS_ERRNO 581 #endif 582 #if defined(HAS_GETNETBYADDR_R) && (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_uISBWRE) 583 # define GETNETBYADDR_R_HAS_ERRNO 584 #else 585 # undef GETNETBYADDR_R_HAS_ERRNO 586 #endif 587 #if defined(HAS_GETNETBYNAME_R) && (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE) 588 # define GETNETBYNAME_R_HAS_ERRNO 589 #else 590 # undef GETNETBYNAME_R_HAS_ERRNO 591 #endif 592 593 /* Any of the getnetent getnetbyaddr getnetbyname using errno? */ 594 595 #if (defined(GETNETENT_R_HAS_ERRNO) || defined(GETNETBYADDR_R_HAS_ERRNO) || defined(GETNETBYNAME_R_HAS_ERRNO)) 596 # define USE_NETENT_ERRNO 597 #else 598 # undef USE_NETENT_ERRNO 599 #endif 600 601 602 typedef struct { 603 #ifdef HAS_ASCTIME_R 604 char* _asctime_buffer; 605 size_t _asctime_size; 606 #endif /* HAS_ASCTIME_R */ 607 #ifdef HAS_CRYPT_R 608 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD 609 CRYPTD* _crypt_data; 610 #else 611 struct crypt_data _crypt_struct; 612 #endif 613 #endif /* HAS_CRYPT_R */ 614 #ifdef HAS_CTIME_R 615 char* _ctime_buffer; 616 size_t _ctime_size; 617 #endif /* HAS_CTIME_R */ 618 #ifdef HAS_DRAND48_R 619 struct drand48_data _drand48_struct; 620 double _drand48_double; 621 #endif /* HAS_DRAND48_R */ 622 #ifdef HAS_GETGRNAM_R 623 struct group _grent_struct; 624 char* _grent_buffer; 625 size_t _grent_size; 626 # ifdef USE_GRENT_PTR 627 struct group* _grent_ptr; 628 # endif 629 # ifdef USE_GRENT_FPTR 630 FILE* _grent_fptr; 631 # endif 632 #endif /* HAS_GETGRNAM_R */ 633 #ifdef HAS_GETHOSTBYNAME_R 634 struct hostent _hostent_struct; 635 # if GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD 636 struct hostent_data _hostent_data; 637 # else 638 char* _hostent_buffer; 639 size_t _hostent_size; 640 # endif 641 # ifdef USE_HOSTENT_PTR 642 struct hostent* _hostent_ptr; 643 # endif 644 # ifdef USE_HOSTENT_ERRNO 645 int _hostent_errno; 646 # endif 647 #endif /* HAS_GETHOSTBYNAME_R */ 648 #ifdef HAS_GETLOGIN_R 649 char* _getlogin_buffer; 650 size_t _getlogin_size; 651 #endif /* HAS_GETLOGIN_R */ 652 #ifdef HAS_GETNETBYNAME_R 653 struct netent _netent_struct; 654 # if GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD 655 struct netent_data _netent_data; 656 # else 657 char* _netent_buffer; 658 size_t _netent_size; 659 # endif 660 # ifdef USE_NETENT_PTR 661 struct netent* _netent_ptr; 662 # endif 663 # ifdef USE_NETENT_ERRNO 664 int _netent_errno; 665 # endif 666 #endif /* HAS_GETNETBYNAME_R */ 667 #ifdef HAS_GETPROTOBYNAME_R 668 struct protoent _protoent_struct; 669 # if GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD 670 struct protoent_data _protoent_data; 671 # else 672 char* _protoent_buffer; 673 size_t _protoent_size; 674 # endif 675 # ifdef USE_PROTOENT_PTR 676 struct protoent* _protoent_ptr; 677 # endif 678 # ifdef USE_PROTOENT_ERRNO 679 int _protoent_errno; 680 # endif 681 #endif /* HAS_GETPROTOBYNAME_R */ 682 #ifdef HAS_GETPWNAM_R 683 struct passwd _pwent_struct; 684 char* _pwent_buffer; 685 size_t _pwent_size; 686 # ifdef USE_PWENT_PTR 687 struct passwd* _pwent_ptr; 688 # endif 689 # ifdef USE_PWENT_FPTR 690 FILE* _pwent_fptr; 691 # endif 692 #endif /* HAS_GETPWNAM_R */ 693 #ifdef HAS_GETSERVBYNAME_R 694 struct servent _servent_struct; 695 # if GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSD 696 struct servent_data _servent_data; 697 # else 698 char* _servent_buffer; 699 size_t _servent_size; 700 # endif 701 # ifdef USE_SERVENT_PTR 702 struct servent* _servent_ptr; 703 # endif 704 # ifdef USE_SERVENT_ERRNO 705 int _servent_errno; 706 # endif 707 #endif /* HAS_GETSERVBYNAME_R */ 708 #ifdef HAS_GETSPNAM_R 709 struct spwd _spent_struct; 710 char* _spent_buffer; 711 size_t _spent_size; 712 # ifdef USE_SPENT_PTR 713 struct spwd* _spent_ptr; 714 # endif 715 # ifdef USE_SPENT_FPTR 716 FILE* _spent_fptr; 717 # endif 718 #endif /* HAS_GETSPNAM_R */ 719 #ifdef HAS_GMTIME_R 720 struct tm _gmtime_struct; 721 #endif /* HAS_GMTIME_R */ 722 #ifdef HAS_LOCALTIME_R 723 struct tm _localtime_struct; 724 #endif /* HAS_LOCALTIME_R */ 725 #ifdef HAS_RANDOM_R 726 # if RANDOM_R_PROTO != REENTRANT_PROTO_I_St 727 struct random_data _random_struct; 728 # endif 729 #endif /* HAS_RANDOM_R */ 730 #ifdef HAS_READDIR_R 731 struct dirent* _readdir_struct; 732 size_t _readdir_size; 733 # if READDIR_R_PROTO == REENTRANT_PROTO_I_TSR 734 struct dirent* _readdir_ptr; 735 # endif 736 #endif /* HAS_READDIR_R */ 737 #ifdef HAS_READDIR64_R 738 struct dirent64* _readdir64_struct; 739 size_t _readdir64_size; 740 # if READDIR64_R_PROTO == REENTRANT_PROTO_I_TSR 741 struct dirent64* _readdir64_ptr; 742 # endif 743 #endif /* HAS_READDIR64_R */ 744 #ifdef HAS_SETLOCALE_R 745 char* _setlocale_buffer; 746 size_t _setlocale_size; 747 #endif /* HAS_SETLOCALE_R */ 748 #ifdef HAS_STRERROR_R 749 char* _strerror_buffer; 750 size_t _strerror_size; 751 #endif /* HAS_STRERROR_R */ 752 #ifdef HAS_TTYNAME_R 753 char* _ttyname_buffer; 754 size_t _ttyname_size; 755 #endif /* HAS_TTYNAME_R */ 756 #ifdef HAS_CRYPT_R 757 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD 758 #else 759 struct crypt_data *_crypt_struct_buffer; 760 #endif 761 #endif /* HAS_CRYPT_R */ 762 #ifdef HAS_RANDOM_R 763 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS 764 int _random_retval; 765 # endif 766 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS 767 long _random_retval; 768 # endif 769 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_St 770 struct random_data _random_struct; 771 int32_t _random_retval; 772 # endif 773 #endif /* HAS_RANDOM_R */ 774 #ifdef HAS_SRANDOM_R 775 struct random_data _srandom_struct; 776 #endif /* HAS_SRANDOM_R */ 777 778 int dummy; /* cannot have empty structs */ 779 } REENTR; 780 781 #endif /* USE_REENTRANT_API */ 782 783 #endif 784