Orion
Barry Importing existing Orion kernel d41a53c (3 years, 2 months ago)
/*
* This file implements the TTY ioctl() backend. It stores many of the settings
* which are used throughout the rest of the TTY driver.
*/
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <termios.h>
#include "../../vfs/vfs.h"
extern Termios tty;
extern int ttyW, ttyH;
extern int vgaWidth, vgaHeight;
int
tty_ioctl(File *file, unsigned long request, uintptr_t argp)
{
Termios *ts;
Winsize *ws;
switch (request) {
case TCGETS:
ts = (void *) argp;
memcpy(ts, &tty, sizeof(Termios));
return 0;
case TCSETS:
ts = (void *) argp;
memcpy(&tty, ts, sizeof(Termios));
return 0;
case TCGWINSZ:
ws = (void *) argp;
ws->rows = ttyH;
ws->cols = ttyW;
ws->xres = vgaWidth;
ws->yres = vgaHeight;
return 0;
}
}