#define ATTR_FORMAT(x, y, z)
#endif
-#define STATUS_NOTFOUND 3
-#define STATUS_FATAL 4
-#define STATUS_NOCACHE 5
-
#ifndef MYNAME
#define MYNAME "ccache"
#endif
-#define LIMIT_MULTIPLE 0.8
-
-/* default maximum cache size */
-#ifndef DEFAULT_MAXSIZE
-#define DEFAULT_MAXSIZE (1000*1000)
-#endif
-
/* statistics fields in storage order */
enum stats {
STATS_NONE=0,
#include <unistd.h>
#include <time.h>
+/*
+ * When "max files" or "max cache size" is reached, one of the 16 cache
+ * subdirectories is cleaned up. When doing so, files are deleted (in LRU
+ * order) until the levels are below LIMIT_MULTIPLE.
+ */
+#define LIMIT_MULTIPLE 0.8
+
static struct files {
char *fname;
time_t mtime;
unlink(path_stdout);
fd = open(path_stdout, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666);
if (fd == -1) {
- exit(STATUS_NOCACHE);
+ exit(1);
}
dup2(fd, 1);
close(fd);
unlink(path_stderr);
fd = open(path_stderr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666);
if (fd == -1) {
- exit(STATUS_NOCACHE);
+ exit(1);
}
dup2(fd, 2);
close(fd);
extern char *stats_file;
extern char *cache_dir;
+/* default maximum cache size */
+#ifndef DEFAULT_MAXSIZE
+#define DEFAULT_MAXSIZE (1000*1000)
+#endif
+
#define FLAG_NOZERO 1 /* don't zero with the -z option */
#define FLAG_ALWAYS 2 /* always show, even if zero */