blob: de0032611465f9a9111a7bec0d912d9853db8805 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Main entry of system server process.
3 *
4 * Calls the standard system initialization function, and then
5 * puts the main thread into the thread pool so it can handle
6 * incoming transactions.
7 *
8 */
9
10#define LOG_TAG "sysproc"
11
Mathias Agopian07952722009-05-19 19:08:10 -070012#include <binder/IPCThreadState.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080013#include <utils/Log.h>
14
15#include <private/android_filesystem_config.h>
16
17#include <sys/time.h>
18#include <sys/resource.h>
19
20#include <signal.h>
21#include <stdio.h>
22#include <unistd.h>
23
24using namespace android;
25
26extern "C" status_t system_init();
27
28bool finish_system_init()
29{
30 return true;
31}
32
33static void blockSignals()
34{
35 sigset_t mask;
36 int cc;
37
38 sigemptyset(&mask);
39 sigaddset(&mask, SIGQUIT);
40 sigaddset(&mask, SIGUSR1);
41 cc = sigprocmask(SIG_BLOCK, &mask, NULL);
42 assert(cc == 0);
43}
44
45int main(int argc, const char* const argv[])
46{
Steve Block6215d3f2012-01-04 20:05:49 +000047 ALOGI("System server is starting with pid=%d.\n", getpid());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048
49 blockSignals();
50
51 // You can trust me, honestly!
52 LOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0));
53 setpriority(PRIO_PROCESS, 0, -1);
54
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 system_init();
56}