Name: crash-worker
Summary: Coredump handler and report generator for Tizen
-Version: 5.5.35
+Version: 5.5.36
Release: 1
Group: Framework/system
License: Apache-2.0 and BSD-2-Clause and MIT
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(libunwind-generic)
BuildRequires: libelf-devel libelf
-BuildRequires: libebl-devel libebl
BuildRequires: libdw-devel libdw
BuildRequires: libcap-devel
* @brief dump system states.
*/
+#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <getopt.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <sys/vfs.h>
#include "dump_systemstate.h"
);
}
-/* get disk used percentage */
static int get_disk_used_percent(const char *path)
{
+ assert(path);
+
struct statfs lstatfs;
int percent;
- if (!path)
- return -1;
-
if (statfs(path, &lstatfs) < 0)
return -1;
percent = (((lstatfs.f_blocks - lstatfs.f_bfree) * 1000) / (lstatfs.f_blocks)) + 9;
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;
dpercent = get_disk_used_percent("/opt");
if (90 < dpercent) {
- fprintf_fd(out_fd, "\n==== System disk space usage detail - %d%% (/bin/du -ah /opt)\n", dpercent);
+ fprintf_fd(out_fd, "\n==== System disk space usage detail - %d%% (/bin/du -ah /opt --exclude=/opt/usr)\n", dpercent);
char *du_args[] = {"/bin/du", "-ah", "/opt", "--exclude=/opt/usr", NULL};
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 -h /tmp)\n", dpercent);
- char *du_args[] = {"/bin/du", "-h", "/tmp", NULL};
+ fprintf_fd(out_fd, "\n==== tmp usage detail - %d%% (/bin/du -ah /tmp)\n", dpercent);
+ char *du_args[] = {"/bin/du", "-ah", "/tmp", NULL};
spawn_wait_checked(du_args, NULL);
}
untar_file ${BASE_DIR} ${CORE_MINI}.tar
-gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_ORIG} -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' > ${BASE_DIR}/${THREADS_ORIG}
-gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_MINI} -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' > ${BASE_DIR}/${THREADS_MINI}
+# We want to compare if the call stack from the original dump is the same as
+# the one from the minidump. GDB can also sometimes display the type of
+# argument based on the data stored in the heap. Unfortunately, the minidump does
+# not contain heap, and this causes differences in result. Therefore, the GDB
+# result is filtered so that we can compare the two call stacks.
+
+gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_ORIG} -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' | sed 's/: [0-9]\+\(x[0-9]\+\( <[^>]\+>\)\?\)\?/: 0/g' > ${BASE_DIR}/${THREADS_ORIG}
+gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_MINI} -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' | sed 's/: [0-9]\+\(x[0-9]\+\( <[^>]\+>\)\?\)\?/: 0/g' > ${BASE_DIR}/${THREADS_MINI}
if ! diff ${BASE_DIR}/${THREADS_ORIG} ${BASE_DIR}/${THREADS_MINI} > /dev/null; then
fail "backtraces are different"