runC源碼分析——主體調用鏈_runC

來源:互聯網
上載者:User

本文將簡單的對runC的源碼調用主體邏輯進行梳理,為跟系統的閱讀runC源碼。 runC總體調用邏輯

下圖中,runC源碼邏輯跳轉流程總體上分為三步:
main入口 ——> runC處理 ——> libcontainer處理。

runC其實就是在libcontainer的基礎上進行了封裝成各個Command。

具體runC的各個Command的調用鏈見如下: runC處理 checkpoint

checkpointCommand(main.go) —> checkpointCommand(checkpoint.go) container

createCommand(main.go)—>createCommand(create.go)—>startContainer(untils_linux.go)—>run(untils_linux.go)
deleteCommand(main.go)—>deleteCommand(delete.go)—>destroy(untils_linux.go)
eventsCommand(main.go)—>eventsCommand(events.go)
execCommand(main.go)—>execCommand(exec.go)—>execProcess(exec.go)->run(untils_linux.go)
initCommand(main.go)—>initCommand(main_unix.go)
killCommand(main.go)—>killCommand(kill.go)
listCommand(main.go)—>getContainers(list.go)
pauseCommand(main.go) —>pauseCommand(pause.go)
psCommand(main.go)—>psCommand(ps.go)
restoreCommand(main.go)—>restoreCommand(restore.go)—>restoreContainer(restore.go)
resumeCommand(main.go)—>resumeCommand(pause.go)
runCommand(main.go)—>runCommand(run.go)—>startContainer(untils_linux.go)
specCommand(main.go)—>specCommand(spec.go) end
startCommand(main.go)—>startCommand(start.go)
stateCommand(main.go)—>stateCommand(state.go)
updateCommand(main.go)—>updateCommand(update.go) runC to libcontainer checkpoint

checkpointCommand(checkpoint.go)—> Checkpoint(libcontainer/container_linux.go) container

run(untils_linux.go)—>Run(libcontainer/container_linux.go)
destroy(untils_linux.go)—>Destroy(libcontainer/container_linux.go)
eventsCommand(events.go)—>Status(libcontainer/container_linux.go)
execProcess(exec.go)—>Status\Stopped\State(libcontainer/container_linux.go) || run(untils_linux.go)—>Start\Run\Destroy(libcontainer/container_linux.go)
initCommand(main_unix.go)—>StartInitialization(libcontainer/factory_linux.go)
killCommand(kill.go)—>Signal(libcontainer/container_linux.go)
getContainers(list.go)—>Status\State\Stopped(libcontainer/container_linux.go)
pauseCommand(pause.go)—>Pause(libcontainer/container_linux.go)
psCommand(ps.go)—>exec.Command(“ps”, psArgs…).Output()
restoreContainer(restore.go)—>Restore(libcontainer/container_linux.go)
resumeCommand(pause.go)—>Resume(libcontainer/container_linux.go)
startContainer(untils_linux.go)—>Run(libcontainer/factory.go)
startCommand(start.go)—>Exec(libcontainer/container_linux.go)
stateCommand(state.go)—>State(libcontainer/container_linux.go)
updateCommand(update.go)—>Set(libcontainer/container_linux.go)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.