Remove unused code 67/262767/1
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 19 Aug 2021 08:41:20 +0000 (17:41 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 19 Aug 2021 08:41:20 +0000 (17:41 +0900)
Change-Id: Idcb99ab59dc44fee23d0fcbedfa80ade62ead57f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
CMakeLists.txt
plugins/iot-headed/display/core.c
plugins/mobile/display/core.c
plugins/tv/display/core.c
plugins/wearable/display/core.c
src/battery/lowbat-handler.c
src/core/launch.c [deleted file]
src/core/launch.h [deleted file]
src/devicectl/usb.c
src/power/power-handler.c

index 58e9a1e..a848a96 100644 (file)
@@ -71,7 +71,6 @@ SET(SRCS
        src/core/devices.c
        src/core/event-handler.c
        src/core/execute.c
-       src/core/launch.c
        src/core/log.c
        src/core/main.c
        src/core/sig-handler.c
index 4974dec..f211259 100644 (file)
@@ -51,7 +51,6 @@
 #include "shared/device-notifier.h"
 #include "core/udev.h"
 #include "shared/common.h"
-#include "core/launch.h"
 #include "apps/apps.h"
 #include "extcon/extcon.h"
 #include "battery/power-supply.h"
index 079351f..d381e31 100644 (file)
@@ -50,7 +50,6 @@
 #include "shared/device-notifier.h"
 #include "core/udev.h"
 #include "shared/common.h"
-#include "core/launch.h"
 #include "apps/apps.h"
 #include "extcon/extcon.h"
 #include "battery/power-supply.h"
index 51b6f5d..47f74b0 100644 (file)
@@ -50,7 +50,6 @@
 #include "shared/device-notifier.h"
 #include "core/udev.h"
 #include "shared/common.h"
-#include "core/launch.h"
 #include "apps/apps.h"
 #include "extcon/extcon.h"
 #include "battery/power-supply.h"
index 08fc114..9b58369 100644 (file)
@@ -51,7 +51,6 @@
 #include "shared/device-notifier.h"
 #include "core/udev.h"
 #include "shared/common.h"
-#include "core/launch.h"
 #include "apps/apps.h"
 #include "extcon/extcon.h"
 #include "battery/power-supply.h"
index 22a7415..66c324f 100644 (file)
@@ -33,7 +33,6 @@
 #include "battery.h"
 #include "config.h"
 #include "core/log.h"
-#include "core/launch.h"
 #include "core/devices.h"
 #include "shared/device-notifier.h"
 #include "shared/common.h"
diff --git a/src/core/launch.c b/src/core/launch.c
deleted file mode 100644 (file)
index 729a82a..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <vconf.h>
-#include <fcntl.h>
-
-#include "log.h"
-#include "launch.h"
-#include "shared/common.h"
-
-#define MAX_ARGS 255
-
-#define _S(str) ((str == NULL) ? "" : str)
-
-static int set_current_lang(void)
-{
-       char *lang;
-       int ret;
-
-       lang = vconf_get_str(VCONFKEY_LANGSET);
-       if (lang == NULL) {
-               _E("Failed to get vconf value for langset: %d", vconf_get_ext_errno());
-               return -1;
-       }
-
-       ret = setenv("LANG", lang, 1);
-       free(lang);
-       if (ret < 0)
-               return -1;
-       else
-               return 0;
-}
-
-
-static void prepare_exec(void)
-{
-       int i;
-       int maxfd;
-
-       maxfd = getdtablesize();
-       for (i = 3; i < maxfd; i++)
-               close(i);
-
-       for (i = 0; i < _NSIG; i++)
-               signal(i, SIG_DFL);
-}
-
-static int parse_cmd(const char *cmdline, char **argv, int max_args)
-{
-       const char *p;
-       char *buf, *bufp;
-       int nargs = 0;
-       int escape = 0, squote = 0, dquote = 0;
-       int bufsize;
-
-       if (cmdline == NULL || cmdline[0] == '\0')
-               return -1;
-       bufsize = strlen(cmdline)+1;
-       bufp = buf = malloc(bufsize);
-       if (bufp == NULL || buf == NULL)
-               return -1;
-       memset(buf, 0, bufsize);
-       p = cmdline;
-
-       while (*p) {
-               if (escape) {
-                       *bufp++ = *p;
-                       escape = 0;
-               } else {
-                       switch (*p) {
-                       case '\\':
-                               escape = 1;
-                               break;
-                       case '"':
-                               if (squote)
-                                       *bufp++ = *p;
-                               else
-                                       dquote = !dquote;
-                               break;
-                       case '\'':
-                               if (dquote)
-                                       *bufp++ = *p;
-                               else
-                                       squote = !squote;
-                               break;
-                       case ' ':
-                               if (!squote && !dquote) {
-                                       *bufp = '\0';
-                                       if (nargs < max_args)
-                                               argv[nargs++] = strdup(buf);
-                                       bufp = buf;
-                                       break;
-                               }
-                       default:
-                               *bufp++ = *p;
-                               break;
-                       }
-               }
-               p++;
-       }
-
-       if (bufp != buf) {
-               *bufp = '\0';
-               if (nargs < max_args)
-                       argv[nargs++] = strdup(buf);
-       }
-
-       argv[nargs++] = NULL;
-
-       free(buf);
-       return nargs;
-}
-
-int launch_app_with_nice(const char *file, char *const argv[], pid_t *pid, int _nice)
-{
-       int ret;
-       int _pid;
-       int fd;
-
-       if (file == NULL) {
-               _E("launch app error: There is no file");
-               errno = EINVAL;
-               return -1;
-       }
-
-       fd = open(file, O_RDONLY);
-       if (fd == -1) {
-               _E("launch app error: Invalid file");
-               errno = EIO;
-               return -1;
-       }
-       close(fd);
-
-       if (pid && (*pid > 0 && kill(*pid, 0) != -1))
-               return *pid;
-
-       _pid = fork();
-
-       if (_pid == -1) {
-               _E("Failed to fork: %d", errno);
-               /* keep errno */
-               return -1;
-       }
-
-       if (_pid > 0) {     /* parent */
-               if (pid)
-                       *pid = _pid;
-               return _pid;
-       }
-
-       /* child */
-       prepare_exec();
-
-       ret = nice(_nice);
-
-       if (ret == -1 && errno != 0)
-               _E("Failed to nice: %d", errno);
-
-       ret = execvp(file, argv);
-
-       /* If failed... */
-       _E("Failed to exec: %d", errno);
-       return -2;
-}
-
-int launch_app_cmd_with_nice(const char *cmdline, int _nice)
-{
-       int i;
-       int nargs;
-       int ret;
-       char *argv[MAX_ARGS + 1];
-
-       nargs = parse_cmd(cmdline, argv, MAX_ARGS + 1);
-       if (nargs == -1) {
-               _E("Launch app error: Invalid input");
-               errno = EINVAL;
-               return -1;
-       }
-
-       ret = launch_app_with_nice(argv[0], argv, NULL, _nice);
-
-       for (i = 0; i < nargs; i++)
-               free(argv[i]);
-
-       return ret;
-}
-
-int launch_app_cmd(const char *cmdline)
-{
-       return launch_app_cmd_with_nice(cmdline, 0);
-}
-
-#if 0
-int launch_if_noexist(const char *execpath, const char *arg, ...)
-{
-       char *buf;
-       int pid;
-       int nice_value = 0;
-       int flag = 0;
-       int buf_size = -1;
-       va_list argptr;
-
-       if (execpath == NULL) {
-               errno = EINVAL;
-               return -1;
-       }
-       pid = get_exec_pid(execpath);
-       if (pid > 0)
-               return pid;
-
-       va_start(argptr, arg);
-       flag = va_arg(argptr, int);
-
-       if (flag & LAUNCH_NICE)
-               nice_value = va_arg(argptr, int);
-
-       va_end(argptr);
-
-       set_current_lang();
-       arg = _S(arg);
-
-       buf_size = strlen(execpath) + strlen(arg) + 10;
-       buf = malloc(buf_size);
-       if (buf == NULL) {
-               /* Do something for not enought memory error */
-               _E("Malloc failed");
-               return -1;
-       }
-
-       snprintf(buf, buf_size, "%s %s", execpath, arg);
-       pid = launch_app_cmd_with_nice(buf, nice_value);
-       if (pid == -2)
-               exit(EXIT_FAILURE);
-       free(buf);
-
-       return pid;
-}
-#endif
-
-int launch_evenif_exist(const char *execpath, const char *arg, ...)
-{
-       char *buf;
-       int pid;
-       int nice_value = 0;
-       int flag = 0;
-       int buf_size = -1;
-
-       va_list argptr;
-
-       if (execpath == NULL) {
-               errno = EINVAL;
-               return -1;
-       }
-
-       va_start(argptr, arg);
-       flag = va_arg(argptr, int);
-
-       if (flag & LAUNCH_NICE)
-               nice_value = va_arg(argptr, int);
-
-       va_end(argptr);
-
-       set_current_lang();
-
-       arg = _S(arg);
-
-       buf_size = strlen(execpath) + strlen(arg) + 10;
-       buf = malloc(buf_size);
-       if (buf == NULL) {
-               _E("Failed to malloc.");
-               return -1;
-       }
-
-       snprintf(buf, buf_size, "%s %s", execpath, arg);
-       pid = launch_app_cmd_with_nice(buf, nice_value);
-       if (pid == -2)
-               exit(EXIT_FAILURE);
-       free(buf);
-
-       return pid;
-}
-
-#if 0
-int launch_after_kill_if_exist(const char *execpath, const char *arg, ...)
-{
-       char *buf;
-       int pid;
-       int flag;
-       int buf_size;
-       int exist_pid;
-       va_list argptr;
-       int nice_value = 0;
-
-       if (execpath == NULL) {
-               errno = EINVAL;
-               return -1;
-       }
-
-       exist_pid = get_exec_pid(execpath);
-       if (exist_pid > 0)
-               kill(exist_pid, SIGTERM);
-
-       va_start(argptr, arg);
-       flag = va_arg(argptr, int);
-
-       if (flag & LAUNCH_NICE)
-               nice_value = va_arg(argptr, int);
-
-       va_end(argptr);
-
-       set_current_lang();
-
-       arg = _S(arg);
-
-       buf_size = strlen(execpath) + strlen(arg) + 10;
-       buf = malloc(buf_size);
-       if (buf == NULL) {
-               /* Do something for not enought memory error */
-               _E("Malloc Failed");
-               return -1;
-       }
-
-       snprintf(buf, buf_size, "%s %s", execpath, arg);
-       pid = launch_app_cmd_with_nice(buf, nice_value);
-       if (pid == -2)          /* It means that the 'execvp' return -1 */
-               exit(EXIT_FAILURE);
-       free(buf);
-
-       return pid;
-
-}
-#endif
diff --git a/src/core/launch.h b/src/core/launch.h
deleted file mode 100644 (file)
index 7c6d0dd..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 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 __LAUNCH_H__
-#define __LAUNCH_H__
-
-#define LAUNCH_NICE          0x0002
-
-int launch_if_noexist(const char *execpath, const char *arg, ...);
-int launch_evenif_exist(const char *execpath, const char *arg, ...);
-int launch_after_kill_if_exist(const char *execpath, const char *arg, ...);
-
-int launch_app_cmd(const char *cmdline);
-int launch_app_cmd_with_nice(const char *cmdline, int _nice);
-
-#endif /* __LAUNCH_H__ */
index 268c8d8..652f9e1 100644 (file)
@@ -22,7 +22,6 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <shared/common.h>
-#include <core/launch.h>
 #include "usb.h"
 
 #define USB_SDB "sdb"
index 1d78523..df53032 100644 (file)
 
 #include "dd-deviced.h"
 #include "core/log.h"
-#include "core/launch.h"
 #include "shared/device-notifier.h"
 #include "core/device-idler.h"
 #include "shared/common.h"
 #include "core/devices.h"
-#include "core/launch.h"
 #include "display/poll.h"
 #include "display/setting.h"
 #include "display/core.h"