android init进程启动流程


 

Android系统完整的启动流程

android 系统架构图

init进程的启动流程

init进程启动服务的顺序

bool Service::Start() {
    // Starting a service removes it from the disabled or reset state and
    // immediately takes it out of the restarting state if it was in there.
    flags_ &= (~(SVC_DISABLED|SVC_RESTARTING|SVC_RESET|SVC_RESTART|SVC_DISABLED_START));

    // Running processes require no additional work --- if they're in the
    // process of exiting, we've ensured that they will immediately restart
    // on exit, unless they are ONESHOT.
    if (flags_ & SVC_RUNNING) {
        return false;
    }

    bool needs_console = (flags_ & SVC_CONSOLE);
    if (needs_console) {
        if (console_.empty()) {
            console_ = default_console;
        }

        // Make sure that open call succeeds to ensure a console driver is
        // properly registered for the device node
        int console_fd = open(console_.c_str(), O_RDWR | O_CLOEXEC);
        if (console_fd < 0) {
            PLOG(ERROR) << "service '" << name_ << "' couldn't open console '" << console_ << "'";
            flags_ |= SVC_DISABLED;
            return false;
        }
        close(console_fd);
    }

    struct stat s

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-04 02:38:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-04 02:38:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-05-04 02:38:02       82 阅读
  4. Python语言-面向对象

    2024-05-04 02:38:02       91 阅读

热门阅读

  1. pyflink filter

    2024-05-04 02:38:02       27 阅读
  2. 【AI学习】人工智能 or 人造智能 or 人创智能

    2024-05-04 02:38:02       33 阅读
  3. 你用过最好用的AI工具有哪些?【模板】

    2024-05-04 02:38:02       29 阅读
  4. React 之 如何启动一个新的项目(六)

    2024-05-04 02:38:02       30 阅读
  5. python - mac安装mysqlclient

    2024-05-04 02:38:02       26 阅读
  6. 一步一步写线程之十一线程池应用内存池

    2024-05-04 02:38:02       33 阅读
  7. css实现瀑布流布局

    2024-05-04 02:38:02       31 阅读
  8. matlab绘制散点图

    2024-05-04 02:38:02       36 阅读
  9. L1-042 日期格式化

    2024-05-04 02:38:02       27 阅读