前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >runC源码分析——主体调用链

runC源码分析——主体调用链

作者头像
Walton
发布2018-04-13 16:36:10
1.4K0
发布2018-04-13 16:36:10
举报
文章被收录于专栏:KubernetesKubernetesKubernetes

本文将简单的对runC的源码调用主体逻辑进行梳理,为跟系统的阅读runC源码。 ##runC总体调用逻辑 下图中,runC源码逻辑跳转流程总体上分为三步: main入口 ——> runC处理 ——> libcontainer处理。

runC其实就是在libcontainer的基础上进行了封装成各个Command。

runC源码主体调用逻辑
runC源码主体调用逻辑

具体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)

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档