4 * Copyright (c) 2014 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 <sensor_logs.h>
23 #include <sensor_loader.h>
28 static void sig_term_handler(int signo, siginfo_t *info, void *data)
30 char proc_name[NAME_MAX];
32 get_proc_name(info->si_pid, proc_name);
34 _E("Received SIGTERM(%d) from %s(%d)\n", signo, proc_name, info->si_pid);
38 static void signal_init(void)
40 struct sigaction sig_act;
41 memset(&sig_act, 0, sizeof(struct sigaction));
43 sig_act.sa_handler = SIG_IGN;
44 sigaction(SIGCHLD, &sig_act, NULL);
45 sigaction(SIGPIPE, &sig_act, NULL);
47 sig_act.sa_handler = NULL;
48 sig_act.sa_sigaction = sig_term_handler;
49 sig_act.sa_flags = SA_SIGINFO;
50 sigaction(SIGTERM, &sig_act, NULL);
53 int main(int argc, char *argv[])
55 _I("Sensord started");
59 sensor_loader::get_instance().load();
61 server::get_instance().run();
63 server::get_instance().stop();
65 _I("Sensord terminated");