1

I use fork() in order to exec some another program, for example "vim" or "man bash". But, at that moment I lost control, I can't print anything in vim or scroll or quite.

So, my question: how give child full access over terminal(input/output) and get it back for parent after child death?

Acapello
  • 127
  • 9

1 Answers1

0

So, my question: how give child full access over terminal(input/output) and get it back for parent after child death?

waitpid() and SIGCHLD are mechanisms for knowing when a child process has finished. The functions tcgetpgrp(fd) and tcsetpgrp(fd,pgrp) and ctermid() can be used to place a program in the foreground of a terminal.

Otherwise, the information in tcsetpgrp() in 'C' is probably instructive.

Community
  • 1
  • 1
artless noise
  • 21,212
  • 6
  • 68
  • 105