#include <limits.h>
#include <getopt.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <sys/vfs.h>
#include "dump_systemstate.h"
return percent;
}
+static dev_t get_disk_device(const char *path)
+{
+ assert(path);
+
+ struct stat st;
+ if (stat(path, &st) < 0)
+ return -1;
+
+ return st.st_dev;
+}
+
int main(int argc, char *argv[])
{
int c, ret, i, dpercent, exit_code = 0;
spawn_wait_checked(du_args, NULL);
}
+ if (get_disk_device("/opt") != get_disk_device("/opt/usr")) {
+ dpercent = get_disk_used_percent("/opt/usr");
+
+ if (90 < dpercent) {
+ fprintf_fd(out_fd, "\n==== System disk space usage detail - %d%% (/bin/du -ah /opt/usr)\n", dpercent);
+ char *du_args[] = {"/bin/du", "-ah", "/opt/usr", NULL};
+ spawn_wait_checked(du_args, NULL);
+ }
+ }
+
dpercent = get_disk_used_percent("/tmp");
if (80 < dpercent) {
fprintf_fd(out_fd, "\n==== tmp usage detail - %d%% (/bin/du -ah /tmp)\n", dpercent);