diff --git a/src/pty.c b/src/pty.c index 2a03121..920473a 100644 --- a/src/pty.c +++ b/src/pty.c @@ -428,6 +428,22 @@ buf: return 0; } +void kmscon_pty_signal(struct kmscon_pty *pty, int signum) +{ + int ret; + + if (!pty || !pty_is_open(pty) || signum < 0) + return; + + ret = ioctl(pty->fd, TIOCSIG, signum); + if (ret) { + log_warn("cannot send signal %d to child", signum); + return; + } + + log_debug("send signal %d to child", signum); +} + void kmscon_pty_resize(struct kmscon_pty *pty, unsigned short width, unsigned short height) { diff --git a/src/pty.h b/src/pty.h index 675cc17..d8d9214 100644 --- a/src/pty.h +++ b/src/pty.h @@ -60,11 +60,7 @@ int kmscon_pty_open(struct kmscon_pty *pty, unsigned short width, void kmscon_pty_close(struct kmscon_pty *pty); int kmscon_pty_write(struct kmscon_pty *pty, const char *u8, size_t len); - -/* - * Call this whenever the size of the screen (rows or columns) changes. The - * kernel and child process need to be notified. - */ +void kmscon_pty_signal(struct kmscon_pty *pty, int signum); void kmscon_pty_resize(struct kmscon_pty *pty, unsigned short width, unsigned short height);