Changeset 2596 in kBuild for vendor/gnumake/current/w32/subproc
- Timestamp:
- Jun 19, 2012 10:44:52 PM (12 years ago)
- Location:
- vendor/gnumake/current
- Files:
-
- 7 edited
-
. (modified) (1 prop)
-
w32/subproc/NMakefile (modified) (1 diff)
-
w32/subproc/build.bat (modified) (1 diff)
-
w32/subproc/misc.c (modified) (3 diffs)
-
w32/subproc/proc.h (modified) (1 diff)
-
w32/subproc/sub_proc.c (modified) (13 diffs)
-
w32/subproc/w32err.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current
- Property svn:ignore deleted
-
vendor/gnumake/current/w32/subproc/NMakefile
r1989 r2596 3 3 # 4 4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 5 # 2006, 2007 Free Software Foundation, Inc.5 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 6 6 # This file is part of GNU Make. 7 7 # -
vendor/gnumake/current/w32/subproc/build.bat
r1991 r2596 19 19 @echo off 20 20 rem Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 21 rem 2005, 2006, 2007 Free Software Foundation, Inc.21 rem 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 22 22 rem This file is part of GNU Make. 23 23 rem -
vendor/gnumake/current/w32/subproc/misc.c
r1989 r2596 1 1 /* Process handling for Windows 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 16 16 this program. If not, see <http://www.gnu.org/licenses/>. */ 17 17 18 #include <config.h> 18 19 #include <stddef.h> 19 20 #include <stdlib.h> … … 78 79 } 79 80 80 free(tmp);81 free(tmp); 81 82 return TRUE; 82 83 } -
vendor/gnumake/current/w32/subproc/proc.h
r1989 r2596 1 1 /* Definitions for Windows 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/w32/subproc/sub_proc.c
r1989 r2596 1 1 /* Process handling for Windows. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 16 16 this program. If not, see <http://www.gnu.org/licenses/>. */ 17 17 18 #include <config.h> 18 19 #include <stdlib.h> 19 20 #include <stdio.h> 21 #ifdef _MSC_VER 22 # include <stddef.h> /* for intptr_t */ 23 #else 24 # include <stdint.h> 25 #endif 20 26 #include <process.h> /* for msvc _beginthreadex, _endthreadex */ 21 27 #include <signal.h> … … 25 31 #include "proc.h" 26 32 #include "w32err.h" 27 #include "config.h"28 33 #include "debug.h" 29 34 30 35 static char *make_command_line(char *shell_name, char *exec_path, char **argv); 36 extern char *xmalloc (unsigned int); 31 37 32 38 typedef struct sub_process_t { 33 int sv_stdin[2];34 int sv_stdout[2];35 int sv_stderr[2];39 intptr_t sv_stdin[2]; 40 intptr_t sv_stdout[2]; 41 intptr_t sv_stderr[2]; 36 42 int using_pipes; 37 43 char *inp; … … 41 47 char * volatile errp; 42 48 volatile DWORD errcnt; 43 int pid;49 pid_t pid; 44 50 int exit_code; 45 51 int signal; … … 310 316 return((HANDLE)pproc); 311 317 } 312 pproc->sv_stdin[0] = (int ) stdin_pipes[0];313 pproc->sv_stdin[1] = (int ) stdin_pipes[1];314 pproc->sv_stdout[0] = (int ) stdout_pipes[0];315 pproc->sv_stdout[1] = (int ) stdout_pipes[1];316 pproc->sv_stderr[0] = (int ) stderr_pipes[0];317 pproc->sv_stderr[1] = (int ) stderr_pipes[1];318 pproc->sv_stdin[0] = (intptr_t) stdin_pipes[0]; 319 pproc->sv_stdin[1] = (intptr_t) stdin_pipes[1]; 320 pproc->sv_stdout[0] = (intptr_t) stdout_pipes[0]; 321 pproc->sv_stdout[1] = (intptr_t) stdout_pipes[1]; 322 pproc->sv_stderr[0] = (intptr_t) stderr_pipes[0]; 323 pproc->sv_stderr[1] = (intptr_t) stderr_pipes[1]; 318 324 319 325 pproc->using_pipes = 1; … … 337 343 * pipe, bypassing pipes altogether. 338 344 */ 339 pproc->sv_stdin[1] = (int ) stdinh;340 pproc->sv_stdout[1] = (int ) stdouth;341 pproc->sv_stderr[1] = (int ) stderrh;345 pproc->sv_stdin[1] = (intptr_t) stdinh; 346 pproc->sv_stdout[1] = (intptr_t) stdouth; 347 pproc->sv_stderr[1] = (intptr_t) stderrh; 342 348 343 349 pproc->last_err = pproc->lerrno = 0; … … 348 354 349 355 static HANDLE 350 find_file(char *exec_path, LPOFSTRUCT file_info) 356 find_file(const char *exec_path, const char *path_var, 357 char *full_fname, DWORD full_len) 351 358 { 352 359 HANDLE exec_handle; 353 360 char *fname; 354 361 char *ext; 355 356 fname = malloc(strlen(exec_path) + 5); 362 DWORD req_len; 363 int i; 364 static const char *extensions[] = 365 /* Should .com come before no-extension case? */ 366 { ".exe", ".cmd", ".bat", "", ".com", NULL }; 367 368 fname = xmalloc(strlen(exec_path) + 5); 357 369 strcpy(fname, exec_path); 358 370 ext = fname + strlen(fname); 359 371 360 strcpy(ext, ".exe"); 361 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 362 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 363 free(fname); 364 return(exec_handle); 365 } 366 367 strcpy(ext, ".cmd"); 368 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 369 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 370 free(fname); 371 return(exec_handle); 372 } 373 374 strcpy(ext, ".bat"); 375 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 376 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 377 free(fname); 378 return(exec_handle); 379 } 380 381 /* should .com come before this case? */ 382 if ((exec_handle = (HANDLE)OpenFile(exec_path, file_info, 383 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 384 free(fname); 385 return(exec_handle); 386 } 387 388 strcpy(ext, ".com"); 389 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 390 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 391 free(fname); 392 return(exec_handle); 372 for (i = 0; extensions[i]; i++) { 373 strcpy(ext, extensions[i]); 374 if (((req_len = SearchPath (path_var, fname, NULL, full_len, 375 full_fname, NULL)) > 0 376 /* For compatibility with previous code, which 377 used OpenFile, and with Windows operation in 378 general, also look in various default 379 locations, such as Windows directory and 380 Windows System directory. Warning: this also 381 searches PATH in the Make's environment, which 382 might not be what the Makefile wants, but it 383 seems to be OK as a fallback, after the 384 previous SearchPath failed to find on child's 385 PATH. */ 386 || (req_len = SearchPath (NULL, fname, NULL, full_len, 387 full_fname, NULL)) > 0) 388 && req_len <= full_len 389 && (exec_handle = 390 CreateFile(full_fname, 391 GENERIC_READ, 392 FILE_SHARE_READ | FILE_SHARE_WRITE, 393 NULL, 394 OPEN_EXISTING, 395 FILE_ATTRIBUTE_NORMAL, 396 NULL)) != INVALID_HANDLE_VALUE) { 397 free(fname); 398 return(exec_handle); 399 } 393 400 } 394 401 395 402 free(fname); 396 return (exec_handle);403 return INVALID_HANDLE_VALUE; 397 404 } 398 405 … … 417 424 int file_not_found=0; 418 425 HANDLE exec_handle; 426 char exec_fname[MAX_PATH]; 427 const char *path_var = NULL; 428 char **ep; 419 429 char buf[256]; 420 430 DWORD bytes_returned; … … 424 434 PROCESS_INFORMATION procInfo; 425 435 char *envblk=NULL; 426 OFSTRUCT file_info;427 428 436 429 437 /* … … 434 442 * assume it's in the path somewhere (generally, the NT tools 435 443 * bin directory) 436 * We use OpenFile here because it is capable of searching the Path. 437 */ 438 439 exec_handle = find_file(exec_path, &file_info); 444 */ 445 446 /* Use the Makefile's value of PATH to look for the program to 447 execute, because it could be different from Make's PATH 448 (e.g., if the target sets its own value. */ 449 if (envp) 450 for (ep = envp; *ep; ep++) { 451 if (strncmp (*ep, "PATH=", 5) == 0 452 || strncmp (*ep, "Path=", 5) == 0) { 453 path_var = *ep + 5; 454 break; 455 } 456 } 457 exec_handle = find_file(exec_path, path_var, 458 exec_fname, sizeof(exec_fname)); 440 459 441 460 /* 442 * If we couldn't open the file, just assume that Windows 32 will be able443 * to find and execute it.444 */ 445 if (exec_handle == (HANDLE)HFILE_ERROR) {461 * If we couldn't open the file, just assume that Windows will be 462 * somehow able to find and execute it. 463 */ 464 if (exec_handle == INVALID_HANDLE_VALUE) { 446 465 file_not_found++; 447 466 } … … 497 516 command_line = make_command_line( shell_name, exec_path, argv); 498 517 else 499 command_line = make_command_line( shell_name, file_info.szPathName, 500 argv); 518 command_line = make_command_line( shell_name, exec_fname, argv); 501 519 502 520 if ( command_line == NULL ) { … … 518 536 exec_path = 0; /* Search for the program in %Path% */ 519 537 } else { 520 exec_path = file_info.szPathName;538 exec_path = exec_fname; 521 539 } 522 540 … … 563 581 } 564 582 565 pproc->pid = ( int)procInfo.hProcess;583 pproc->pid = (pid_t)procInfo.hProcess; 566 584 /* Close the thread handle -- we'll just watch the process */ 567 585 CloseHandle(procInfo.hThread); -
vendor/gnumake/current/w32/subproc/w32err.c
r1989 r2596 1 1 /* Error handling for Windows 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5
Note:
See TracChangeset
for help on using the changeset viewer.

