Definitely missing an include for TIOCLINUX
either #include some termios.h (not sure which one is correct) or #define TIOCLINUX 0x0000541C
On Wed, 25 May 2005, Maciej Żenczykowski wrote:
Would you want something like this?
Unfortunately the following code was written for a non-standard libc, so it might (will) require some tweaking to get it to compile.
/*
- GPLv2 (c) Copyright 1999-2005 by Maciej Zenczykowski.
- Program redirects all kernel messages to tty1
- (the first virtual terminal).
*/
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h>
int main() { int fd, res; char table[2]; table[0] = 11; // TIOCLINUX 11 -> set_kernel_message_redirect table[1] = 1; // ttyN=1, 0 to turn off redirection
fd = open("/dev/tty0", O_RDONLY, 0); if (fd < 0) { fprintf(stderr, "ERROR #%d: open_console /dev/tty0\n", errno); return 1; }; res = ioctl(fd, TIOCLINUX, &table); if (res < 0) { fprintf(stderr, "ERROR #%d: set_kmsg_redirect\n", errno); close(fd); return 2; };
close(fd); return 0; }; _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos