core: Remove unused code related to run child process 66/124266/1 accepted/tizen/unified/20170412.153331 submit/tizen/20170412.073908
authorChanwoo Choi <cw00.choi@samsung.com>
Tue, 11 Apr 2017 04:24:55 +0000 (13:24 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 11 Apr 2017 04:24:55 +0000 (13:24 +0900)
This patch just removes the unused code related to run child process.

Change-Id: I563ec183733520a4dd391d5c7f5c02b386bf04b7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/core/common.h
src/core/execute.c [deleted file]

index 86525cb85321c5e8285f9fc542db6a154048a8d4..a9c10a225419c004c36f12bc741a3e12a7f82ecb 100644 (file)
@@ -136,7 +136,6 @@ FILE * open_proc_oom_score_adj_file(int pid, const char *mode);
 int get_exec_pid(const char *execpath);
 int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size);
 int is_vip(int pid);
-int run_child(int argc, const char *argv[]);
 int remove_dir(const char *path, int del_dir);
 int sys_check_node(char *path);
 int sys_get_int(char *fname, int *val);
diff --git a/src/core/execute.c b/src/core/execute.c
deleted file mode 100755 (executable)
index ddfba23..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * PASS
- *
- * Copyright (c) 2017 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 <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <limits.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include "shared/log.h"
-
-static int parent(pid_t pid)
-{
-       int status;
-
-       /* wait for child */
-       if (waitpid(pid, &status, 0) != -1) {
-               /* terminated normally */
-               if (WIFEXITED(status)) {
-                       _I("%d terminated by exit(%d)", pid, WEXITSTATUS(status));
-                       return WEXITSTATUS(status);
-               } else if (WIFSIGNALED(status))
-                       _I("%d terminated by signal %d", pid, WTERMSIG(status));
-               else if (WIFSTOPPED(status))
-                       _I("%d stopped by signal %d", pid, WSTOPSIG(status));
-       } else
-               _I("%d waitpid() failed : %d", pid, errno);
-
-       return -EAGAIN;
-}
-
-static void child(int argc, const char *argv[])
-{
-       int i, r;
-
-       for (i = 0; i < _NSIG; ++i)
-               signal(i, SIG_DFL);
-
-       r = execv(argv[0], (char **)argv);
-       if (r < 0)
-               exit(EXIT_FAILURE);
-}
-
-int run_child(int argc, const char *argv[])
-{
-       pid_t pid;
-       struct sigaction act, oldact;
-       int r = 0;
-       FILE *fp;
-
-       if (!argv)
-               return -EINVAL;
-
-       fp = fopen(argv[0], "r");
-       if (fp == NULL) {
-               _E("fail %s (%d)", argv[0], errno);
-               return -errno;
-       }
-       fclose(fp);
-
-       /* Use default signal handler */
-       act.sa_handler = SIG_DFL;
-       act.sa_sigaction = NULL;
-       act.sa_flags = 0;
-       sigemptyset(&act.sa_mask);
-
-       if (sigaction(SIGCHLD, &act, &oldact) < 0)
-               return -errno;
-
-       pid = fork();
-       if (pid < 0) {
-               _E("failed to fork");
-               r = -errno;
-       } else if (pid == 0) {
-               child(argc, argv);
-       } else
-               r = parent(pid);
-
-       if (sigaction(SIGCHLD, &oldact, NULL) < 0)
-               _E("failed to restore sigaction");
-
-       return r;
-}