Sample Header Ad - 728x90

Why can't bash map ^C to intr signal if invoked as init?

2 votes
1 answer
347 views
If I make the bash as the first process invoked (i.e as init), as a result it will display the following:
init: cannot set terminal process group (-1): Inappropriate ioctl for device
init: no job control in this shell
And no signals (e.g ^C, ^Z) work. Through reading the source code of bash-5.1.12, the problem is located at the expression in job.c line 4501: (t = tcgetpgrp (shell_tty)) == -1 The error value is ENOTTY, which mean that the calling process does not have a controlling terminal. Why is Bash without a controlling terminal when invoked as init?
Asked by Li-Guangda (277 rep)
Feb 17, 2022, 04:17 AM
Last activity: Jun 14, 2022, 10:29 AM