/* Output buffer. */
int ocount; /* # characters in the buffer */
char *ohead, *otail; /* head and tail of the circular buffer */
- char obuf[2048]; /* buffer for bytes going to the pty reader */
+ char obuf[TTY_OUT_BYTES];
+ /* buffer for bytes going to the pty reader */
/* select() data. */
unsigned int select_ops; /* Which operations do we want to know about? */
};
static struct winsize winsize_defaults; /* = all zeroes */
+static const char lined[TTLINEDNAMELEN] = "termios"; /* line discipline */
+
/* Global variables for the TTY task (declared extern in tty.h). */
tty_t tty_table[NR_PTYS];
u32_t system_hz;
sigchar(tp, SIGWINCH, 0);
break;
case TIOCGETD: /* get line discipline */
- {
- int disc = TTYDISC;
- r = sys_safecopyto(endpt, grant, 0,
- (vir_bytes) &disc, (vir_bytes) sizeof(disc));
+ i = TTYDISC;
+ r = sys_safecopyto(endpt, grant, 0, (vir_bytes) &i, sizeof(i));
break;
- }
case TIOCSETD: /* set line discipline */
printf("TTY: TIOCSETD: can't set any other line discipline.\n");
r = ENOTTY;
break;
-
+ case TIOCGLINED: /* get line discipline as string */
+ r = sys_safecopyto(endpt, grant, 0, (vir_bytes) lined, sizeof(lined));
+ break;
+ case TIOCGQSIZE: /* get input/output queue sizes */
+ /* Not sure what to report here. We are using input and output queues
+ * of different sizes, and the IOCTL allows for one single value for
+ * both. So far this seems to be just for stty(1) so let's just report
+ * the larger of the two. TODO: revisit queue sizes altogether.
+ */
+ i = MAX(TTY_IN_BYTES, TTY_OUT_BYTES);
+ r = sys_safecopyto(endpt, grant, 0, (vir_bytes) &i, sizeof(i));
+ break;
case TIOCSCTTY:
/* Process sets this tty as its controlling tty */
tp->tty_pgrp = user_endpt;
#define PTYPX_MINOR 192
#define TTY_IN_BYTES 256 /* tty input queue size */
+#define TTY_OUT_BYTES 2048 /* tty output queue size */
#define TAB_SIZE 8 /* distance between tab stops */
#define TAB_MASK 7 /* mask to compute a tab stop position */
u32_t consoleline = CONS_MINOR;
u32_t kernel_msg_color = 0;
+static const char lined[TTLINEDNAMELEN] = "termios"; /* line discipline */
+
/* SEF functions and variables. */
static void sef_local_startup(void);
static int sef_cb_init_fresh(int type, sef_init_info_t *info);
beep_x(bell.kb_pitch, ticks);
break;
case TIOCGETD: /* get line discipline */
- {
- int disc = TTYDISC;
- r = sys_safecopyto(endpt, grant, 0,
- (vir_bytes) &disc, (vir_bytes) sizeof(disc));
+ i = TTYDISC;
+ r = sys_safecopyto(endpt, grant, 0, (vir_bytes) &i, sizeof(i));
break;
- }
case TIOCSETD: /* set line discipline */
printf("TTY: TIOCSETD: can't set any other line discipline.\n");
r = ENOTTY;
break;
+ case TIOCGLINED: /* get line discipline as string */
+ r = sys_safecopyto(endpt, grant, 0, (vir_bytes) lined, sizeof(lined));
+ break;
+ case TIOCGQSIZE: /* get input/output queue sizes */
+ i = TTY_IN_BYTES; /* best we can do.. */
+ r = sys_safecopyto(endpt, grant, 0, (vir_bytes) &i, sizeof(i));
+ break;
case KIOCSMAP:
/* Load a new keymap (only /dev/console). */
if (isconsole(tp)) r = kbd_loadmap(endpt, grant);