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.
22 #include <sys/reboot.h>
24 #include "display/core.h"
27 #include "edbus-handler.h"
29 #include "shared/dbus.h"
30 #include "device-notifier.h"
32 #define PIDFILE_PATH "/var/run/.deviced.pid"
34 static void writepid(char *pidpath)
38 fp = fopen(pidpath, "w");
40 fprintf(fp, "%d", getpid());
45 static void sig_quit(int signo)
47 _D("received SIGTERM signal %d", signo);
50 static void sig_usr1(int signo)
52 _D("received SIGUSR1 signal %d, deviced'll be finished!", signo);
54 ecore_main_loop_quit();
57 static int deviced_main(int argc, char **argv)
63 ret = check_systemd_active();
65 _I("notify relaunch");
66 device_notify(DEVICE_NOTIFIER_BOOTING_DONE, (void *)TRUE);
68 signal(SIGTERM, sig_quit);
69 signal(SIGUSR1, sig_usr1);
71 ecore_main_loop_begin();
79 int main(int argc, char **argv)
81 writepid(PIDFILE_PATH);
83 return deviced_main(argc, argv);