2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and
3 * geoffrey hing <ghing@net.ohio-state.edu>
4 * Licensed under the GPL
18 #define TTY_LOG_DIR "./"
20 /* Set early in boot and then unchanged */
21 static char *tty_log_dir = TTY_LOG_DIR;
22 static int tty_log_fd = -1;
24 #define TTY_LOG_OPEN 1
25 #define TTY_LOG_CLOSE 2
26 #define TTY_LOG_WRITE 3
34 int open_tty_log(void *tty)
37 struct tty_log_buf data;
38 char buf[strlen(tty_log_dir) + sizeof("01234567890-01234567\0")];
42 data = ((struct tty_log_buf) { what : TTY_LOG_OPEN,
43 tty : (unsigned long) tty,
45 write(tty_log_fd, &data, sizeof(data));
49 gettimeofday(&tv, NULL);
50 sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec,
51 (unsigned int) tv.tv_usec);
53 fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))),
56 printk("open_tty_log : couldn't open '%s', errno = %d\n",
62 void close_tty_log(int fd, void *tty)
64 struct tty_log_buf data;
67 data = ((struct tty_log_buf) { what : TTY_LOG_CLOSE,
68 tty : (unsigned long) tty,
70 write(tty_log_fd, &data, sizeof(data));
76 int write_tty_log(int fd, char *buf, int len, void *tty)
78 struct tty_log_buf data;
81 data = ((struct tty_log_buf) { what : TTY_LOG_WRITE,
82 tty : (unsigned long) tty,
84 write(tty_log_fd, &data, sizeof(data));
86 return(write(fd, buf, len));
89 static int __init set_tty_log_dir(char *name, int *add)
95 __uml_setup("tty_log_dir=", set_tty_log_dir,
96 "tty_log_dir=<directory>\n"
97 " This is used to specify the directory where the logs of all pty\n"
98 " data from this UML machine will be written.\n\n"
101 static int __init set_tty_log_fd(char *name, int *add)
105 tty_log_fd = strtoul(name, &end, 0);
106 if((*end != '\0') || (end == name)){
107 printk("set_tty_log_fd - strtoul failed on '%s'\n", name);
113 __uml_setup("tty_log_fd=", set_tty_log_fd,
115 " This is used to specify a preconfigured file descriptor to which all\n"
116 " tty data will be written. Preconfigure the descriptor with something\n"
117 " like '10>tty_log tty_log_fd=10'.\n\n"
122 * Overrides for Emacs so that we follow Linus's tabbing style.
123 * Emacs will notice this stuff at the end of the file and automatically
124 * adjust the settings for this buffer only. This must remain at the end
126 * ---------------------------------------------------------------------------
128 * c-file-style: "linux"