简体   繁体   English

setpgrp和tcsetpgrp有什么区别

[英]What is the difference between setpgrp and tcsetpgrp

int tcsetpgrp(int fildes, pid_t pgid_id); 

and

int setpgrp(void); 

I don't really understand difference and purpose of this two functions. 我不太了解这两个功能的区别和目的。 Of course man page has been previously read. 当然, man page之前已经阅读过。

But I still don't understand purpose and use of this functions. 但是我仍然不了解此功能的目的和用途。 It is clear to set group. 设置组很明显。 But why do we need both of them. 但是为什么我们都需要它们。 What is the difference between terminal group and process group. 终端组和过程组有什么区别。
Please explain this. 请解释一下。 I would be very grateful. 我会很感激。

tcsetprgrp is a function that is used for set the process group based on the file descriptor which is connected to terminal. tcsetprgrp是一项功能,用于基于连接到终端的文件描述符设置进程组。 If the file descriptor not connected to the terminal that time it will give the error. 如果那个时候文件描述符没有连接到终端,它将给出错误信息。

setpgrp is used for making the calling process as a process group leader. setpgrp用于使调用进程成为进程组负责人。 Refer this link. 请参考此链接。

tcsetpgrp is used to set the foreground process group of a controlling terminal (for job control functions). tcsetpgrp用于设置控制终端的前台进程组(用于作业控制功能)。

setpgrp is used to add some process to a group. setpgrp用于将某些进程添加到组中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM