mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 13:22:11 +00:00
Tried trailing spaces. Minor comment typo corrections.
[SVN r42627]
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
*
|
||||
* Each word must be an individual element in a jam variable value.
|
||||
*
|
||||
* In $(JAMSHELL), % expands to the command string and ! expands to
|
||||
* In $(JAMSHELL), % expands to the command string and ! expands to
|
||||
* the slot number (starting at 1) for multiprocess (-j) invocations.
|
||||
* If $(JAMSHELL) doesn't include a %, it is tacked on as the last
|
||||
* argument.
|
||||
@@ -96,7 +96,7 @@ static void read_output();
|
||||
static int try_kill_one();
|
||||
/* */
|
||||
static double creation_time(HANDLE);
|
||||
/* Recursive check if first process is parent (directly or indirectly) of
|
||||
/* Recursive check if first process is parent (directly or indirectly) of
|
||||
the second one. */
|
||||
static int is_parent_child(DWORD, DWORD);
|
||||
/* */
|
||||
@@ -142,7 +142,7 @@ static struct
|
||||
/* execution unit tests */
|
||||
void execnt_unit_test()
|
||||
{
|
||||
#if !defined(NDEBUG)
|
||||
#if !defined(NDEBUG)
|
||||
/* vc6 preprocessor is broken, so assert with these strings gets
|
||||
* confused. Use a table instead.
|
||||
*/
|
||||
@@ -179,17 +179,17 @@ void execnt_unit_test()
|
||||
* literals inside assert
|
||||
*/
|
||||
char** argv = string_to_args("\"g++\" -c -I\"Foobar\"");
|
||||
char const expected[] = "-c -I\"Foobar\"";
|
||||
|
||||
char const expected[] = "-c -I\"Foobar\"";
|
||||
|
||||
assert(!strcmp(argv[0], "g++"));
|
||||
assert(!strcmp(argv[1], expected));
|
||||
free_argv(argv);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* execcmd() - launch an async command execution */
|
||||
void execcmd(
|
||||
void execcmd(
|
||||
char *command,
|
||||
void (*func)( void *closure, int status, timing_info*, char *invoked_command, char *command_output),
|
||||
void *closure,
|
||||
@@ -203,7 +203,7 @@ void execcmd(
|
||||
char **argv = argv_static;
|
||||
char *p;
|
||||
char* command_orig = command;
|
||||
|
||||
|
||||
/* Check to see if we need to hack around the line-length limitation. */
|
||||
/* Look for a JAMSHELL setting of "%", indicating that the command
|
||||
* should be invoked directly */
|
||||
@@ -228,12 +228,12 @@ void execcmd(
|
||||
{
|
||||
const char *tempdir = path_tmpdir();
|
||||
DWORD procID = GetCurrentProcessId();
|
||||
|
||||
|
||||
/* SVA - allocate 64 other just to be safe */
|
||||
cmdtab[ slot ].tempfile_bat = BJAM_MALLOC_ATOMIC( strlen( tempdir ) + 64 );
|
||||
|
||||
|
||||
sprintf(
|
||||
cmdtab[ slot ].tempfile_bat, "%s\\jam%d-%02d.bat",
|
||||
cmdtab[ slot ].tempfile_bat, "%s\\jam%d-%02d.bat",
|
||||
tempdir, procID, slot );
|
||||
}
|
||||
|
||||
@@ -247,14 +247,14 @@ void execcmd(
|
||||
if( raw_cmd && can_spawn( command ) >= MAXLINE )
|
||||
{
|
||||
if( DEBUG_EXECCMD )
|
||||
printf("Executing raw command directly\n");
|
||||
printf("Executing raw command directly\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
FILE *f = 0;
|
||||
int tries = 0;
|
||||
raw_cmd = 0;
|
||||
|
||||
|
||||
/* Write command to bat file. For some reason this open can
|
||||
fails intermitently. But doing some retries works. Most likely
|
||||
this is due to a previously existing file of the same name that
|
||||
@@ -274,7 +274,7 @@ void execcmd(
|
||||
fclose( f );
|
||||
|
||||
command = cmdtab[ slot ].tempfile_bat;
|
||||
|
||||
|
||||
if( DEBUG_EXECCMD )
|
||||
{
|
||||
if (shell)
|
||||
@@ -327,7 +327,7 @@ void execcmd(
|
||||
|
||||
if( !cmdsrunning++ )
|
||||
istat = signal( SIGINT, onintr );
|
||||
|
||||
|
||||
/* Start the command */
|
||||
{
|
||||
SECURITY_ATTRIBUTES sa
|
||||
@@ -406,8 +406,8 @@ void execcmd(
|
||||
string_new( &cmdtab[ slot ].target );
|
||||
}
|
||||
string_copy( &cmdtab[ slot ].command, command_orig );
|
||||
|
||||
/* put together the comman we run */
|
||||
|
||||
/* put together the command to run */
|
||||
{
|
||||
char ** argp = argv;
|
||||
string_new(&cmd);
|
||||
@@ -418,7 +418,7 @@ void execcmd(
|
||||
string_append(&cmd,*(argp++));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* create the output buffers */
|
||||
string_new( &cmdtab[ slot ].buffer_out );
|
||||
string_new( &cmdtab[ slot ].buffer_err );
|
||||
@@ -442,7 +442,7 @@ void execcmd(
|
||||
perror( "CreateProcess" );
|
||||
exit( EXITBAD );
|
||||
}
|
||||
|
||||
|
||||
/* clean up temporary stuff */
|
||||
string_free(&cmd);
|
||||
}
|
||||
@@ -453,7 +453,7 @@ void execcmd(
|
||||
while( cmdsrunning >= MAXJOBS || cmdsrunning >= globs.jobs )
|
||||
if( !execwait() )
|
||||
break;
|
||||
|
||||
|
||||
if (argv != argv_static)
|
||||
{
|
||||
free_argv(argv);
|
||||
@@ -475,7 +475,7 @@ int execwait()
|
||||
|
||||
if( !cmdsrunning )
|
||||
return 0;
|
||||
|
||||
|
||||
/* wait for a command to complete, while snarfing up any output */
|
||||
do
|
||||
{
|
||||
@@ -489,13 +489,13 @@ int execwait()
|
||||
if ( i < 0 ) i = try_kill_one();
|
||||
}
|
||||
while ( i < 0 );
|
||||
|
||||
|
||||
/* we have a command... process it */
|
||||
--cmdsrunning;
|
||||
{
|
||||
timing_info time;
|
||||
int rstat;
|
||||
|
||||
|
||||
/* the time data for the command */
|
||||
record_times(cmdtab[i].pi.hProcess, &time);
|
||||
|
||||
@@ -514,7 +514,7 @@ int execwait()
|
||||
rstat = EXEC_CMD_FAIL;
|
||||
else
|
||||
rstat = EXEC_CMD_OK;
|
||||
|
||||
|
||||
/* output the action block */
|
||||
out_action(
|
||||
cmdtab[i].action.size > 0 ? cmdtab[i].action.value : 0,
|
||||
@@ -533,7 +533,7 @@ int execwait()
|
||||
&time,
|
||||
cmdtab[i].command.value,
|
||||
cmdtab[i].buffer_out.value );
|
||||
|
||||
|
||||
/* clean up the command data, process, etc. */
|
||||
string_free(&cmdtab[i].action); string_new(&cmdtab[i].action);
|
||||
string_free(&cmdtab[i].target); string_new(&cmdtab[i].target);
|
||||
@@ -566,7 +566,7 @@ int maxline()
|
||||
OSVERSIONINFO os_info;
|
||||
os_info.dwOSVersionInfoSize = sizeof(os_info);
|
||||
GetVersionEx(&os_info);
|
||||
|
||||
|
||||
return (os_info.dwMajorVersion == 3)
|
||||
? 996 /* NT 3.5.1 */
|
||||
: 2047 /* NT >= 4.x */
|
||||
@@ -595,7 +595,7 @@ static char** string_to_args( const char* string )
|
||||
/* drop leading and trailing whitespace if any */
|
||||
while (isspace(*string))
|
||||
++string;
|
||||
|
||||
|
||||
src_len = strlen( string );
|
||||
while ( src_len > 0 && isspace( string[src_len - 1] ) )
|
||||
--src_len;
|
||||
@@ -617,7 +617,7 @@ static char** string_to_args( const char* string )
|
||||
BJAM_FREE( line );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Strip quotes from the first command-line argument and find
|
||||
* where it ends. Quotes are illegal in Win32 pathnames, so we
|
||||
* don't need to worry about preserving escaped quotes here.
|
||||
@@ -644,7 +644,7 @@ static char** string_to_args( const char* string )
|
||||
argv[1] = dst;
|
||||
|
||||
/* Copy the rest of the arguments verbatim */
|
||||
|
||||
|
||||
src_len -= src - string;
|
||||
|
||||
/* Use strncat because it appends a trailing nul */
|
||||
@@ -652,7 +652,7 @@ static char** string_to_args( const char* string )
|
||||
strncat(dst, src, src_len);
|
||||
|
||||
argv[2] = 0;
|
||||
|
||||
|
||||
return argv;
|
||||
}
|
||||
|
||||
@@ -670,14 +670,14 @@ static void onintr( int disp )
|
||||
long can_spawn(char* command)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
||||
char inquote = 0;
|
||||
|
||||
/* Move to the first non-whitespace */
|
||||
command += strspn( command, " \t" );
|
||||
|
||||
p = command;
|
||||
|
||||
|
||||
/* Look for newlines and unquoted i/o redirection */
|
||||
do
|
||||
{
|
||||
@@ -695,7 +695,7 @@ long can_spawn(char* command)
|
||||
if (*p)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
|
||||
case '"':
|
||||
case '\'':
|
||||
if (p > command && p[-1] != '\\')
|
||||
@@ -705,10 +705,10 @@ long can_spawn(char* command)
|
||||
else if (inquote == 0)
|
||||
inquote = *p;
|
||||
}
|
||||
|
||||
|
||||
++p;
|
||||
break;
|
||||
|
||||
|
||||
case '<':
|
||||
case '>':
|
||||
case '|':
|
||||
@@ -794,7 +794,7 @@ static time_t filetime_dt(FILETIME t_utc)
|
||||
static void record_times(HANDLE process, timing_info* time)
|
||||
{
|
||||
FILETIME creation, exit, kernel, user;
|
||||
|
||||
|
||||
if (GetProcessTimes(process, &creation, &exit, &kernel, &user))
|
||||
{
|
||||
time->system = filetime_seconds(kernel);
|
||||
@@ -815,7 +815,7 @@ static void read_pipe(
|
||||
{
|
||||
DWORD bytesInBuffer = 0;
|
||||
DWORD bytesAvailable = 0;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
/* check if we have any data to read */
|
||||
@@ -823,7 +823,7 @@ static void read_pipe(
|
||||
{
|
||||
bytesAvailable = 0;
|
||||
}
|
||||
|
||||
|
||||
/* read in the available data */
|
||||
if ( bytesAvailable > 0 )
|
||||
{
|
||||
@@ -872,7 +872,7 @@ static void read_pipe(
|
||||
static void read_output()
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for ( i = 0; i < globs.jobs && i < MAXJOBS; ++i )
|
||||
{
|
||||
/* read stdout data */
|
||||
@@ -912,7 +912,7 @@ static int try_wait(int timeoutMillis)
|
||||
active_procs[num_active] = i;
|
||||
num_active += 1;
|
||||
}
|
||||
|
||||
|
||||
/* wait for a child to complete, or for our timeout window to expire */
|
||||
if ( waiting )
|
||||
{
|
||||
@@ -920,7 +920,7 @@ static int try_wait(int timeoutMillis)
|
||||
waiting = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -930,7 +930,7 @@ static int try_kill_one()
|
||||
if ( globs.timeout > 0 )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for ( i = 0; i < globs.jobs; ++i )
|
||||
{
|
||||
double t = running_time(cmdtab[i].pi.hProcess);
|
||||
@@ -1040,7 +1040,7 @@ static void kill_process_tree(DWORD pid, HANDLE process)
|
||||
pid = get_process_id(process);
|
||||
}
|
||||
process_snapshot_h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
|
||||
|
||||
|
||||
if (INVALID_HANDLE_VALUE != process_snapshot_h)
|
||||
{
|
||||
BOOL ok = TRUE;
|
||||
@@ -1078,9 +1078,9 @@ static double creation_time(HANDLE process)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* Recursive check if first process is parent (directly or indirectly) of
|
||||
/* Recursive check if first process is parent (directly or indirectly) of
|
||||
the second one. Both processes are passed as process ids, not handles.
|
||||
Special return value 2 means that the second process is smss.exe and its
|
||||
Special return value 2 means that the second process is smss.exe and its
|
||||
parent process is System (first argument is ignored) */
|
||||
static int is_parent_child(DWORD parent, DWORD child)
|
||||
{
|
||||
@@ -1098,21 +1098,21 @@ static int is_parent_child(DWORD parent, DWORD child)
|
||||
PROCESSENTRY32 pinfo;
|
||||
pinfo.dwSize = sizeof(PROCESSENTRY32);
|
||||
for (
|
||||
ok = Process32First(process_snapshot_h, &pinfo);
|
||||
ok == TRUE;
|
||||
ok = Process32First(process_snapshot_h, &pinfo);
|
||||
ok == TRUE;
|
||||
ok = Process32Next(process_snapshot_h, &pinfo) )
|
||||
{
|
||||
if (pinfo.th32ProcessID == child)
|
||||
{
|
||||
/*
|
||||
Unfortunately, process ids are not really unique. There might
|
||||
Unfortunately, process ids are not really unique. There might
|
||||
be spurious "parent and child" relationship match between
|
||||
two non-related processes if real parent process of a given
|
||||
process has exited (while child process kept running as an
|
||||
"orphan") and the process id of such parent process has been
|
||||
reused by internals of the operating system when creating
|
||||
process has exited (while child process kept running as an
|
||||
"orphan") and the process id of such parent process has been
|
||||
reused by internals of the operating system when creating
|
||||
another process. Thus additional check is needed - process
|
||||
creation time. This check may fail (ie. return 0) for system
|
||||
creation time. This check may fail (ie. return 0) for system
|
||||
processes due to insufficient privileges, and that's OK. */
|
||||
double tchild = 0.0;
|
||||
double tparent = 0.0;
|
||||
@@ -1122,17 +1122,17 @@ static int is_parent_child(DWORD parent, DWORD child)
|
||||
|
||||
/* csrss.exe may display message box like following:
|
||||
xyz.exe - Unable To Locate Component
|
||||
This application has failed to start because
|
||||
boost_foo-bar.dll was not found. Re-installing the
|
||||
This application has failed to start because
|
||||
boost_foo-bar.dll was not found. Re-installing the
|
||||
application may fix the problem
|
||||
This actually happens when starting test process that depends
|
||||
on a dynamic library which failed to build. We want to
|
||||
on a dynamic library which failed to build. We want to
|
||||
automatically close these message boxes even though csrss.exe
|
||||
is not our child process. We may depend on the fact that (in
|
||||
all current versions of Windows) csrss.exe is directly
|
||||
all current versions of Windows) csrss.exe is directly
|
||||
child of smss.exe process, which in turn is directly child of
|
||||
System process, which always has process id == 4 .
|
||||
This check must be performed before comparison of process
|
||||
This check must be performed before comparison of process
|
||||
creation time */
|
||||
if (stricmp(pinfo.szExeFile, "csrss.exe") == 0
|
||||
&& is_parent_child(parent, pinfo.th32ParentProcessID) == 2)
|
||||
@@ -1152,7 +1152,7 @@ static int is_parent_child(DWORD parent, DWORD child)
|
||||
{
|
||||
tchild = creation_time(hchild);
|
||||
tparent = creation_time(hparent);
|
||||
|
||||
|
||||
CloseHandle(hparent);
|
||||
}
|
||||
CloseHandle(hchild);
|
||||
@@ -1193,14 +1193,14 @@ BOOL CALLBACK close_alert_window_enum(HWND hwnd, LPARAM lParam)
|
||||
|
||||
if (!GetClassNameA(hwnd, buf, sizeof(buf)))
|
||||
return TRUE; /* failed to read class name; presume it's not a dialog */
|
||||
|
||||
|
||||
if (strcmp(buf, "#32770") != 0)
|
||||
return TRUE; /* not a dialog */
|
||||
|
||||
/* GetWindowThreadProcessId returns 0 on error, otherwise thread id
|
||||
of window message pump thread */
|
||||
tid = GetWindowThreadProcessId(hwnd, &pid);
|
||||
|
||||
|
||||
if (tid && is_parent_child(p.pid, pid))
|
||||
{
|
||||
/* ask really nice */
|
||||
@@ -1211,7 +1211,7 @@ BOOL CALLBACK close_alert_window_enum(HWND hwnd, LPARAM lParam)
|
||||
PostThreadMessageA(tid, WM_QUIT, 0, 0);
|
||||
WaitForSingleObject(p.h, 300);
|
||||
}
|
||||
|
||||
|
||||
/* done, we do not want to check any other window now */
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1222,7 +1222,7 @@ BOOL CALLBACK close_alert_window_enum(HWND hwnd, LPARAM lParam)
|
||||
static void close_alert(HANDLE process)
|
||||
{
|
||||
DWORD pid = get_process_id(process);
|
||||
/* If process already exited or we just cannot get its process id, do not
|
||||
/* If process already exited or we just cannot get its process id, do not
|
||||
go any further */
|
||||
if (pid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user