summaryrefslogtreecommitdiffstats
path: root/cmds/system_server/system_main.cpp
blob: de0032611465f9a9111a7bec0d912d9853db8805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Main entry of system server process.
 * 
 * Calls the standard system initialization function, and then
 * puts the main thread into the thread pool so it can handle
 * incoming transactions.
 * 
 */

#define LOG_TAG "sysproc"

#include <binder/IPCThreadState.h>
#include <utils/Log.h>

#include <private/android_filesystem_config.h>

#include <sys/time.h>
#include <sys/resource.h>

#include <signal.h>
#include <stdio.h>
#include <unistd.h>

using namespace android;

extern "C" status_t system_init();

bool finish_system_init()
{
    return true;
}

static void blockSignals()
{
    sigset_t mask;
    int cc;
    
    sigemptyset(&mask);
    sigaddset(&mask, SIGQUIT);
    sigaddset(&mask, SIGUSR1);
    cc = sigprocmask(SIG_BLOCK, &mask, NULL);
    assert(cc == 0);
}

int main(int argc, const char* const argv[])
{
    ALOGI("System server is starting with pid=%d.\n", getpid());

    blockSignals();
    
    // You can trust me, honestly!
    LOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0));
    setpriority(PRIO_PROCESS, 0, -1);

    system_init();    
}