runC原始碼分析 主體呼叫鏈

2021-07-25 15:38:10 字數 2642 閱讀 8201

下圖中,runc原始碼邏輯跳轉流程總體上分為三步:

main入口 ——> runc處理 ——> libcontainer處理。

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

具體runc的各個command的呼叫鏈見如下:

checkpointcommand(main.go) —> checkpointcommand(checkpoint.go)

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)

checkpointcommand(checkpoint.go)—> checkpoint(libcontainer/container_linux.go)

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)

Vue原始碼主體分析

vue的響應式和react的函式式程式設計思想是很不同的。vue最基本的原理是對getter和setter的 模式。以及觀察者模式。當資料發生變化時,通知觀察者。而watcher是通過觸發資料的getter,成為觀察者的。vue的生命週期中,在create階段,vue建立了例項。在mount 階段,...

runc原始碼分析 create和start

筆者關於open container initiative oci 的容器runtime實現runc原始碼的create和start流程進行了分析整理。這個run是 create start run三個命令入口公用的,下面主要描述create流程。封裝函式,僅是獲取了當前容器狀態 目前未建立前是st...

eMule原始碼主要呼叫流程分析

轉載自 主體結構 按照下面的呼叫順序啟動主要流程 1.emule對話方塊類cemuledlg oninitdlg settimer null,null,300,startuptimer 設定啟動定時器 2.定時器函式void callback cemuledlg startuptimer 完成各物件...