Linux-实现迷你shell [英] Linux- implement mini shell

查看:111
本文介绍了Linux-实现迷你shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个类似于linux shell的迷你shell。



当我分叉一个进程时,我将子进程设置为不同的组ID父进程(setpgrp())



我如何等待所有子组ID进程在父进程中结束(在pid> 0中)? />


我尝试waitpid(0,&stastus,0)或waitpid(-pid,&status,0)但它仍无法正常工作。

解决方案

I am writing a mini-shell that will be similar to linux shell.

When i fork a process ,i set the child process to differ group id from the father process ( setpgrp() )

How am i waiting till all the child group ID process will end in the father process( in pid>0)?

I try waitpid(0 ,&stastus ,0 ) or waitpid(-pid ,&status ,0 ) but it still not working.

解决方案

这篇关于Linux-实现迷你shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆