From 06663064d677ad511748fa2e5cdec61f1db372ef Mon Sep 17 00:00:00 2001 From: Hengyu Ai Date: Mon, 11 Mar 2024 00:46:12 +0800 Subject: [PATCH] remake script clangd --- lecture_note/docs/pintos/proj2.md | 18 ++++++++++++++++-- pintos/src/userprog/remake.sh | 5 +++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lecture_note/docs/pintos/proj2.md b/lecture_note/docs/pintos/proj2.md index 62ca91a..b1cf7fc 100644 --- a/lecture_note/docs/pintos/proj2.md +++ b/lecture_note/docs/pintos/proj2.md @@ -11,7 +11,7 @@ ## 分析 -在 `src/tests/userprog/Make.tests` 内有此 project 的自测数据点. +在 `tests/userprog/Make.tests` 内有此 project 的自测数据点. ``` tests/userprog/args-none_SRC = tests/userprog/args.c @@ -36,4 +36,18 @@ else msg ("end"); ``` -主要内容为打印命令行参数, 也就是需要实现为 user program 传参. \ No newline at end of file +主要内容为打印命令行参数, 也就是需要实现为 user program 传参. + +分析调用过程: 在 `threads/init.c` 中, `main() -> run_actions() -> run_task() -> process_wait (process_execute (task))` + +看一下 `process_wait()` + +```c +int +process_wait (tid_t child_tid UNUSED) +{ + return -1; +} +``` + +按照注释里的内容, 这个函数作用是等待编号 `child_tid` 线程的运行结果, 如果被系统中止/传入的 `tid` 不存在/则返回 `-1`, 否则返回 \ No newline at end of file diff --git a/pintos/src/userprog/remake.sh b/pintos/src/userprog/remake.sh index fae2d60..76b308b 100755 --- a/pintos/src/userprog/remake.sh +++ b/pintos/src/userprog/remake.sh @@ -1,9 +1,10 @@ #!/bin/bash make clean -make +bear -- make +mv compile_commands.json build/ cd build/ pintos-mkdisk filesys.dsk --filesys-size=2 cd .. -echo "userprog/ clean & rebuild." \ No newline at end of file +echo "userprog/ clean & rebuild."