stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Black <>
Subject [PATCH] global cleanup for exec utility
Date Wed, 27 Sep 2006 20:56:53 GMT
Greetings all.

Attached is a patch that aims to clean up the use of globals within the 
exec utility.  In the process of doing so, I moved the definition of the 
target_status structure to a new header (target.h), and added a 
companion target_opts structure to encapsulate the environment used to 
run a target.

--Andrew Black

	* target.h: Add new header.
	  (target_opts): Define.
	  (rw_rlimit, ProcessStatus, target_status): Move from display.h.
from cmdopt.h.
	* cmdopt.h (rw_timeval, RLIM_INFINITY, RLIM_SAVED_CUR, RLIM_SAVED_MAX): 
Move to target.h.
	  (timeout, compat, verbose, exe_opts, in_root, child_limits): Remove 
global declarations.
	  (target_name): Move from global scope to runall.cpp local scope.
	  (eval_options): Alter declaration to take storage structure, handle.
	  (get_target): Declare, document accessor function, defined in runall.cpp.
	* cmdopt.cpp (timeout, compat, verbose, exe_opts, in_root, target_name, 
child_limits): Remove global definitions.
	  (usage_text): Remove -q and -v switch descriptions (switches were 
	  (parse_limit_opts): Alter definition to take storage structure, use 
storage structure.
	  (eval_options): Alter definition to take storage structure, handle, 
update documentation, store parsed values in provided structure/handle, 
remove -q, -v switches.
	* display.h (rw_rlimit, ProcessStatus, target_status): Move to target.h
	  (short_st_name): Make immutable.
	  (print_target): Alter declaration to take target_opts rather than 
	* display.cpp (print_target_plain): Alter definition to match print_target.
	  (print_status_plain): Alter usage to match changes to target_status 
	  (short_st_name): Make immutable.
	  (print_target): Alter definition to match declaration.
	* exec.h (exec_attrs): Remove.
	  (target.h): Include.
	  (exec_file): Alter declaration to accept target_opts in addition to 
	* exec.cpp (target.h): Include instead of display.h
	  (open_input): Alter definition to take data_dir, update documentation.
	  [!_WIN32 && !_WIN64] (alarm_timeout): Clean documentation slightly
	  [!_WIN32 && !_WIN64] (wait_for_child): Alter definition to take 
timeout, target_status, store results directly in struct.
	  [!_WIN32 && !_WIN64] (LIMIT, limit_process): Alter definition to take 
target_opts, update documentation, check for valid pointer to limit 
structure rather than invalid values.
  	  [!_WIN32 && !_WIN64 && _XOPEN_UNIX] (calculate_usage): Store 
calculated times in static local vartiables, and store references to 
these variables in target_status struct.
	  [!_WIN32 && !_WIN64] (exec_file): Alter to match prototype, altered 
function usage to match definitions.
	  [_WIN32 || _WIN64] (kill_child_process): New helper function to 
simplify child process kill code.
	  [_WIN32 || _WIN64] (exec_file): Alter to match prototype, altered 
functions to match definitions, use new helper function, some cleaning, 
process execution results.
	* output.h (parse_output): Alter declaration to take target_opts in 
addition to target_status.
	* output.cpp (check_test): Retrieve target_name via get_target.
	  (check_example): Alter definition to take data_dir, update documentation.
	  (parse_output): Alter definition to match prototype, use target_opts 
in place of removed globals.
	* runall.cpp (target.h): Included.
	  (check_target_ok): Alter definition to take target (char*) in 
addition to target_status, retrieve target_name via get_target.
	  (process_results): Remove, functionality rolled into exec_file.
	  (target_name): moved to file local scope from global scope.
	  (get_target): Declare accessor function for target_name, defined in 
	  (run_target): Alter definition to take target_opts structure rather 
than argv array.
	  (main): Create local target_opts structure to fill in eval_opts and 
use in target_template, free any rlimit structures allocated in 
	* util.h (reference_name): Alter declaration to take data_dir, update 
	* util.cpp (warn, terminate): Retrieve target_name via get_target
	  (reference_name): Retrieve target_name via get_target, use data_dir 
rather than (removed) in_root global.

View raw message