2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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.
21 #include <TapiCommon.h>
25 #include "ss_sig_handler.h"
26 #include "ss_device_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 /* telephony initialize */
68 if (ret != TAPI_API_SUCCESS) {
69 PRT_TRACE_ERR("tapi init error : [0x%x]", ret);
71 /* Register Telephony Client */
72 ret = tel_register_app_name("slp.system.server");
73 if (ret != TAPI_API_SUCCESS) {
74 PRT_TRACE_ERR("tapi app register error : [0x%x]", ret);
77 ad->sysnoti_fd = ss_sysnoti_init();
78 if (ss_noti_init() < 0)
79 PRT_TRACE_ERR("init noti error");
84 ss_predefine_internal_init();
85 ss_process_manager_init();
86 ss_time_manager_init();
87 ss_cpu_handler_init();
93 ss_device_change_init(ad);
96 _ss_usb_storage_init();
99 #define SS_PIDFILE_PATH "/var/run/.system_server.pid"
101 static int system_main(int argc, char **argv)
103 struct ss_main_data ad;
106 ad.noti_fd = heynoti_init();
107 heynoti_attach_handler(ad.noti_fd);
108 system_server_init(&ad);
110 ecore_main_loop_begin();
118 static int elm_main(int argc, char **argv)
120 return system_main(argc, argv);
123 int main(int argc, char **argv)
125 writepid(SS_PIDFILE_PATH);
127 return elm_main(argc, argv);