Cxxdgc's Site

Back

要干什么?#

补全tsh.c文件,实现一个简单的shell

文件中已定义的部分函数#

// 向作业列表中添加新作业
int addjob(struct job_t *job_list, pid_t pid, int state, char *cmdline);
// 删除指定pid的作业(注意,发送信号用的是kill这一底层函数!)
int deletejob(struct job_t *job_list, pid_t pid);
// 获取当前前台作业的PID
pid_t fgpid(struct job_t *job_list);
// 通过pid查找作业
struct job_t *getjobpid(struct job_t *job_list, pid_t pid);
// 通过jid(作业id)查找作业
struct job_t *getjobjid(struct job_t *job_list, int jid);
// 将进程pid映射为作业jid
int pid2jid(pid_t pid);
// 信号处理
// signum是信号编号,handler是信号处理函数
handler_t *Signal(int signum, handler_t *handler);
// 其余很多系统函数,如kill等等
plaintext
2025秋ICS ShellLab
https://www.cxxdgc.cn/blog/courseblog/2025autumn/ics/shelllab
Author Cxxdgc
Published at 2025年11月22日
Comment seems to stuck. Try to refresh?✨