add some missing stats and logging
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11039 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c577ac1a31
commit
2e68619a9f
4 changed files with 15 additions and 10 deletions
|
|
@ -125,6 +125,7 @@ static void failed(void)
|
|||
if ((e=getenv("CCACHE_PREFIX"))) {
|
||||
char *p = find_executable(e, MYNAME);
|
||||
if (!p) {
|
||||
cc_log("could not find executable (%s)\n", e);
|
||||
perror(e);
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -535,8 +536,8 @@ static void find_hash(ARGS *args)
|
|||
correct i_tmpfile */
|
||||
path_stdout = x_strdup(input_file);
|
||||
if (create_empty_file(path_stderr) != 0) {
|
||||
stats_update(STATS_ERROR);
|
||||
cc_log("failed to create empty stderr file\n");
|
||||
stats_update(STATS_ERROR);
|
||||
failed();
|
||||
}
|
||||
status = 0;
|
||||
|
|
@ -592,6 +593,7 @@ static void find_hash(ARGS *args)
|
|||
char *p;
|
||||
if (create_dir(hash_dir) != 0) {
|
||||
cc_log("failed to create %s\n", hash_dir);
|
||||
stats_update(STATS_ERROR);
|
||||
failed();
|
||||
}
|
||||
x_asprintf(&p, "%s/%c", hash_dir, s[i]);
|
||||
|
|
@ -600,6 +602,7 @@ static void find_hash(ARGS *args)
|
|||
}
|
||||
if (create_dir(hash_dir) != 0) {
|
||||
cc_log("failed to create %s\n", hash_dir);
|
||||
stats_update(STATS_ERROR);
|
||||
failed();
|
||||
}
|
||||
x_asprintf(&hashname, "%s/%s", hash_dir, s+nlevels);
|
||||
|
|
@ -785,6 +788,7 @@ static void find_compiler(int argc, char **argv)
|
|||
/* can't find the compiler! */
|
||||
if (!orig_args->argv[0]) {
|
||||
stats_update(STATS_COMPILER);
|
||||
cc_log("could not find compiler (%s)\n", base);
|
||||
perror(base);
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -1069,6 +1073,7 @@ static void process_args(int argc, char **argv)
|
|||
|
||||
if (p) {
|
||||
if (strlen(p) < 2) {
|
||||
cc_log("badly formed dependency file %s\n", output_file);
|
||||
stats_update(STATS_ARGS);
|
||||
failed();
|
||||
return;
|
||||
|
|
@ -1105,6 +1110,8 @@ static void process_args(int argc, char **argv)
|
|||
if ((e=getenv("CCACHE_PREFIX"))) {
|
||||
char *p = find_executable(e, MYNAME);
|
||||
if (!p) {
|
||||
cc_log("could not find executable (%s)\n", e);
|
||||
stats_update(STATS_ENVIRONMMENT);
|
||||
perror(e);
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -1288,6 +1295,7 @@ static void setup_uncached_err(void)
|
|||
uncached_fd = dup(2);
|
||||
if (uncached_fd == -1) {
|
||||
cc_log("dup(2) failed\n");
|
||||
stats_update(STATS_ERROR);
|
||||
failed();
|
||||
}
|
||||
|
||||
|
|
@ -1296,6 +1304,7 @@ static void setup_uncached_err(void)
|
|||
|
||||
if (putenv(buf) == -1) {
|
||||
cc_log("putenv failed\n");
|
||||
stats_update(STATS_ERROR);
|
||||
failed();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ enum stats {
|
|||
STATS_NOTC,
|
||||
STATS_DEVICE,
|
||||
STATS_NOINPUT,
|
||||
STATS_ENVIRONMMENT,
|
||||
STATS_MULTIPLE,
|
||||
STATS_CONFTEST,
|
||||
STATS_UNSUPPORTED,
|
||||
|
|
|
|||
|
|
@ -123,9 +123,7 @@ int execute(char **argv,
|
|||
std_od = _dup(1);
|
||||
fd = _open(path_stdout, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666);
|
||||
if (fd == -1) {
|
||||
status = STATUS_NOCACHE;
|
||||
cc_log("stdout error: failed to open %s\n", path_stdout);
|
||||
goto out;
|
||||
exit(STATUS_NOCACHE);
|
||||
}
|
||||
_dup2(fd, 1);
|
||||
_close(fd);
|
||||
|
|
@ -134,9 +132,7 @@ int execute(char **argv,
|
|||
fd = _open(path_stderr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666);
|
||||
std_ed = _dup(2);
|
||||
if (fd == -1) {
|
||||
status = STATUS_NOCACHE;
|
||||
cc_log("stderr error: failed to open %s\n", path_stderr);
|
||||
goto out;
|
||||
exit(STATUS_NOCACHE);
|
||||
}
|
||||
_dup2(fd, 2);
|
||||
_close(fd);
|
||||
|
|
@ -144,9 +140,6 @@ int execute(char **argv,
|
|||
/* Spawn process (_exec* familly doesn't return) */
|
||||
status = _spawnv(_P_WAIT, argv[0], (const char **)argv);
|
||||
|
||||
out:
|
||||
if (status == -1) cc_log("Error %i: %s\n", errno, strerror(errno));
|
||||
|
||||
/* Restore descriptors */
|
||||
if (std_od != -1) _dup2(std_od, 1);
|
||||
if (std_ed != -1) _dup2(std_ed, 2);
|
||||
|
|
@ -235,6 +228,7 @@ char *find_executable(const char *name, const char *exclude_name)
|
|||
}
|
||||
if (!path) {
|
||||
cc_log("no PATH variable!?\n");
|
||||
stats_update(STATS_ENVIRONMMENT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ static struct {
|
|||
{ STATS_OUTSTDOUT, "output to stdout ", NULL, 0 },
|
||||
{ STATS_DEVICE, "output to a non-regular file ", NULL, 0 },
|
||||
{ STATS_NOINPUT, "no input file ", NULL, 0 },
|
||||
{ STATS_ENVIRONMMENT, "error due to bad env variable ", NULL, 0 },
|
||||
{ STATS_NUMFILES, "files in cache ", NULL, FLAG_NOZERO|FLAG_ALWAYS },
|
||||
{ STATS_TOTALSIZE, "cache size ", display_size , FLAG_NOZERO|FLAG_ALWAYS },
|
||||
{ STATS_MAXFILES, "max files ", NULL, FLAG_NOZERO },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue