Initialize Tizen 2.3
[framework/system/coord.git] / src / core / main.c
1 /*
2  * coord
3  *
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19
20 #include <stdio.h>
21 #include <sys/reboot.h>
22 #include <signal.h>
23
24 #include "log.h"
25 #include "coords.h"
26
27 static void sig_quit(int signo)
28 {
29         _D("received SIGTERM signal %d", signo);
30 }
31
32 static void sig_usr1(int signo)
33 {
34         _D("received SIGUSR1 signal %d, coord will be finished!", signo);
35
36         ecore_main_loop_quit();
37 }
38
39 static int coord_main(int argc, char **argv)
40 {
41         edbus_init((void *)NULL);
42         coords_init((void *)NULL);
43
44         signal(SIGTERM, sig_quit);
45         signal(SIGUSR1, sig_usr1);
46
47         ecore_main_loop_begin();
48
49         coords_exit((void *)NULL);
50         edbus_exit((void *)NULL);
51         ecore_shutdown();
52         return 0;
53 }
54
55 int main(int argc, char **argv)
56 {
57         ecore_init();
58         return coord_main(argc, argv);
59 }
60