pty: add kmscon_pty_signal()
Allow to send arbitrary signals to the foreground process group of the pty. Linux supports the TIOCSIG ioctl so we actually do not need to implement this on our own, yeah! Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
84b87c320b
commit
3bcce95be3
16
src/pty.c
16
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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user