1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the w64 mingw-runtime package. 4 * No warranty is given; refer to the file DISCLAIMER within this package. 5 */ 6 #ifndef _INC_PROCESS 7 #define _INC_PROCESS 8 9 #include <corecrt.h> 10 11 /* Includes a definition of _pid_t and pid_t */ 12 #include <sys/types.h> 13 14 #ifndef _POSIX_ 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #define _P_WAIT 0 21 #define _P_NOWAIT 1 22 #define _OLD_P_OVERLAY 2 23 #define _P_NOWAITO 3 24 #define _P_DETACH 4 25 #define _P_OVERLAY 2 26 27 #define _WAIT_CHILD 0 28 #define _WAIT_GRANDCHILD 1 29 30 _CRTIMP 31 uintptr_t 32 __cdecl 33 _beginthread( 34 _In_ void(__cdecl *_StartAddress) (void *), 35 _In_ unsigned _StackSize, 36 _In_opt_ void *_ArgList); 37 38 _CRTIMP void __cdecl _endthread(void); 39 40 _CRTIMP 41 uintptr_t 42 __cdecl 43 _beginthreadex( 44 _In_opt_ void *_Security, 45 _In_ unsigned _StackSize, 46 _In_ unsigned(__stdcall *_StartAddress) (void *), 47 _In_opt_ void *_ArgList, 48 _In_ unsigned _InitFlag, 49 _Out_opt_ unsigned *_ThrdAddr); 50 51 _CRTIMP void __cdecl _endthreadex(_In_ unsigned _Retval); 52 53 #ifndef _CRT_TERMINATE_DEFINED 54 #define _CRT_TERMINATE_DEFINED 55 __declspec(noreturn) void __cdecl exit(_In_ int _Code); 56 _CRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code); 57 #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ 58 /* C99 function name */ 59 __declspec(noreturn) void __cdecl _Exit(int); /* Declare to get noreturn attribute. */ 60 __CRT_INLINE void __cdecl _Exit(int status) 61 { _exit(status); } 62 #endif 63 #if __MINGW_GNUC_PREREQ(4,4) 64 #pragma push_macro("abort") 65 #undef abort 66 #endif 67 __declspec(noreturn) void __cdecl abort(void); 68 #if __MINGW_GNUC_PREREQ(4,4) 69 #pragma pop_macro("abort") 70 #endif 71 #endif 72 73 __analysis_noreturn _CRTIMP void __cdecl _cexit(void); 74 __analysis_noreturn _CRTIMP void __cdecl _c_exit(void); 75 _CRTIMP int __cdecl _getpid(void); 76 77 _CRTIMP 78 intptr_t 79 __cdecl 80 _cwait( 81 _Out_opt_ int *_TermStat, 82 _In_ intptr_t _ProcHandle, 83 _In_ int _Action); 84 85 _CRTIMP 86 intptr_t 87 __cdecl 88 _execl( 89 _In_z_ const char *_Filename, 90 _In_z_ const char *_ArgList, 91 ...); 92 93 _CRTIMP 94 intptr_t 95 __cdecl 96 _execle( 97 _In_z_ const char *_Filename, 98 _In_z_ const char *_ArgList, 99 ...); 100 101 _CRTIMP 102 intptr_t 103 __cdecl 104 _execlp( 105 _In_z_ const char *_Filename, 106 _In_z_ const char *_ArgList, 107 ...); 108 109 _CRTIMP 110 intptr_t 111 __cdecl 112 _execlpe( 113 _In_z_ const char *_Filename, 114 _In_z_ const char *_ArgList, 115 ...); 116 117 _CRTIMP 118 intptr_t 119 __cdecl 120 _execv( 121 _In_z_ const char *_Filename, 122 _In_z_ const char *const *_ArgList); 123 124 _CRTIMP 125 intptr_t 126 __cdecl 127 _execve( 128 _In_z_ const char *_Filename, 129 _In_z_ const char *const *_ArgList, 130 _In_opt_z_ const char *const *_Env); 131 132 _CRTIMP 133 intptr_t 134 __cdecl 135 _execvp( 136 _In_z_ const char *_Filename, 137 _In_z_ const char *const *_ArgList); 138 139 _CRTIMP 140 intptr_t 141 __cdecl 142 _execvpe( 143 _In_z_ const char *_Filename, 144 _In_z_ const char *const *_ArgList, 145 _In_opt_z_ const char *const *_Env); 146 147 _CRTIMP 148 intptr_t 149 __cdecl 150 _spawnl( 151 _In_ int _Mode, 152 _In_z_ const char *_Filename, 153 _In_z_ const char *_ArgList, 154 ...); 155 156 _CRTIMP 157 intptr_t 158 __cdecl 159 _spawnle( 160 _In_ int _Mode, 161 _In_z_ const char *_Filename, 162 _In_z_ const char *_ArgList, 163 ...); 164 165 _CRTIMP 166 intptr_t 167 __cdecl 168 _spawnlp( 169 _In_ int _Mode, 170 _In_z_ const char *_Filename, 171 _In_z_ const char *_ArgList, 172 ...); 173 174 _CRTIMP 175 intptr_t 176 __cdecl 177 _spawnlpe( 178 _In_ int _Mode, 179 _In_z_ const char *_Filename, 180 _In_z_ const char *_ArgList, 181 ...); 182 183 _CRTIMP 184 intptr_t 185 __cdecl 186 _spawnv( 187 _In_ int _Mode, 188 _In_z_ const char *_Filename, 189 _In_z_ const char *const *_ArgList); 190 191 _CRTIMP 192 intptr_t 193 __cdecl 194 _spawnve( 195 _In_ int _Mode, 196 _In_z_ const char *_Filename, 197 _In_z_ const char *const *_ArgList, 198 _In_opt_z_ const char *const *_Env); 199 200 _CRTIMP 201 intptr_t 202 __cdecl 203 _spawnvp( 204 _In_ int _Mode, 205 _In_z_ const char *_Filename, 206 _In_z_ const char *const *_ArgList); 207 208 _CRTIMP 209 intptr_t 210 __cdecl 211 _spawnvpe( 212 _In_ int _Mode, 213 _In_z_ const char *_Filename, 214 _In_z_ const char *const *_ArgList, 215 _In_opt_z_ const char *const *_Env); 216 217 #ifndef _CRT_SYSTEM_DEFINED 218 #define _CRT_SYSTEM_DEFINED 219 int __cdecl system(_In_opt_z_ const char *_Command); 220 #endif 221 222 #ifndef _WPROCESS_DEFINED 223 #define _WPROCESS_DEFINED 224 225 _CRTIMP 226 intptr_t 227 __cdecl 228 _wexecl( 229 _In_z_ const wchar_t *_Filename, 230 _In_z_ const wchar_t *_ArgList, 231 ...); 232 233 _CRTIMP 234 intptr_t 235 __cdecl 236 _wexecle( 237 _In_z_ const wchar_t *_Filename, 238 _In_z_ const wchar_t *_ArgList, 239 ...); 240 241 _CRTIMP 242 intptr_t 243 __cdecl 244 _wexeclp( 245 _In_z_ const wchar_t *_Filename, 246 _In_z_ const wchar_t *_ArgList, 247 ...); 248 249 _CRTIMP 250 intptr_t 251 __cdecl 252 _wexeclpe( 253 _In_z_ const wchar_t *_Filename, 254 _In_z_ const wchar_t *_ArgList, 255 ...); 256 257 _CRTIMP 258 intptr_t 259 __cdecl 260 _wexecv( 261 _In_z_ const wchar_t *_Filename, 262 _In_z_ const wchar_t *const *_ArgList); 263 264 _CRTIMP 265 intptr_t 266 __cdecl 267 _wexecve( 268 _In_z_ const wchar_t *_Filename, 269 _In_z_ const wchar_t *const *_ArgList, 270 _In_opt_z_ const wchar_t *const *_Env); 271 272 _CRTIMP 273 intptr_t 274 __cdecl 275 _wexecvp( 276 _In_z_ const wchar_t *_Filename, 277 _In_z_ const wchar_t *const *_ArgList); 278 279 _CRTIMP 280 intptr_t 281 __cdecl 282 _wexecvpe( 283 _In_z_ const wchar_t *_Filename, 284 _In_z_ const wchar_t *const *_ArgList, 285 _In_opt_z_ const wchar_t *const *_Env); 286 287 _CRTIMP 288 intptr_t 289 __cdecl 290 _wspawnl( 291 _In_ int _Mode, 292 _In_z_ const wchar_t *_Filename, 293 _In_z_ const wchar_t *_ArgList, 294 ...); 295 296 _CRTIMP 297 intptr_t 298 __cdecl 299 _wspawnle( 300 _In_ int _Mode, 301 _In_z_ const wchar_t *_Filename, 302 _In_z_ const wchar_t *_ArgList, 303 ...); 304 305 _CRTIMP 306 intptr_t 307 __cdecl 308 _wspawnlp( 309 _In_ int _Mode, 310 _In_z_ const wchar_t *_Filename, 311 _In_z_ const wchar_t *_ArgList, 312 ...); 313 314 _CRTIMP 315 intptr_t 316 __cdecl 317 _wspawnlpe( 318 _In_ int _Mode, 319 _In_z_ const wchar_t *_Filename, 320 _In_z_ const wchar_t *_ArgList, 321 ...); 322 323 _CRTIMP 324 intptr_t 325 __cdecl 326 _wspawnv( 327 _In_ int _Mode, 328 _In_z_ const wchar_t *_Filename, 329 _In_z_ const wchar_t *const *_ArgList); 330 331 _CRTIMP 332 intptr_t 333 __cdecl 334 _wspawnve( 335 _In_ int _Mode, 336 _In_z_ const wchar_t *_Filename, 337 _In_z_ const wchar_t *const *_ArgList, 338 _In_opt_z_ const wchar_t *const *_Env); 339 340 _CRTIMP 341 intptr_t 342 __cdecl 343 _wspawnvp( 344 _In_ int _Mode, 345 _In_z_ const wchar_t *_Filename, 346 _In_z_ const wchar_t *const *_ArgList); 347 348 _CRTIMP 349 intptr_t 350 __cdecl 351 _wspawnvpe( 352 _In_ int _Mode, 353 _In_z_ const wchar_t *_Filename, 354 _In_z_ const wchar_t *const *_ArgList, 355 _In_opt_z_ const wchar_t *const *_Env); 356 357 #ifndef _CRT_WSYSTEM_DEFINED 358 #define _CRT_WSYSTEM_DEFINED 359 _CRTIMP int __cdecl _wsystem(_In_opt_z_ const wchar_t *_Command); 360 #endif /* _CRT_WSYSTEM_DEFINED */ 361 362 #endif /* _WPROCESS_DEFINED */ 363 364 void __cdecl __security_init_cookie(void); 365 #if (defined(_X86_) && !defined(__x86_64)) 366 void __fastcall __security_check_cookie(uintptr_t _StackCookie); 367 __declspec(noreturn) void __cdecl __report_gsfailure(void); 368 #else 369 void __cdecl __security_check_cookie(uintptr_t _StackCookie); 370 __declspec(noreturn) void __cdecl __report_gsfailure(uintptr_t _StackCookie); 371 #endif 372 extern uintptr_t __security_cookie; 373 374 intptr_t __cdecl _loaddll(_In_z_ char *_Filename); 375 int __cdecl _unloaddll(_In_ intptr_t _Handle); 376 int (__cdecl *__cdecl _getdllprocaddr(_In_ intptr_t _Handle, _In_opt_z_ char *_ProcedureName, _In_ intptr_t _Ordinal))(void); 377 378 #ifdef _DECL_DLLMAIN 379 380 #ifdef _WIN32 381 382 WINBOOL 383 WINAPI 384 DllMain( 385 _In_ HANDLE _HDllHandle, 386 _In_ DWORD _Reason, 387 _In_opt_ LPVOID _Reserved); 388 389 WINBOOL 390 WINAPI 391 _CRT_INIT( 392 _In_ HANDLE _HDllHandle, 393 _In_ DWORD _Reason, 394 _In_opt_ LPVOID _Reserved); 395 396 WINBOOL 397 WINAPI 398 _wCRT_INIT( 399 _In_ HANDLE _HDllHandle, 400 _In_ DWORD _Reason, 401 _In_opt_ LPVOID _Reserved); 402 403 extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID); 404 405 #else /* _WIN32 */ 406 407 int 408 __stdcall 409 DllMain( 410 _In_ void *_HDllHandle, 411 _In_ unsigned _Reason, 412 _In_opt_ void *_Reserved); 413 414 int 415 __stdcall 416 _CRT_INIT( 417 _In_ void *_HDllHandle, 418 _In_ unsigned _Reason, 419 _In_opt_ void *_Reserved); 420 421 int 422 __stdcall 423 _wCRT_INIT( 424 _In_ void *_HDllHandle, 425 _In_ unsigned _Reason, 426 _In_opt_ void *_Reserved); 427 428 extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *); 429 430 #endif /* _WIN32 */ 431 432 #endif /* _DECL_DLLMAIN */ 433 434 #ifndef NO_OLDNAMES 435 436 #define P_WAIT _P_WAIT 437 #define P_NOWAIT _P_NOWAIT 438 #define P_OVERLAY _P_OVERLAY 439 #define OLD_P_OVERLAY _OLD_P_OVERLAY 440 #define P_NOWAITO _P_NOWAITO 441 #define P_DETACH _P_DETACH 442 #define WAIT_CHILD _WAIT_CHILD 443 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD 444 445 _CRTIMP 446 intptr_t 447 __cdecl 448 cwait( 449 _Out_opt_ int *_TermStat, 450 _In_ intptr_t _ProcHandle, 451 _In_ int _Action); 452 453 #ifdef __GNUC__ 454 455 _CRTIMP 456 int 457 __cdecl 458 execl( 459 _In_z_ const char *_Filename, 460 _In_z_ const char *_ArgList, 461 ...); 462 463 _CRTIMP 464 int 465 __cdecl 466 execle( 467 _In_z_ const char *_Filename, 468 _In_z_ const char *_ArgList, 469 ...); 470 471 _CRTIMP 472 int 473 __cdecl 474 execlp( 475 _In_z_ const char *_Filename, 476 _In_z_ const char *_ArgList, 477 ...); 478 479 _CRTIMP 480 int 481 __cdecl 482 execlpe( 483 _In_z_ const char *_Filename, 484 _In_z_ const char *_ArgList, 485 ...); 486 487 #else /* __GNUC__ */ 488 489 _CRTIMP 490 intptr_t 491 __cdecl 492 execl( 493 _In_z_ const char *_Filename, 494 _In_z_ const char *_ArgList, 495 ...); 496 497 _CRTIMP 498 intptr_t 499 __cdecl 500 execle( 501 _In_z_ const char *_Filename, 502 _In_z_ const char *_ArgList, 503 ...); 504 505 _CRTIMP 506 intptr_t 507 __cdecl 508 execlp( 509 _In_z_ const char *_Filename, 510 _In_z_ const char *_ArgList, 511 ...); 512 513 _CRTIMP 514 intptr_t 515 __cdecl 516 execlpe( 517 _In_z_ const char *_Filename, 518 _In_z_ const char *_ArgList, 519 ...); 520 521 #endif /* __GNUC__ */ 522 523 _CRTIMP 524 intptr_t 525 __cdecl 526 spawnl( 527 _In_ int, 528 _In_z_ const char *_Filename, 529 _In_z_ const char *_ArgList, 530 ...); 531 532 _CRTIMP 533 intptr_t 534 __cdecl 535 spawnle( 536 _In_ int, 537 _In_z_ const char *_Filename, 538 _In_z_ const char *_ArgList, 539 ...); 540 541 _CRTIMP 542 intptr_t 543 __cdecl 544 spawnlp( 545 _In_ int, 546 _In_z_ const char *_Filename, 547 _In_z_ const char *_ArgList, 548 ...); 549 550 _CRTIMP 551 intptr_t 552 __cdecl 553 spawnlpe( 554 _In_ int, 555 _In_z_ const char *_Filename, 556 _In_z_ const char *_ArgList, 557 ...); 558 559 _CRTIMP int __cdecl getpid(void); 560 561 #ifdef __GNUC__ 562 563 /* Those methods are predefined by gcc builtins to return int. So to prevent 564 stupid warnings, define them in POSIX way. This is save, because those 565 methods do not return in success case, so that the return value is not 566 really dependent to its scalar width. */ 567 568 _CRTIMP 569 int 570 __cdecl 571 execv( 572 _In_z_ const char *_Filename, 573 _In_z_ char *const _ArgList[]); 574 575 _CRTIMP 576 int 577 __cdecl 578 execve( 579 _In_z_ const char *_Filename, 580 _In_z_ char *const _ArgList[], 581 _In_opt_z_ char *const _Env[]); 582 583 _CRTIMP 584 int 585 __cdecl 586 execvp( 587 _In_z_ const char *_Filename, 588 _In_z_ char *const _ArgList[]); 589 590 _CRTIMP 591 int 592 __cdecl 593 execvpe( 594 _In_z_ const char *_Filename, 595 _In_z_ char *const _ArgList[], 596 _In_opt_z_ char *const _Env[]); 597 598 #else /* __GNUC__ */ 599 600 _CRTIMP 601 intptr_t 602 __cdecl 603 execv( 604 _In_z_ const char *_Filename, 605 _In_z_ char *const _ArgList[]); 606 607 _CRTIMP 608 intptr_t 609 __cdecl 610 execve( 611 _In_z_ const char *_Filename, 612 _In_z_ char *const _ArgList[], 613 _In_opt_z_ char *const _Env[]); 614 615 _CRTIMP 616 intptr_t 617 __cdecl 618 execvp( 619 _In_z_ const char *_Filename, 620 _In_z_ char *const _ArgList[]); 621 622 _CRTIMP 623 intptr_t 624 __cdecl 625 execvpe( 626 _In_z_ const char *_Filename, 627 _In_z_ char *const _ArgList[], 628 _In_opt_z_ char *const _Env[]); 629 630 #endif /* __GNUC__ */ 631 632 _CRTIMP 633 intptr_t 634 __cdecl 635 spawnv( 636 _In_ int, 637 _In_z_ const char *_Filename, 638 _In_z_ char *const _ArgList[]); 639 640 _CRTIMP 641 intptr_t 642 __cdecl 643 spawnve( 644 _In_ int, 645 _In_z_ const char *_Filename, 646 _In_z_ char *const _ArgList[], 647 _In_opt_z_ char *const _Env[]); 648 649 _CRTIMP 650 intptr_t 651 __cdecl 652 spawnvp( 653 _In_ int, 654 _In_z_ const char *_Filename, 655 _In_z_ char *const _ArgList[]); 656 657 _CRTIMP 658 intptr_t 659 __cdecl 660 spawnvpe( 661 _In_ int, 662 _In_z_ const char *_Filename, 663 _In_z_ char *const _ArgList[], 664 _In_opt_z_ char *const _Env[]); 665 666 #endif /* NO_OLDNAMES */ 667 668 #ifdef __cplusplus 669 } 670 #endif 671 672 #endif /* _POSIX_ */ 673 674 #endif /* _INC_PROCESS */ 675