Sysvinit调用脚本流程

Paths.h
#define VT_MASTER "/dev/tty0"  /* Virtual console master */
#define CONSOLE  "/dev/console"  /* Logical system console */
#define SECURETTY "/etc/securetty" /* List of root terminals */
#define SDALLOW  "/etc/shutdown.allow" /* Users allowed to shutdown */
#define INITTAB  "/etc/inittab"  /* Location of inittab */
#define INIT  "/sbin/init"  /* Location of init itself. */
#define NOLOGIN  "/etc/nologin"  /* Stop user logging in. */
#define FASTBOOT "/fastboot"  /* Enable fast boot. */
#define FORCEFSCK "/forcefsck"  /* Force fsck on boot */
#define SDPID  "/var/run/shutdown.pid" /* PID of shutdown program */
#define SHELL  "/bin/sh"  /* Default shell */
#define SULOGIN  "/sbin/sulogin"  /* Sulogin */
#define INITSCRIPT "/etc/initscript" /* Initscript. */
#define PWRSTAT  "/etc/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */

main ->init_main ->read_inittab
 strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); /* Hack for different libs. */
 strncpy(ch->process, process, sizeof(ch->process) - 1);


init_main -> start_if_needed ->startup ->spawn
  /* See if there is an "initscript" (except in single user mode). */
  if (access(INITSCRIPT, R_OK) == 0 && runlevel != 'S') {
 /* Build command line using "initscript" */
 args[1] = SHELL;
 args[2] = INITSCRIPT;
 args[3] = ch->id;
 args[4] = ch->rlevel;
 args[5] = "unknown";
 for(f = 0; actions[f].name; f++) {
  if (ch->action == actions[f].act) {
   args[5] = actions[f].name;
   break;
  }
 }
 args[6] = proc;
 args[7] = NULL;

initscript执行inittab中的进程。
# Execute the program.
eval exec "$4"


si::bootwait:/etc/init.d/boot
if test "$container" != "lxc" ; then
    # stat does really only return tmpfs even for devtmpfs
    # but testing both values anyway they change their mind
    DTYPE=$(stat -f -c "%T" /dev 2>/dev/null)
    if test "$DTYPE" != "tmpfs" -a "$DTYPE" != "devtmpfs"; then
        echo -n "Mounting devtmpfs at /dev"
        mount -n -t $DEVTMPFS -o mode=0755 $DEVTMPFS /dev
        rc_status -v -r
    fi

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值