summaryrefslogtreecommitdiffstats
path: root/cmds/system_server/system_main.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:31:44 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:31:44 -0800
commit9066cfe9886ac131c34d59ed0e2d287b0e3c0087 (patch)
treed88beb88001f2482911e3d28e43833b50e4b4e97 /cmds/system_server/system_main.cpp
parentd83a98f4ce9cfa908f5c54bbd70f03eec07e7553 (diff)
downloadframeworks_base-9066cfe9886ac131c34d59ed0e2d287b0e3c0087.zip
frameworks_base-9066cfe9886ac131c34d59ed0e2d287b0e3c0087.tar.gz
frameworks_base-9066cfe9886ac131c34d59ed0e2d287b0e3c0087.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'cmds/system_server/system_main.cpp')
-rw-r--r--cmds/system_server/system_main.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/cmds/system_server/system_main.cpp b/cmds/system_server/system_main.cpp
new file mode 100644
index 0000000..ca16e57
--- /dev/null
+++ b/cmds/system_server/system_main.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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 <utils/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[])
+{
+ LOGI("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);
+
+ #if HAVE_ANDROID_OS
+ //setgid(GID_SYSTEM);
+ //setuid(UID_SYSTEM);
+ #endif
+
+ system_init();
+}