Sample Header Ad - 728x90

How exactly a CTRL^C passes a signal to process

0 votes
1 answer
1535 views
I'm trying to figure out how exactly CTRL^C sends a SIGINT to a process. Let's consider a pseudo-terminal system. I'll write what I know (or think I know lol) and please add/replace where needed: The players are: - Xterm - This is a user space program that reads from the keyboard (using the X window system) and renders a picture to the screen. Every character it gets from the keyboard is passed to the pty master . - User process - the user process that runs as a foreground job of the terminal. Usually when opening a Xterm it runs bash or some other shell program as this user process. - PTY device - This is a character device that the user process is connected to as its stdin, stdout, stderr. Everything that's written by the process to stdout is processed by the TTY driver and its line discipline, and passed as input to the maser side, and vice versa. I don't mind at the moment how exactly the kernel passes the signal to the process once the line discipline/TTY driver understands that it should send such a signal to the process. What I'm interested in is how, after I press CTRL^Z on my keyboard, the Xterm (Which is the process that reads this key presses) passes this information to the pty master ## EDIT Thanks for the answers. I welcome you to response on this thread where I actually tried to simulate this by writing 0x3 to a PTY master and see what happens in the slave. Could you guys respond to that?
Asked by YoavKlein (392 rep)
Jan 19, 2021, 05:17 AM
Last activity: Jan 19, 2021, 07:30 AM