char *filename;
FILE *fp;
- snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
+ if (pid == 0)
+ snprintf(buf, sizeof(buf), "/proc/cmdline");
+ else
+ snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
+
fp = fopen(buf, "r");
if (fp == NULL)
return RESOURCED_ERROR_FAIL;
/**
- * @desc get command line from /proc/{pid}/cmdline
+ * @desc get command line from /proc/{pid}/cmdline if pid is greater than 0
+ * it get /proc/cmdline if pid is 0
* @return negative value if error
*/
int proc_get_cmdline(pid_t pid, char *cmdline, size_t maxcmdline);
#define SYSTEMD_UNIT_ESCAPE_CHAR ".-"
+#define BOOT_PARAM_VIP_DISABLED "tizen.vip_reboot_disable"
+
static char **arg_vip_proc_names = NULL;
static char **arg_vip_systemd_services = NULL;
-
/* print log on console */
static void vip_print_console(const char *format, ...)
{
fclose(fp);
}
+static bool vip_boot_param_reboot_disabled(void)
+{
+ char cmdline[1024];
+ int retval;
+
+ retval = proc_get_cmdline(0, cmdline, sizeof(cmdline));
+ if (retval != RESOURCED_ERROR_NONE)
+ return false;
+
+ return (strstr(cmdline, BOOT_PARAM_VIP_DISABLED) != NULL);
+}
+
/* copy of libsyscommon/libsystemd.c: systemd_get_unit_dbus_path() */
static int vip_get_escaped_name(const char *unit, char **escaped)
{
_cleanup_close_ int checkfd = -1;
int r;
+ if (vip_boot_param_reboot_disabled()) {
+ vip_print_console("[VIP] Reboot has been disabled, boot param: %s", BOOT_PARAM_VIP_DISABLED);
+ return RESOURCED_ERROR_NONE;
+ }
+
r = access(CHECK_RELEASE_PROGRESS, F_OK);
if (r == 0) {
r = unlink(CHECK_RELEASE_PROGRESS);
static int resourced_vip_process_finalize(void *data)
{
+ if (vip_boot_param_reboot_disabled())
+ return RESOURCED_ERROR_NONE;
+
strv_free_full(&arg_vip_proc_names);
strv_free_full(&arg_vip_systemd_services);