vt: TIOCL to read kmsg_redirect from user space
RFC PATCH 1/1 vt: TIOCL to read kmsg_redirect from user space
Hi,
The userland suspend tool we're working on needs to get the current value of kmsg_redirect from the kernel so that it can save it and restore it after resume. Unfortunetely there only is TIOCL_SETKMSGREDIRECT allowing us to set this value from the user space.
The appended patch adds the "missing" TIOCL_GETKMSGREDIRECT that we need.
Comments welcome.
Greetings,
Rafael
--- drivers/char/vt.c | 4 ++++ include/linux/tiocl.h | 1 + 2 files changed, 5 insertions(+)
drivers/char/vt.c +4 -0
@@ -2328,6 +2328,10 @@ int tioclinux(struct tty_struct *tty, uncase TIOCL_SETVESABLANK :set_vesa_blanking (p);break ; +case TIOCL_GETKMSGREDIRECT : + data = kmsg_redirect; + ret =__put_user (data, p); +break ;case TIOCL_SETKMSGREDIRECT :if (!capable (CAP_SYS_ADMIN )) { ret = -EPERM ;
include/linux/tiocl.h +1 -0
@@ -34,5 +34,6 @@ struct tiocl_selection {#define TIOCL_SCROLLCONSOLE 13/* scroll console */ #define TIOCL_BLANKSCREEN 14/* keep screen blank even if a key is pressed */ #define TIOCL_BLANKEDSCREEN 15/* return which vt was blanked */ +#define TIOCL_GETKMSGREDIRECT 17/* get the vt the kernel messages are restricted to */ #endif /* _LINUX_TIOCL_H */
Hi!
Quoted 9 lines
The userland suspend tool we're working on needs to get the current value of
kmsg_redirectfrom the kernel so that it can save it and restore it after resume. Unfortunetely there only isTIOCL_SETKMSGREDIRECTallowing us to set this value from the user space.The appended patch adds the "missing"
TIOCL_GETKMSGREDIRECTthat we need.Comments welcome.
Looks good to me.
Pavel
Quoted 30 lines
drivers/char/vt.c | 4 ++++ include/linux/tiocl.h | 1 + 2 files changed, 5 insertions(+)Index:
linux-2.6.16-mm1/drivers/char/vt.c
===================================================================drivers/char/vt.c +4
-0@@ -2328,6 +2328,10 @@ int tioclinux(struct tty_struct *tty, uncase TIOCL_SETVESABLANK :set_vesa_blanking (p);break ; +case TIOCL_GETKMSGREDIRECT : + data = kmsg_redirect; + ret =__put_user (data, p); +break ;case TIOCL_SETKMSGREDIRECT :if (!capable (CAP_SYS_ADMIN )) { ret = -EPERM ;Index:
linux-2.6.16-mm1/include/linux/tiocl.h
===================================================================include/linux/tiocl.h +1
-0@@ -34,5 +34,6 @@ struct tiocl_selection {#define TIOCL_SCROLLCONSOLE 13/* scroll console */ #define TIOCL_BLANKSCREEN 14/* keep screen blank even if a key is pressed */ #define TIOCL_BLANKEDSCREEN 15/* return which vt was blanked */ +#define TIOCL_GETKMSGREDIRECT 17/* get the vt the kernel messages are restricted to */ #endif /* _LINUX_TIOCL_H */
Signature · 1 line
Picture of sleeping (Linux) penguin wanted...