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 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{ 47 LOGI("System server is starting with pid=%d.\n", getpid()); 48 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 55 #if HAVE_ANDROID_OS 56 //setgid(GID_SYSTEM); 57 //setuid(UID_SYSTEM); 58 #endif 59 60 system_init(); 61} 62