1#include "libc.h"
2#include <errno.h>
3#include <fcntl.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <sys/ioctl.h>
7
8int posix_openpt(int flags) {
9    return open("/dev/ptmx", flags);
10}
11
12int grantpt(int fd) {
13    return 0;
14}
15
16int unlockpt(int fd) {
17    int unlock = 0;
18    return ioctl(fd, TIOCSPTLCK, &unlock);
19}
20
21int __ptsname_r(int fd, char* buf, size_t len) {
22    // TODO(kulakowski) terminal handling.
23    return ENOSYS;
24}
25
26weak_alias(__ptsname_r, ptsname_r);
27