Changeset 2591 for trunk/src/kmk/w32
- Timestamp:
- Jun 17, 2012, 10:45:31 PM (13 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
- Property svn:ignore
-
old new 13 13 stamp-* 14 14 makebook* 15 15 16 .*gdbinit 17 .gdb_history 18 16 19 *.dep 17 20 *.dvi … … 31 34 *.pg 32 35 *.pgs 36 33 37 README 34 38 README.DOS 35 39 README.W32 40 README.OS2 36 41 aclocal.m4 37 42 autom4te.cache … … 52 57 config.h.W32 53 58 config.h-vms 59 54 60 loadavg 55 61 loadavg.c 56 62 make 63 57 64 .deps 58 65 .dep_segment 66 ID 67 TAGS 68 59 69 _* 60 70 sun4 … … 72 82 sol2 73 83 i486-linux 84 74 85 customs 86 75 87 install-sh 76 88 mkinstalldirs 89 90 .directive.asc
-
- Property svn:ignore
-
trunk/src/kmk/w32
- Property svn:ignore
-
old new 1 1 Makefile 2 2 Makefile.in 3 .deps
-
- Property svn:ignore
-
trunk/src/kmk/w32/Makefile.am
- Property svn:keywords deleted
r1993 r2591 1 1 # Makefile.am to create libw32.a for mingw32 host. 2 2 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 # 2007 Free Software Foundation, Inc.3 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 # This file is part of GNU Make. 5 5 # -
trunk/src/kmk/w32/compat/dirent.c
r1993 r2591 1 1 /* Directory entry code for Window platforms. 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 … … 17 17 18 18 19 #ifdef KMK 20 # include "config.h" /* my_stat */ 21 #endif 19 #include <config.h> 22 20 #include <sys/types.h> 23 21 #include <sys/stat.h> … … 142 140 143 141 /* fill in struct dirent values */ 144 pDir->dir_sdReturn.d_ino = -1;142 pDir->dir_sdReturn.d_ino = (ino_t)-1; 145 143 strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName); 146 144 -
trunk/src/kmk/w32/include/dirent.h
r1993 r2591 1 1 /* Windows version of dirent.h 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
trunk/src/kmk/w32/include/pathstuff.h
r1993 r2591 1 1 /* Definitions for Windows path manipulation. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
trunk/src/kmk/w32/include/sub_proc.h
r1993 r2591 1 1 /* Definitions for Windows process invocation. 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 … … 22 22 * Component Name: 23 23 * 24 * $Date: 20 07/10/24 20:06:32$24 * $Date: 2010/07/13 01:20:43 $ 25 25 * 26 26 * $Source: /sources/make/make/w32/include/sub_proc.h,v $ 27 27 * 28 * $Id: sub_proc.h,v 1.1 0 2007/10/24 20:06:32 elizExp $28 * $Id: sub_proc.h,v 1.12 2010/07/13 01:20:43 psmith Exp $ 29 29 */ 30 30 -
trunk/src/kmk/w32/include/w32err.h
r1993 r2591 1 1 /* Definitions for Windows error handling. 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 -
trunk/src/kmk/w32/pathstuff.c
r2454 r2591 1 1 /* Path conversion for Windows pathnames. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007, 200 9Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 17 17 18 18 #include <Windows.h> /* bird */ 19 #include <stdio.h> /* bird */19 #include "make.h" 20 20 #include <string.h> 21 21 #include <stdlib.h> 22 #include "make.h"23 22 #include "pathstuff.h" 24 23 … … 83 82 *etok = to_delim; 84 83 p = ++etok; 85 84 } else 86 85 p += strlen(p); 87 86 } else { -
trunk/src/kmk/w32/subproc/NMakefile
r1993 r2591 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 # -
trunk/src/kmk/w32/subproc/build.bat
r1993 r2591 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 -
trunk/src/kmk/w32/subproc/misc.c
r1993 r2591 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 81 free(tmp); 81 82 return TRUE; 82 83 } -
trunk/src/kmk/w32/subproc/proc.h
r1993 r2591 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 -
trunk/src/kmk/w32/subproc/sub_proc.c
r1993 r2591 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; … … 316 322 return((HANDLE)pproc); 317 323 } 318 pproc->sv_stdin[0] = (int ) stdin_pipes[0];319 pproc->sv_stdin[1] = (int ) stdin_pipes[1];320 pproc->sv_stdout[0] = (int ) stdout_pipes[0];321 pproc->sv_stdout[1] = (int ) stdout_pipes[1];322 pproc->sv_stderr[0] = (int ) stderr_pipes[0];323 pproc->sv_stderr[1] = (int ) stderr_pipes[1];324 pproc->sv_stdin[0] = (intptr_t) stdin_pipes[0]; 325 pproc->sv_stdin[1] = (intptr_t) stdin_pipes[1]; 326 pproc->sv_stdout[0] = (intptr_t) stdout_pipes[0]; 327 pproc->sv_stdout[1] = (intptr_t) stdout_pipes[1]; 328 pproc->sv_stderr[0] = (intptr_t) stderr_pipes[0]; 329 pproc->sv_stderr[1] = (intptr_t) stderr_pipes[1]; 324 330 325 331 pproc->using_pipes = 1; … … 343 349 * pipe, bypassing pipes altogether. 344 350 */ 345 pproc->sv_stdin[1] = (int ) stdinh;346 pproc->sv_stdout[1] = (int ) stdouth;347 pproc->sv_stderr[1] = (int ) stderrh;351 pproc->sv_stdin[1] = (intptr_t) stdinh; 352 pproc->sv_stdout[1] = (intptr_t) stdouth; 353 pproc->sv_stderr[1] = (intptr_t) stderrh; 348 354 349 355 pproc->last_err = pproc->lerrno = 0; … … 354 360 355 361 static HANDLE 356 find_file(char *exec_path, LPOFSTRUCT file_info) 362 find_file(const char *exec_path, const char *path_var, 363 char *full_fname, DWORD full_len) 357 364 { 358 365 HANDLE exec_handle; 359 366 char *fname; 360 367 char *ext; 361 #ifdef KMK 362 size_t exec_path_len; 363 364 /* 365 * if there is an .exe extension there already, don't waste time here. 366 * If .exe scripts become common, they can be handled in a CreateProcess 367 * failure path instead of here. 368 */ 369 exec_path_len = strlen(exec_path); 370 if ( exec_path_len > 4 371 && exec_path[exec_path_len - 4] == '.' 372 && !stricmp(exec_path + exec_path_len - 3, "exe")){ 373 return((HANDLE)HFILE_ERROR); 374 } 375 376 fname = malloc(exec_path_len + 5); 377 #else 378 fname = malloc(strlen(exec_path) + 5); 379 #endif 368 DWORD req_len; 369 int i; 370 static const char *extensions[] = 371 /* Should .com come before no-extension case? */ 372 { ".exe", ".cmd", ".bat", "", ".com", NULL }; 373 374 fname = xmalloc(strlen(exec_path) + 5); 380 375 strcpy(fname, exec_path); 381 376 ext = fname + strlen(fname); 382 377 383 strcpy(ext, ".exe"); 384 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 385 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 386 free(fname); 387 return(exec_handle); 388 } 389 390 strcpy(ext, ".cmd"); 391 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 392 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 393 free(fname); 394 return(exec_handle); 395 } 396 397 strcpy(ext, ".bat"); 398 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 399 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 400 free(fname); 401 return(exec_handle); 402 } 403 404 /* should .com come before this case? */ 405 if ((exec_handle = (HANDLE)OpenFile(exec_path, file_info, 406 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 407 free(fname); 408 return(exec_handle); 409 } 410 411 strcpy(ext, ".com"); 412 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 413 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 414 free(fname); 415 return(exec_handle); 378 for (i = 0; extensions[i]; i++) { 379 strcpy(ext, extensions[i]); 380 if (((req_len = SearchPath (path_var, fname, NULL, full_len, 381 full_fname, NULL)) > 0 382 /* For compatibility with previous code, which 383 used OpenFile, and with Windows operation in 384 general, also look in various default 385 locations, such as Windows directory and 386 Windows System directory. Warning: this also 387 searches PATH in the Make's environment, which 388 might not be what the Makefile wants, but it 389 seems to be OK as a fallback, after the 390 previous SearchPath failed to find on child's 391 PATH. */ 392 || (req_len = SearchPath (NULL, fname, NULL, full_len, 393 full_fname, NULL)) > 0) 394 && req_len <= full_len 395 && (exec_handle = 396 CreateFile(full_fname, 397 GENERIC_READ, 398 FILE_SHARE_READ | FILE_SHARE_WRITE, 399 NULL, 400 OPEN_EXISTING, 401 FILE_ATTRIBUTE_NORMAL, 402 NULL)) != INVALID_HANDLE_VALUE) { 403 free(fname); 404 return(exec_handle); 405 } 416 406 } 417 407 418 408 free(fname); 419 return (exec_handle);409 return INVALID_HANDLE_VALUE; 420 410 } 421 411 … … 440 430 int file_not_found=0; 441 431 HANDLE exec_handle; 432 char exec_fname[MAX_PATH]; 433 const char *path_var = NULL; 434 char **ep; 442 435 char buf[256]; 443 436 DWORD bytes_returned; … … 447 440 PROCESS_INFORMATION procInfo; 448 441 char *envblk=NULL; 449 OFSTRUCT file_info; 450 442 #ifdef KMK 443 size_t exec_path_len; 444 #endif 445 446 447 /* 448 * Shell script detection... if the exec_path starts with #! then 449 * we want to exec shell-script-name exec-path, not just exec-path 450 * NT doesn't recognize #!/bin/sh or #!/etc/Tivoli/bin/perl. We do not 451 * hard-code the path to the shell or perl or whatever: Instead, we 452 * assume it's in the path somewhere (generally, the NT tools 453 * bin directory) 454 */ 455 456 #ifdef KMK 457 /* kmk performace: Don't bother looking for shell scripts in .exe files. */ 458 exec_path_len = strlen(exec_path); 459 if (exec_path_len > 4 460 && exec_path[exec_path_len - 4] == '.' 461 && !stricmp(exec_path + exec_path_len - 3, "exe")) { 462 exec_handle = INVALID_HANDLE_VALUE; 463 } 464 else { 465 #endif /* KMK */ 466 /* Use the Makefile's value of PATH to look for the program to 467 execute, because it could be different from Make's PATH 468 (e.g., if the target sets its own value. */ 469 if (envp) 470 for (ep = envp; *ep; ep++) { 471 if (strncmp (*ep, "PATH=", 5) == 0 472 || strncmp (*ep, "Path=", 5) == 0) { 473 path_var = *ep + 5; 474 break; 475 } 476 } 477 exec_handle = find_file(exec_path, path_var, 478 exec_fname, sizeof(exec_fname)); 479 #ifdef KMK 480 } 481 #endif 451 482 452 483 /* 453 * Shell script detection... if the exec_path starts with #! then 454 * we want to exec shell-script-name exec-path, not just exec-path 455 * NT doesn't recognize #!/bin/sh or #!/etc/Tivoli/bin/perl. We do not 456 * hard-code the path to the shell or perl or whatever: Instead, we 457 * assume it's in the path somewhere (generally, the NT tools 458 * bin directory) 459 * We use OpenFile here because it is capable of searching the Path. 484 * If we couldn't open the file, just assume that Windows will be 485 * somehow able to find and execute it. 460 486 */ 461 462 exec_handle = find_file(exec_path, &file_info); 463 464 /* 465 * If we couldn't open the file, just assume that Windows32 will be able 466 * to find and execute it. 467 */ 468 if (exec_handle == (HANDLE)HFILE_ERROR) { 487 if (exec_handle == INVALID_HANDLE_VALUE) { 469 488 file_not_found++; 470 489 } … … 520 539 command_line = make_command_line( shell_name, exec_path, argv); 521 540 else 522 command_line = make_command_line( shell_name, file_info.szPathName, 523 argv); 541 command_line = make_command_line( shell_name, exec_fname, argv); 524 542 525 543 if ( command_line == NULL ) { … … 541 559 exec_path = 0; /* Search for the program in %Path% */ 542 560 } else { 543 exec_path = file_info.szPathName;561 exec_path = exec_fname; 544 562 } 545 563 … … 608 626 } 609 627 610 pproc->pid = ( int)procInfo.hProcess;628 pproc->pid = (pid_t)procInfo.hProcess; 611 629 /* Close the thread handle -- we'll just watch the process */ 612 630 CloseHandle(procInfo.hThread); -
trunk/src/kmk/w32/subproc/w32err.c
r1993 r2591 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.