Home | History | Annotate | Download | only in system_server
      1 /*
      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 
     12 #include <binder/IPCThreadState.h>
     13 #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 
     24 using namespace android;
     25 
     26 extern "C" status_t system_init();
     27 
     28 bool finish_system_init()
     29 {
     30     return true;
     31 }
     32 
     33 static 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 
     45 int main(int argc, const char* const argv[])
     46 {
     47     ALOGI("System server is starting with pid=%d.\n", getpid());
     48 
     49     blockSignals();
     50 
     51     // You can trust me, honestly!
     52     ALOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0));
     53     setpriority(PRIO_PROCESS, 0, -1);
     54 
     55     system_init();
     56 }
     57