2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include "ss_sig_handler.h"
25 #include "ss_device_handler.h"
26 #include "ss_pmon_handler.h"
27 #include "ss_sysnoti.h"
30 #include "ss_predefine.h"
32 #include "ss_procmgr.h"
33 #include "ss_timemgr.h"
34 #include "ss_cpu_handler.h"
35 #include "ss_device_plugin.h"
36 #include "include/ss_data.h"
38 static void fini(struct ss_main_data *ad)
42 static void init_ad(struct ss_main_data *ad)
44 memset(ad, 0x0, sizeof(struct ss_main_data));
47 static void writepid(char *pidpath)
51 fp = fopen(pidpath, "w");
53 fprintf(fp, "%d", getpid());
58 static void system_server_init(struct ss_main_data *ad)
60 if (0 > _ss_devman_plugin_init()) {
61 PRT_TRACE_ERR("Device Manager Plugin Initialize failed");
65 ad->sysnoti_fd = ss_sysnoti_init();
66 if (ss_noti_init() < 0)
67 PRT_TRACE_ERR("init noti error");
72 ss_predefine_internal_init();
73 ss_process_manager_init();
74 ss_time_manager_init();
75 ss_cpu_handler_init();
82 ss_device_change_init(ad);
87 #define SS_PIDFILE_PATH "/var/run/.system_server.pid"
89 static int system_main(int argc, char **argv)
91 struct ss_main_data ad;
94 if ((ad.noti_fd = heynoti_init()) < 0) {
95 PRT_TRACE_ERR("Hey Notification Initialize failed");
99 if (heynoti_attach_handler(ad.noti_fd) != 0) {
100 PRT_TRACE_ERR("fail to attach hey noti handler");
104 system_server_init(&ad);
106 ecore_main_loop_begin();
114 static int elm_main(int argc, char **argv)
116 return system_main(argc, argv);
119 int main(int argc, char **argv)
121 writepid(SS_PIDFILE_PATH);
123 return elm_main(argc, argv);