4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include <sys/types.h>
26 #include "edbus-handler.h"
27 #include "display/poll.h"
32 #define _E(format, args...) do { \
34 snprintf(buf, 255, format, ##args);\
35 write(2, buf, strlen(buf));\
38 #define _D(format, args...) do { \
40 snprintf(buf, 255, format, ##args);\
41 write(1, buf, strlen(buf));\
45 static struct sigaction sig_child_old_act;
46 static struct sigaction sig_pipe_old_act;
48 static void sig_child_handler(int signo, siginfo_t *info, void *data)
53 if (!info || signo != SIGCHLD)
56 pid = waitpid(info->si_pid, &status, 0);
58 _E("SIGCHLD received\n");
62 _D("sig child actend call - %d\n", info->si_pid);
65 static void sig_pipe_handler(int signo, siginfo_t *info, void *data)
70 static void signal_init(void *data)
72 struct sigaction sig_act;
74 sig_act.sa_handler = NULL;
75 sig_act.sa_sigaction = sig_child_handler;
76 sig_act.sa_flags = SA_SIGINFO;
77 sigemptyset(&sig_act.sa_mask);
78 sigaction(SIGCHLD, &sig_act, &sig_child_old_act);
80 sig_act.sa_handler = NULL;
81 sig_act.sa_sigaction = sig_pipe_handler;
82 sig_act.sa_flags = SA_SIGINFO;
83 sigemptyset(&sig_act.sa_mask);
84 sigaction(SIGPIPE, &sig_act, &sig_pipe_old_act);
87 static const struct device_ops signal_device_ops = {
88 .priority = DEVICE_PRIORITY_NORMAL,
93 DEVICE_OPS_REGISTER(&signal_device_ops)