Closed ShoichiroKitano closed 7 months ago
Thanks. Do you know if TIOCSPGRP also needs to pass through to the slave pty from the master?
If so, it'd be useful to factor out this new code to get the other side so it could be used by the other ioctls.
@tbodt Thank you for your comments.
I have verified that in the case of a pty master, TIOCSPGRP also needs to set the process group ID for the slave side.
Are you suggesting creating a function like the following?
static struct *tty get_slave_side_tty(struct *tty tty) {
if (tty->type == TTY_PSEUDO_MASTER_MAJOR) {
return tty->pty.other;
} else {
return tty;
}
}
Yes, exactly
@tbodt I have made the corrections.
Thanks!
I have made modifications to TIOCGPGRP for the pty master.
Currently, if the tty of the master is not set as the controlling terminal for the process group to which the current process belongs, it results in an error. However, the actual behavior in Linux is that when a file descriptor of the pty master is specified, it sets the process group ID of the controlling terminal to the corresponding slave when available. Therefore, for the pty master, I have made the modification to return the fg_group of the tty set as 'other.'
Furthermore, I have corrected the name from TIOCGPRGP, which seems to be a typo, to TIOCGPGRP.