apply debian/patches/12_cachesize_permissions.diff
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10913 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ac1b517350
commit
27e03f3f86
3 changed files with 22 additions and 8 deletions
|
|
@ -1033,15 +1033,23 @@ static int ccache_main(int argc, char *argv[])
|
|||
case 'F':
|
||||
check_cache_dir();
|
||||
v = atoi(optarg);
|
||||
stats_set_limits(v, -1);
|
||||
printf("Set cache file limit to %u\n", (unsigned)v);
|
||||
if (stats_set_limits(v, -1) == 0) {
|
||||
printf("Set cache file limit to %u\n", (unsigned)v);
|
||||
} else {
|
||||
printf("Could not set cache file limit.\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
check_cache_dir();
|
||||
v = value_units(optarg);
|
||||
stats_set_limits(-1, v);
|
||||
printf("Set cache size limit to %uk\n", (unsigned)v);
|
||||
if (stats_set_limits(-1, v) == 0) {
|
||||
printf("Set cache size limit to %uk\n", (unsigned)v);
|
||||
} else {
|
||||
printf("Could not set cache size limit.\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ void stats_zero(void);
|
|||
void stats_summary(void);
|
||||
void stats_tocache(size_t size);
|
||||
void stats_read(const char *stats_file, unsigned counters[STATS_END]);
|
||||
void stats_set_limits(long maxfiles, long maxsize);
|
||||
int stats_set_limits(long maxfiles, long maxsize);
|
||||
size_t value_units(const char *s);
|
||||
void display_size(unsigned v);
|
||||
void stats_set_sizes(const char *dir, size_t num_files, size_t total_size);
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ void stats_zero(void)
|
|||
|
||||
|
||||
/* set the per directory limits */
|
||||
void stats_set_limits(long maxfiles, long maxsize)
|
||||
int stats_set_limits(long maxfiles, long maxsize)
|
||||
{
|
||||
int dir;
|
||||
unsigned counters[STATS_END];
|
||||
|
|
@ -298,7 +298,9 @@ void stats_set_limits(long maxfiles, long maxsize)
|
|||
maxsize /= 16;
|
||||
}
|
||||
|
||||
create_dir(cache_dir);
|
||||
if (create_dir(cache_dir) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* set the limits in each directory */
|
||||
for (dir=0;dir<=0xF;dir++) {
|
||||
|
|
@ -306,7 +308,9 @@ void stats_set_limits(long maxfiles, long maxsize)
|
|||
int fd;
|
||||
|
||||
x_asprintf(&cdir, "%s/%1x", cache_dir, dir);
|
||||
create_dir(cdir);
|
||||
if (create_dir(cdir) != 0) {
|
||||
return 1;
|
||||
}
|
||||
x_asprintf(&fname, "%s/stats", cdir);
|
||||
free(cdir);
|
||||
|
||||
|
|
@ -326,6 +330,8 @@ void stats_set_limits(long maxfiles, long maxsize)
|
|||
}
|
||||
free(fname);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set the per directory sizes */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue