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