summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>2019-09-10 14:22:49 +0200
committerKarol Lewandowski <k.lewandowsk@samsung.com>2019-09-26 14:34:20 +0200
commit64f5b8a73e16fbaa1b00c99dcb0dec07919fe2ef (patch)
treed7048dfe8a842e51b0f697817ada5de909b1174a
parentca6479c4e2d7623b79984a87f051eab09bf0443c (diff)
downloadcrash-worker-64f5b8a73e16fbaa1b00c99dcb0dec07919fe2ef.tar.gz
crash-worker-64f5b8a73e16fbaa1b00c99dcb0dec07919fe2ef.tar.bz2
crash-worker-64f5b8a73e16fbaa1b00c99dcb0dec07919fe2ef.zip
Move log_dump to platform/core/system/log_dump
Change-Id: I7349a275c370cef32cb6da143acb1b5255de68f3
-rw-r--r--include/defs.h.in1
-rw-r--r--packaging/crash-worker_system-tests.spec3
-rw-r--r--packaging/log_dump.manifest8
-rw-r--r--packaging/log_dump.spec62
-rw-r--r--src/log_dump/CMakeLists.txt53
-rw-r--r--src/log_dump/dbus-handler.c238
-rw-r--r--src/log_dump/dbus-handler.h26
-rw-r--r--src/log_dump/log_dump.c315
-rw-r--r--src/log_dump/log_dump.conf26
-rw-r--r--src/log_dump/log_dump.h36
-rw-r--r--src/log_dump/log_dump.service.m411
-rw-r--r--src/log_dump/org.tizen.system.crash.service4
-rw-r--r--tests/system/CMakeLists.txt3
-rw-r--r--tests/system/log_dump_crash_root_path/log_dump_crash_root_path.sh.template31
-rw-r--r--tests/system/log_dump_normal/log_dump_normal.sh.template28
-rw-r--r--tests/system/log_dump_short/log_dump_short.sh.template32
16 files changed, 0 insertions, 877 deletions
diff --git a/include/defs.h.in b/include/defs.h.in
index a333ff7..3ac9871 100644
--- a/include/defs.h.in
+++ b/include/defs.h.in
@@ -10,7 +10,6 @@
#define CRASH_STACK_BIN_PATH "@CRASH_STACK_BIN_PATH@"
#define CRASH_POPUP_BIN_PATH "@CRASH_POPUP_BIN_PATH@"
#define CRASH_NOTIFY_BIN_PATH "@CRASH_NOTIFY_BIN_PATH@"
-#define LOG_DUMP_BIN_PATH "@LOG_DUMP_BIN_PATH@"
#define DUMP_SYSTEMSTATE_BIN_PATH "@DUMP_SYSTEMSTATE_BIN_PATH@"
#define DUMP_SYSTEMSTATE_CONFIG_DIR_PATH "@DUMP_SYSTEMSTATE_CONFIG_DIR_PATH@"
#define CRASH_MANAGER_CONFIG_PATH "@CRASH_MANAGER_CONFIG_PATH@"
diff --git a/packaging/crash-worker_system-tests.spec b/packaging/crash-worker_system-tests.spec
index 2ae412e..2139828 100644
--- a/packaging/crash-worker_system-tests.spec
+++ b/packaging/crash-worker_system-tests.spec
@@ -66,9 +66,6 @@ cd tests/system
%{_libdir}/crash-worker_system-tests/dump_systemstate_extras/dump_systemstate_extras.sh
%{_libdir}/crash-worker_system-tests/extra_script/extra_script.sh
%{_libdir}/crash-worker_system-tests/info_file/info_file.sh
-%{_libdir}/crash-worker_system-tests/log_dump_crash_root_path/log_dump_crash_root_path.sh
-%{_libdir}/crash-worker_system-tests/log_dump_normal/log_dump_normal.sh
-%{_libdir}/crash-worker_system-tests/log_dump_short/log_dump_short.sh
%{_libdir}/crash-worker_system-tests/log_file/log_file.sh
%{_libdir}/crash-worker_system-tests/report_basic/report_basic.sh
%{_libdir}/crash-worker_system-tests/report_type_info/report_type_info.sh
diff --git a/packaging/log_dump.manifest b/packaging/log_dump.manifest
deleted file mode 100644
index a340d2e..0000000
--- a/packaging/log_dump.manifest
+++ /dev/null
@@ -1,8 +0,0 @@
-<manifest>
- <request>
- <domain name="_"/>
- </request>
- <assign>
- <filesystem path="/usr/bin/log_dump" label="System" exec_label="System"/>
- </assign>
-</manifest>
diff --git a/packaging/log_dump.spec b/packaging/log_dump.spec
deleted file mode 100644
index ce97c0b..0000000
--- a/packaging/log_dump.spec
+++ /dev/null
@@ -1,62 +0,0 @@
-Name: log_dump
-Summary: log_dump
-Version: 5.5.19
-Release: 1
-Group: Framework/system
-License: Apache-2.0 and BSD
-Source0: %{name}-%{version}.tar.gz
-Source1001: log_dump.manifest
-Requires: crash-worker
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(libtzplatform-config)
-BuildRequires: pkgconfig(iniparser)
-BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: cmake
-BuildRequires: pkgconfig(pkgmgr-info)
-
-%description
-log_dump
-
-%prep
-%setup -q
-
-%define crash_root_path %{TZ_SYS_CRASH_ROOT}
-%define crash_all_log %{TZ_SYS_ALLLOGS}
-%define crash_dump_gen %{TZ_SYS_DUMPGEN}
-
-%build
-cp %{SOURCE1001} .
-
-%cmake src/log_dump/ \
- -DCRASH_ROOT_PATH=%{crash_root_path} \
- -DDUMP_SYSTEMSTATE_BIN_PATH=%{_bindir}/dump_systemstate \
- -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf
-
-make %{?jobs:-j%jobs}
-
-%install
-rm -rf %{buildroot}
-%make_install
-mkdir -p %{buildroot}%{crash_all_log}
-mkdir -p %{buildroot}%{crash_dump_gen}
-cp dump_scripts/* %{buildroot}%{crash_dump_gen}
-chmod 755 %{buildroot}%{crash_dump_gen}/*
-
-%post
-/usr/bin/chsmack -a "System" -t %{crash_dump_gen}
-/usr/bin/chsmack -a "System" -t %{crash_dump_gen}/module.d
-/usr/bin/chsmack -a "System::Shared" -t %{crash_all_log}
-/usr/bin/chsmack -a "_" %{crash_dump_gen}/module.d/*
-
-%files
-%license LICENSE
-%manifest log_dump.manifest
-%dir %{crash_all_log}
-%{crash_dump_gen}/*
-%attr(-,root,root) %{_unitdir}/log_dump.service
-%attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/log_dump.conf
-%attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.service
-%attr(0750,system_fw,system_fw) %{_bindir}/log_dump
-
-
diff --git a/src/log_dump/CMakeLists.txt b/src/log_dump/CMakeLists.txt
deleted file mode 100644
index cc91ea5..0000000
--- a/src/log_dump/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(log_dump C)
-
-ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/../../include ${CMAKE_SOURCE_DIR}/../../include)
-ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1)
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../include/)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../)
-
-SET(LOG_DUMP_SRCS
- log_dump.c
- dbus-handler.c
- ${CMAKE_SOURCE_DIR}/../shared/util.c
- ${CMAKE_SOURCE_DIR}/../shared/spawn.c
- ${CMAKE_SOURCE_DIR}/../shared/config.c
- )
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(log_dump_pkgs REQUIRED
- dlog
- capi-system-info
- libtzplatform-config
- iniparser
- gio-2.0
- )
-
-INCLUDE(${CMAKE_SOURCE_DIR}/../../cmake/ProcessM4.cmake)
-
-FOREACH(flag ${log_dump_pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
-
-ADD_EXECUTABLE(${PROJECT_NAME} ${LOG_DUMP_SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${log_dump_pkgs_LDFLAGS} -pie)
-
-PROCESS_M4("${M4_DEFINES}"
- "${CMAKE_CURRENT_SOURCE_DIR}/log_dump.service.m4"
- "${CMAKE_CURRENT_SOURCE_DIR}/log_dump.service")
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.system.crash.service
- DESTINATION /usr/share/dbus-1/system-services)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/log_dump.conf
- DESTINATION /etc/dbus-1/system.d)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/log_dump.service DESTINATION /usr/lib/systemd/system
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
diff --git a/src/log_dump/dbus-handler.c b/src/log_dump/dbus-handler.c
deleted file mode 100644
index 2eecde6..0000000
--- a/src/log_dump/dbus-handler.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * log_dump
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdbool.h>
-#include <gio/gio.h>
-#include "log_dump.h"
-#include "dbus-handler.h"
-
-/* Dbus activation */
-#define CRASH_BUS_NAME "org.tizen.system.crash"
-#define CRASH_OBJECT_PATH "/Org/Tizen/System/Crash/Crash"
-
-/* Log dump signal */
-#define LOG_DUMP_BUS_NAME "org.tizen.system.logdump"
-#define LOG_DUMP_OBJECT_PATH "/Org/Tizen/System/LogDump"
-#define LOG_DUMP_INTERFACE_NAME LOG_DUMP_BUS_NAME
-#define LOG_DUMP_START_SIGNAL "Start"
-#define LOG_DUMP_FINISH_SIGNAL "Finish"
-
-#define TIMEOUT_INTERVAL 30
-
-static GMainLoop *loop;
-static GMutex timeout_mutex;
-static guint timeout_id;
-static GDBusNodeInfo *introspection_data;
-static const gchar introspection_xml[] =
-"<node>"
-" <interface name='org.tizen.system.crash.Crash'>"
-" <method name='dump_log'>"
-" <arg type='s' name='arg' direction='in'/>"
-" <arg type='i' name='response' direction='out'/>"
-" </method>"
-" <method name='delete_dump'>"
-" <arg type='i' name='response' direction='out'/>"
-" </method>"
-" </interface>"
-"</node>";
-
-static int timeout_cb(gpointer data)
-{
- _I("Time out!");
- g_main_loop_quit((GMainLoop *)data);
-
- return 0;
-}
-
-static void add_timeout(void)
-{
- g_mutex_lock(&timeout_mutex);
-
- if (timeout_id)
- g_source_remove(timeout_id);
- timeout_id = g_timeout_add_seconds(TIMEOUT_INTERVAL, timeout_cb, loop);
-
- g_mutex_unlock(&timeout_mutex);
- _I("Add loop timeout (%d)", TIMEOUT_INTERVAL);
-}
-
-static void remove_timeout(void)
-{
- g_mutex_lock(&timeout_mutex);
-
- if (timeout_id) {
- g_source_remove(timeout_id);
- timeout_id = 0;
- }
-
- g_mutex_unlock(&timeout_mutex);
- _I("Remove loop timeout");
-}
-
-static void method_call_handler(GDBusConnection *conn,
- const gchar *sender,
- const gchar *object_path,
- const gchar *iface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- int ret = -1;
- const gchar *arg;
-
- remove_timeout();
-
- if (g_strcmp0(method_name, "dump_log") == 0) {
- g_variant_get(parameters, "(&s)", &arg);
- if (g_strcmp0(arg, "normal") == 0)
- ret = log_dump(OPT_NORMAL);
- else if (g_strcmp0(arg, "short") == 0)
- ret = log_dump(OPT_SHORT);
- else
- _E("Wrong option for log_dump");
- } else if (g_strcmp0(method_name, "delete_dump") == 0) {
- ret = delete_dump();
- }
-
- g_dbus_method_invocation_return_value(invocation,
- g_variant_new("(i)", ret));
-
- add_timeout();
-}
-
-static const GDBusInterfaceVTable interface_vtable = {
- method_call_handler,
- NULL,
- NULL
-};
-
-static void on_bus_acquired(GDBusConnection *conn,
- const gchar *name,
- gpointer user_data)
-{
- guint registration_id;
-
- registration_id = g_dbus_connection_register_object(conn,
- CRASH_OBJECT_PATH, introspection_data->interfaces[0],
- &interface_vtable, NULL, NULL, NULL);
- if (registration_id == 0)
- _E("Failed to g_dbus_connection_register_object");
-}
-
-static void on_name_acquired(GDBusConnection *conn,
- const gchar *name,
- gpointer user_data)
-{
- _D("Acquired the name %s on the system bus", name);
-}
-
-static void on_name_lost(GDBusConnection *conn,
- const gchar *name,
- gpointer user_data)
-{
- _D("Lost the name %s on the system bus", name);
-}
-
-static void dbus_init(void)
-{
- GDBusConnection *conn = NULL;
- GError *error = NULL;
-
- introspection_data =
- g_dbus_node_info_new_for_xml(introspection_xml, NULL);
- if (introspection_data == NULL) {
- _E("Failed to init g_dbus_info_new_for_xml");
- return;
- }
-
- conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (!conn) {
- _E("Failed to get dbus");
- return;
- }
-
- if (error) {
- _E("Failed to get dbus: %s", error->message);
- g_error_free(error);
- return;
- }
-
- g_bus_own_name(G_BUS_TYPE_SYSTEM, CRASH_BUS_NAME,
- G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired,
- on_name_acquired, on_name_lost, NULL, NULL);
-}
-
-int log_dump_dbus(void)
-{
- loop = g_main_loop_new(NULL, false);
-
- dbus_init();
-
- g_mutex_init(&timeout_mutex);
- add_timeout();
-
- _I("log_dump_dbus activated");
- g_main_loop_run(loop);
-
- if (introspection_data)
- g_dbus_node_info_unref(introspection_data);
- g_mutex_clear(&timeout_mutex);
- g_main_loop_unref(loop);
-
- return 0;
-}
-
-static int broadcast_logdump(const char *signal)
-{
- GDBusConnection *conn;
- GError *error = NULL;
-
- _I("broadcast signal: %s", signal);
- conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- _E("Failed to get dbus: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- g_dbus_connection_emit_signal(conn,
- NULL,
- LOG_DUMP_OBJECT_PATH,
- LOG_DUMP_INTERFACE_NAME,
- signal,
- NULL,
- &error);
- if (error) {
- _E("Failed to emit signal: %s", error->message);
- g_error_free(error);
- return -1;
- }
-
- return 0;
-}
-
-int broadcast_logdump_start(void)
-{
- return broadcast_logdump(LOG_DUMP_START_SIGNAL);
-}
-
-int broadcast_logdump_finish(void)
-{
- return broadcast_logdump(LOG_DUMP_FINISH_SIGNAL);
-}
diff --git a/src/log_dump/dbus-handler.h b/src/log_dump/dbus-handler.h
deleted file mode 100644
index a936f31..0000000
--- a/src/log_dump/dbus-handler.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * log_dump
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LOGDUMP_DBUS_H__
-#define __LOGDUMP_DBUS_H__
-
-int log_dump_dbus(void);
-int broadcast_logdump_start(void);
-int broadcast_logdump_finish(void);
-
-#endif
diff --git a/src/log_dump/log_dump.c b/src/log_dump/log_dump.c
deleted file mode 100644
index 994ed59..0000000
--- a/src/log_dump/log_dump.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * log_dump: dump current system states
- *
- * Copyright (c) 2016, 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <assert.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <libgen.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <system_info.h>
-#include <tzplatform_config.h>
-
-#include "defs.h"
-#include "dbus-handler.h"
-#include "log_dump.h"
-#include "shared/config.h"
-#include "shared/spawn.h"
-#include "shared/util.h"
-
-#define SYSTEM_INFO_KEY_BUILD_STRING "http://tizen.org/system/build.string"
-#define DIR_UMASK 0022
-
-static const struct option opts[] = {
- { "normal", no_argument, 0, OPT_NORMAL },
- { "short", no_argument, 0, OPT_SHORT },
- { "dbus", no_argument, 0, OPT_DBUS },
- { 0, 0, 0, 0 }
-};
-
-/* crash worker configuration - for admin-selectable CrashRootPath */
-config_t config;
-/* tzplaform vars */
-char *dir_scripts;
-/* dynamic vars */
-char *dir_dump;
-char *dir_log;
-char *dir_debug;
-char *dir_temp; // temp rootdir
-char *dir_temp_logdump; // rootdir for this log_dump invocation
-char *version_string;
-/* timestamp */
-const char timestamp_format[] = "%Y%m%d%H%M%S";
-char timestamp_string[20]; /* as per format above */
-
-static bool init_temp_dir(char *const temp_root, char **temp_dir)
-{
- assert(temp_root);
- assert(temp_dir);
-
- char *template = NULL, *path = NULL;
- if (asprintf(&template, "%s/log.XXXXXX", temp_root) > 0)
- path = mkdtemp(template);
-
- if (!path) {
- _E("Unable to create temporary directory at mkdtemp(%s): %m", template);
- free(template);
- return false;
- }
-
- *temp_dir = path;
- return true;
-}
-
-static char *crash_root_get(void)
-{
- return config.crash_root_path;
-}
-
-static bool init_vars(const char *crash_root)
-{
- if (!crash_root)
- return false;
-
- if (asprintf(&dir_log, "%s/log", crash_root) <= 0
- || asprintf(&dir_debug, "%s/debug", crash_root) <= 0
- || asprintf(&dir_dump, "%s/dump", crash_root) <= 0
- || asprintf(&dir_temp, "%s/temp", crash_root) <= 0)
- goto fail;
-
- make_dir(crash_root, "temp", DIR_UMASK);
- if (!init_temp_dir(dir_temp, &dir_temp_logdump))
- goto fail;
-
- make_dir(dir_temp_logdump, "log", DIR_UMASK);
- make_dir(crash_root, "debug", DIR_UMASK);
-
- _D("config: dir_log is %s", dir_log);
- _D("config: dir_dump is %s", dir_dump);
- _D("config: dir_debug is %s", dir_debug);
- _D("config: dir_temp is %s", dir_temp);
- _D("config: dir_temp_logdump is %s", dir_temp_logdump);
-
- dir_scripts = strdup(tzplatform_getenv(TZ_SYS_DUMPGEN));
- _D("config: dir_scripts is %s", dir_scripts);
-
- if (system_info_get_platform_string(SYSTEM_INFO_KEY_BUILD_STRING, &version_string) != SYSTEM_INFO_ERROR_NONE) {
- _W("Failed to system_info_get_platform_string for " SYSTEM_INFO_KEY_BUILD_STRING);
- version_string = NULL;
- }
- _D("version_string is %s", version_string);
-
- time_t cur_time;
- struct tm loc_tm;
- cur_time = time(NULL);
- localtime_r(&cur_time, &loc_tm);
- strftime(timestamp_string, sizeof(timestamp_string), timestamp_format, &loc_tm);
- _D("timestamp_string is %s", timestamp_string);
-
- assert(dir_log);
- assert(dir_dump);
- assert(dir_debug);
- assert(dir_temp);
- assert(dir_temp_logdump);
- return true;
-
-fail:
- free(dir_log);
- free(dir_dump);
- free(dir_debug);
- free(dir_temp);
- free(dir_temp_logdump);
- return false;
-}
-
-static void usage(void)
-{
- printf("Usage: log_dump {OPTION}\n"
- "Options:\n"
- " --normal dump all logs (uses scripts from %s)\n"
- " --short dump_systemstate logs only\n"
- " --dbus become dbus service\n",
- dir_scripts);
-}
-
-static bool dump_scripts(char *const workdir, char *const scriptsdir)
-{
- struct dirent **dir_list = NULL;
- char command[PATH_MAX];
- int script_num, i;
-
- script_num = scandir(scriptsdir, &dir_list, NULL, NULL);
- if (script_num < 0) {
- _E("scandir %s: %m", scriptsdir);
- return false;
- }
-
- for (i = 0; i < script_num; i++) {
- const char *const name = dir_list[i]->d_name;
- int type = dir_list[i]->d_type;
-
- if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
- continue;
-
- if (type != DT_REG) {
- _D("Ignoring: not a regular file: %s", name);
- continue;
- }
- snprintf(command, sizeof(command), "%s/%s", scriptsdir, name);
- if (access(command, X_OK) != 0) {
- _W("Ignoring: file not executable: %s", command);
- continue;
- }
-
- _D("Calling scriptlet: %s", command);
-
- char *const av[] = {command, workdir, NULL};
- (void)spawn_wait(av, NULL, NULL, 0, NULL);
- }
-
- for (i = 0; i < script_num; i++)
- free(dir_list[i]);
- free(dir_list);
-
- return true;
-}
-
-static bool dump_systemstate(const char *const destdir, const char *const timestr, int *exit_code)
-{
- char *dump_path = NULL;
-
- if (asprintf(&dump_path, "%s/log/dump_systemstate_%s.log", destdir, timestr) < 0) {
- _E("asprintf: %m");
- return false;
- }
-
- char *av[] = {DUMP_SYSTEMSTATE_BIN_PATH, "-k", "-d", "-j", "-e", "-f", dump_path, NULL};
- spawn_param_s param = { .fn = spawn_setstdout, .u.int_val = STDERR_FILENO };
- bool is_ok = spawn_wait(av, NULL, &param, 0, exit_code);
-
- free(dump_path);
-
- return is_ok;
-}
-
-static bool compress(char *const destdir, char *const tempdir, char *const versionstr, char *const timestr, int *exit_code)
-{
- char *archive_path = NULL;
-
- if (asprintf(&archive_path, "%s/log_dump_%s%s.zip", destdir, versionstr ?: "", timestr) < 0) {
- _E("asprintf: %m");
- return false;
- }
-
- _D("compress tempdir is %s", tempdir);
- char *av[] = {"/bin/zip", "-qyr", archive_path, ".", NULL};
- spawn_param_s param1 = { .fn = spawn_nullstdfds };
- spawn_param_s param0 = { .fn = spawn_chdir, .u.char_ptr = tempdir, .next = &param1 };
- bool is_ok = spawn_wait(av, NULL, &param0, 0, exit_code);
-
- _I("Storing report at %s", archive_path);
-
- fsync_path(archive_path);
- free(archive_path);
-
- return is_ok;
-}
-
-int log_dump(int option)
-{
- broadcast_logdump_start();
-
- int ret = -1;
-
- if (!dump_systemstate(dir_temp_logdump, timestamp_string, NULL))
- goto out;
-
- if (option == OPT_NORMAL)
- (void)dump_scripts(dir_temp_logdump, dir_scripts);
-
- compress(dir_debug, dir_temp_logdump, version_string, timestamp_string, NULL);
-
- /* cleanup */
- ret = remove_dir(dir_temp_logdump, 1);
- if (ret < 0)
- _W("Failed to delete dump directory at %s", dir_temp_logdump);
-
- ret = 0;
-out:
- broadcast_logdump_finish();
-
- return ret;
-}
-
-int delete_dump(void)
-{
- _D("delete_dump called");
-
- remove_dir(dir_log, 0);
- remove_dir(dir_debug, 1);
- remove_dir(dir_dump, 0);
- remove_dir(dir_temp, 0);
-
- return 0;
-}
-
-static void die(void)
-{
- usage();
- exit(EXIT_FAILURE);
-}
-
-int main(int argc, char *argv[])
-{
- int c, ret;
- int option;
-
- if (!config_init(&config, CRASH_MANAGER_CONFIG_PATH))
- return false;
-
- /* need to do this first, because even usage() uses the vars */
- if (!init_vars(crash_root_get())) {
- printf("Unable to initialize - please check program logs");
- exit(EXIT_FAILURE);
- }
-
- if (argc < 2)
- die();
-
- option = -1;
- while ((c = getopt_long_only(argc, argv, "", opts, NULL)) != -1) {
- if (option >= 0 || c < _OPT_MIN || c > _OPT_MAX)
- die();
- option = c;
- }
-
- if (option == OPT_DBUS)
- ret = log_dump_dbus();
- else
- ret = log_dump(option);
-
- config_free(&config);
-
- return ret < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-}
diff --git a/src/log_dump/log_dump.conf b/src/log_dump/log_dump.conf
deleted file mode 100644
index 4c82d0e..0000000
--- a/src/log_dump/log_dump.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <policy user="root">
- <allow own="org.tizen.system.crash"/>
- <allow send_destination="org.tizen.system.crash"
- send_interface="org.tizen.system.crash.Crash"
- send_member="dump_log"/>
- <allow send_destination="org.tizen.system.crash"
- send_interface="org.tizen.system.crash.Crash"
- send_member="delete_dump"/>
- </policy>
- <policy user="system">
- <allow send_destination="org.tizen.system.crash"
- send_interface="org.tizen.system.crash.Crash"
- send_member="dump_log"/>
- <allow send_destination="org.tizen.system.crash"
- send_interface="org.tizen.system.crash.Crash"
- send_member="delete_dump"/>
- </policy>
-
- <policy context="default">
- <deny own="org.tizen.system.crash"/>
- <deny send_destination="org.tizen.system.crash"/>
- </policy>
-</busconfig>
diff --git a/src/log_dump/log_dump.h b/src/log_dump/log_dump.h
deleted file mode 100644
index a6c87c7..0000000
--- a/src/log_dump/log_dump.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * log_dump
- *
- * Copyright (c) 2016, 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LOGDUMP_H__
-#define __LOGDUMP_H__
-
-#define LOG_TAG "LOG_DUMP"
-#include "shared/log.h"
-
-enum {
- _OPT_MIN,
- OPT_NORMAL = _OPT_MIN,
- OPT_SHORT,
- OPT_DBUS,
- _OPT_MAX = OPT_DBUS,
-};
-
-int log_dump(int option);
-int delete_dump(void);
-
-#endif
diff --git a/src/log_dump/log_dump.service.m4 b/src/log_dump/log_dump.service.m4
deleted file mode 100644
index be46f63..0000000
--- a/src/log_dump/log_dump.service.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=log_dump service
-
-[Service]
-Type=dbus
-BusName=org.tizen.system.crash
-ExecStart=/usr/bin/log_dump --dbus
-SmackProcessLabel=System
-SupplementaryGroups=log systemd-journal
-Nice=-5
-KillMode=process
diff --git a/src/log_dump/org.tizen.system.crash.service b/src/log_dump/org.tizen.system.crash.service
deleted file mode 100644
index 5dfa56b..0000000
--- a/src/log_dump/org.tizen.system.crash.service
+++ /dev/null
@@ -1,4 +0,0 @@
-[D-BUS Service]
-Name=org.tizen.system.crash
-Exec=/bin/false
-SystemdService=log_dump.service
diff --git a/tests/system/CMakeLists.txt b/tests/system/CMakeLists.txt
index 767703e..95e4474 100644
--- a/tests/system/CMakeLists.txt
+++ b/tests/system/CMakeLists.txt
@@ -28,9 +28,6 @@ configure_test("report_basic")
configure_test("report_type_info")
configure_test("without_core")
configure_test("crash_root_path")
-configure_test("log_dump_short")
-configure_test("log_dump_normal")
-configure_test("log_dump_crash_root_path")
configure_test("dump_systemstate_extras")
configure_test("livedumper")
configure_test("extra_script")
diff --git a/tests/system/log_dump_crash_root_path/log_dump_crash_root_path.sh.template b/tests/system/log_dump_crash_root_path/log_dump_crash_root_path.sh.template
deleted file mode 100644
index aabc739..0000000
--- a/tests/system/log_dump_crash_root_path/log_dump_crash_root_path.sh.template
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-# Custom report path test
-
-if [ -z "${CRASH_WORKER_SYSTEM_TESTS}" ]; then
- CRASH_WORKER_SYSTEM_TESTS="@CRASH_SYSTEM_TESTS_PATH@"
-fi
-
-. ${CRASH_WORKER_SYSTEM_TESTS}/utils/minicore-utils.sh
-
-tmpdir=$(mktemp -d /tmp/logdump-crash-root-path-test.XXXXXX)
-
-CRASH_MANAGER_CONF=/etc/crash-manager.conf
-mount -o rw,remount /
-backup_file ${CRASH_MANAGER_CONF}
-sed -ie 's,^CrashRootPath=.*,,g' ${CRASH_MANAGER_CONF}
-echo "CrashRootPath=$tmpdir" >> ${CRASH_MANAGER_CONF}
-
-log_dump --short
-logfile="${tmpdir}"/debug/* # there shall be only one file
-
-check_file_exists "$logfile"
-
-num=`unzip -qql "$logfile" | wc -l`
-if [ $num -ne 2 ]; then
- fail "'log_dump --short' report contains $num files - 2 expected"
-fi
-
-restore_file ${CRASH_MANAGER_CONF}
-
-exit_ok
diff --git a/tests/system/log_dump_normal/log_dump_normal.sh.template b/tests/system/log_dump_normal/log_dump_normal.sh.template
deleted file mode 100644
index ef70cae..0000000
--- a/tests/system/log_dump_normal/log_dump_normal.sh.template
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-# Custom report path test
-
-if [ -z "${CRASH_WORKER_SYSTEM_TESTS}" ]; then
- CRASH_WORKER_SYSTEM_TESTS="@CRASH_SYSTEM_TESTS_PATH@"
-fi
-
-. ${CRASH_WORKER_SYSTEM_TESTS}/utils/minicore-utils.sh
-
-clean_logdump
-dummy=$(mktemp $CRASH_DUMP_PATH/logdump-normal-test.XXXXXX)
-
-log_dump --normal
-logfile="${LOGDUMP_RESULT_PATH}"/* # there shall be only one file
-
-check_file_exists "$logfile"
-check_zip_contains "$logfile" 'log/dump_systemstate.*log$'
-check_zip_contains "$logfile" 'log/system_log/$'
-check_zip_contains "$logfile" 'log/system_log/dlog/kernel$'
-check_zip_contains "$logfile" 'log/module_log/$'
-check_zip_contains "$logfile" 'dump/$'
-
-check_file_not_exists "$dummy"
-
-clean_logdump
-
-exit_ok
diff --git a/tests/system/log_dump_short/log_dump_short.sh.template b/tests/system/log_dump_short/log_dump_short.sh.template
deleted file mode 100644
index 38d7885..0000000
--- a/tests/system/log_dump_short/log_dump_short.sh.template
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-# Custom report path test
-
-if [ -z "${CRASH_WORKER_SYSTEM_TESTS}" ]; then
- CRASH_WORKER_SYSTEM_TESTS="@CRASH_SYSTEM_TESTS_PATH@"
-fi
-
-. ${CRASH_WORKER_SYSTEM_TESTS}/utils/minicore-utils.sh
-
-clean_logdump
-
-dummy=$(mktemp $CRASH_DUMP_PATH/logdump-short-test.XXXXXX)
-
-log_dump --short
-logfile="${LOGDUMP_RESULT_PATH}"/* # there shall be only one file
-
-check_file_exists "$logfile"
-
-num=`unzip -qql "$logfile" | wc -l`
-if [ $num -ne 2 ]; then
- fail "'log_dump --short' report contains $num files - 2 expected"
-fi
-
-check_zip_contains "$logfile" 'log/dump_systemstate.*log$'
-check_zip_contains "$logfile" 'log/$'
-
-check_file_exists "$dummy"
-
-clean_logdump
-
-exit_ok