summaryrefslogtreecommitdiff
path: root/kernel/drivers/pst.c
blob: 77b1b8b014710f721aa73e0114fb5a02a1476c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <drivers/pst.h>
#include <fs/tmpfs.h>
#include <fs/vfs.h>

int openpty(int *amaster, int *aslave, char *name,
            /*const struct termios*/ void *termp,
            /*const struct winsize*/ void *winp) {
  (void)name;
  (void)termp;
  (void)winp;
  int fd[2];
  pipe(fd); // This depends upon that pipe will support read and write
            // through the same fd. In reality this should not be the
            // case.
  get_vfs_fd(fd[0], NULL)->is_tty = 1;
  get_vfs_fd(fd[1], NULL)->is_tty = 1;
  *amaster = fd[0];
  *aslave = fd[1];
  return 0;
}