0
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.

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.

Sourav Ghosh
  • 133,132
  • 16
  • 183
  • 261

2 Answers2

0

tcsetprgrp is a function that is used for set the process group based on the file descriptor which is connected to terminal. 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. Refer this link.

Karthikeyan.R.S
  • 3,991
  • 1
  • 19
  • 31
0

tcsetpgrp is used to set the foreground process group of a controlling terminal (for job control functions).

setpgrp is used to add some process to a group.

Jean-Baptiste Yunès
  • 34,548
  • 4
  • 48
  • 69