Blame src/unix/tty.c

Packit Service 7c31a4
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Packit Service 7c31a4
 *
Packit Service 7c31a4
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Packit Service 7c31a4
 * of this software and associated documentation files (the "Software"), to
Packit Service 7c31a4
 * deal in the Software without restriction, including without limitation the
Packit Service 7c31a4
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
Packit Service 7c31a4
 * sell copies of the Software, and to permit persons to whom the Software is
Packit Service 7c31a4
 * furnished to do so, subject to the following conditions:
Packit Service 7c31a4
 *
Packit Service 7c31a4
 * The above copyright notice and this permission notice shall be included in
Packit Service 7c31a4
 * all copies or substantial portions of the Software.
Packit Service 7c31a4
 *
Packit Service 7c31a4
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit Service 7c31a4
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit Service 7c31a4
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Packit Service 7c31a4
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Packit Service 7c31a4
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
Packit Service 7c31a4
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
Packit Service 7c31a4
 * IN THE SOFTWARE.
Packit Service 7c31a4
 */
Packit Service 7c31a4
Packit Service 7c31a4
#include "uv.h"
Packit Service 7c31a4
#include "internal.h"
Packit Service 7c31a4
#include "spinlock.h"
Packit Service 7c31a4
Packit Service 7c31a4
#include <stdlib.h>
Packit Service 7c31a4
#include <assert.h>
Packit Service 7c31a4
#include <unistd.h>
Packit Service 7c31a4
#include <termios.h>
Packit Service 7c31a4
#include <errno.h>
Packit Service 7c31a4
#include <sys/ioctl.h>
Packit Service 7c31a4
Packit Service 7c31a4
#if defined(__MVS__) && !defined(IMAXBEL)
Packit Service 7c31a4
#define IMAXBEL 0
Packit Service 7c31a4
#endif
Packit Service 7c31a4
Packit Service 7c31a4
#if defined(__PASE__)
Packit Service 7c31a4
/* On IBM i PASE, for better compatibility with running interactive programs in
Packit Service 7c31a4
 * a 5250 environment, isatty() will return true for the stdin/stdout/stderr
Packit Service 7c31a4
 * streams created by QSH/QP2TERM.
Packit Service 7c31a4
 *
Packit Service 7c31a4
 * For more, see docs on PASE_STDIO_ISATTY in
Packit Service 7c31a4
 * https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/apis/pase_environ.htm
Packit Service 7c31a4
 *
Packit Service 7c31a4
 * This behavior causes problems for Node as it expects that if isatty() returns
Packit Service 7c31a4
 * true that TTY ioctls will be supported by that fd (which is not an
Packit Service 7c31a4
 * unreasonable expectation) and when they don't it crashes with assertion
Packit Service 7c31a4
 * errors.
Packit Service 7c31a4
 *
Packit Service 7c31a4
 * Here, we create our own version of isatty() that uses ioctl() to identify
Packit Service 7c31a4
 * whether the fd is *really* a TTY or not.
Packit Service 7c31a4
 */
Packit Service 7c31a4
static int isreallyatty(int file) {
Packit Service 7c31a4
  int rc;
Packit Service 7c31a4
 
Packit Service 7c31a4
  rc = !ioctl(file, TXISATTY + 0x81, NULL);
Packit Service 7c31a4
  if (!rc && errno != EBADF)
Packit Service 7c31a4
      errno = ENOTTY;
Packit Service 7c31a4
Packit Service 7c31a4
  return rc;
Packit Service 7c31a4
}
Packit Service 7c31a4
#define isatty(fd) isreallyatty(fd)
Packit Service 7c31a4
#endif
Packit Service 7c31a4
Packit Service 7c31a4
static int orig_termios_fd = -1;
Packit Service 7c31a4
static struct termios orig_termios;
Packit Service 7c31a4
static uv_spinlock_t termios_spinlock = UV_SPINLOCK_INITIALIZER;
Packit Service 7c31a4
Packit Service 7c31a4
static int uv__tty_is_slave(const int fd) {
Packit Service 7c31a4
  int result;
Packit Service 7c31a4
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
Packit Service 7c31a4
  int dummy;
Packit Service 7c31a4
Packit Service 7c31a4
  result = ioctl(fd, TIOCGPTN, &dummy) != 0;
Packit Service 7c31a4
#elif defined(__APPLE__)
Packit Service 7c31a4
  char dummy[256];
Packit Service 7c31a4
Packit Service 7c31a4
  result = ioctl(fd, TIOCPTYGNAME, &dummy) != 0;
Packit Service 7c31a4
#elif defined(__NetBSD__)
Packit Service 7c31a4
  /*
Packit Service 7c31a4
   * NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the slave
Packit Service 7c31a4
   * device name for both descriptors, the master one and slave one.
Packit Service 7c31a4
   *
Packit Service 7c31a4
   * Implement function to compare major device number with pts devices.
Packit Service 7c31a4
   *
Packit Service 7c31a4
   * The major numbers are machine-dependent, on NetBSD/amd64 they are
Packit Service 7c31a4
   * respectively:
Packit Service 7c31a4
   *  - master tty: ptc - major 6
Packit Service 7c31a4
   *  - slave tty:  pts - major 5
Packit Service 7c31a4
   */
Packit Service 7c31a4
Packit Service 7c31a4
  struct stat sb;
Packit Service 7c31a4
  /* Lookup device's major for the pts driver and cache it. */
Packit Service 7c31a4
  static devmajor_t pts = NODEVMAJOR;
Packit Service 7c31a4
Packit Service 7c31a4
  if (pts == NODEVMAJOR) {
Packit Service 7c31a4
    pts = getdevmajor("pts", S_IFCHR);
Packit Service 7c31a4
    if (pts == NODEVMAJOR)
Packit Service 7c31a4
      abort();
Packit Service 7c31a4
  }
Packit Service 7c31a4
Packit Service 7c31a4
  /* Lookup stat structure behind the file descriptor. */
Packit Service 7c31a4
  if (fstat(fd, &sb) != 0)
Packit Service 7c31a4
    abort();
Packit Service 7c31a4
Packit Service 7c31a4
  /* Assert character device. */
Packit Service 7c31a4
  if (!S_ISCHR(sb.st_mode))
Packit Service 7c31a4
    abort();
Packit Service 7c31a4
Packit Service 7c31a4
  /* Assert valid major. */
Packit Service 7c31a4
  if (major(sb.st_rdev) == NODEVMAJOR)
Packit Service 7c31a4
    abort();
Packit Service 7c31a4
Packit Service 7c31a4
  result = (pts == major(sb.st_rdev));
Packit Service 7c31a4
#else
Packit Service 7c31a4
  /* Fallback to ptsname
Packit Service 7c31a4
   */
Packit Service 7c31a4
  result = ptsname(fd) == NULL;
Packit Service 7c31a4
#endif
Packit Service 7c31a4
  return result;
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) {
Packit Service 7c31a4
  uv_handle_type type;
Packit Service 7c31a4
  int flags;
Packit Service 7c31a4
  int newfd;
Packit Service 7c31a4
  int r;
Packit Service 7c31a4
  int saved_flags;
Packit Service 7c31a4
  int mode;
Packit Service 7c31a4
  char path[256];
Packit Service 7c31a4
  (void)unused; /* deprecated parameter is no longer needed */
Packit Service 7c31a4
Packit Service 7c31a4
  /* File descriptors that refer to files cannot be monitored with epoll.
Packit Service 7c31a4
   * That restriction also applies to character devices like /dev/random
Packit Service 7c31a4
   * (but obviously not /dev/tty.)
Packit Service 7c31a4
   */
Packit Service 7c31a4
  type = uv_guess_handle(fd);
Packit Service 7c31a4
  if (type == UV_FILE || type == UV_UNKNOWN_HANDLE)
Packit Service 7c31a4
    return UV_EINVAL;
Packit Service 7c31a4
Packit Service 7c31a4
  flags = 0;
Packit Service 7c31a4
  newfd = -1;
Packit Service 7c31a4
Packit Service 7c31a4
  /* Save the fd flags in case we need to restore them due to an error. */
Packit Service 7c31a4
  do
Packit Service 7c31a4
    saved_flags = fcntl(fd, F_GETFL);
Packit Service 7c31a4
  while (saved_flags == -1 && errno == EINTR);
Packit Service 7c31a4
Packit Service 7c31a4
  if (saved_flags == -1)
Packit Service 7c31a4
    return UV__ERR(errno);
Packit Service 7c31a4
  mode = saved_flags & O_ACCMODE;
Packit Service 7c31a4
Packit Service 7c31a4
  /* Reopen the file descriptor when it refers to a tty. This lets us put the
Packit Service 7c31a4
   * tty in non-blocking mode without affecting other processes that share it
Packit Service 7c31a4
   * with us.
Packit Service 7c31a4
   *
Packit Service 7c31a4
   * Example: `node | cat` - if we put our fd 0 in non-blocking mode, it also
Packit Service 7c31a4
   * affects fd 1 of `cat` because both file descriptors refer to the same
Packit Service 7c31a4
   * struct file in the kernel. When we reopen our fd 0, it points to a
Packit Service 7c31a4
   * different struct file, hence changing its properties doesn't affect
Packit Service 7c31a4
   * other processes.
Packit Service 7c31a4
   */
Packit Service 7c31a4
  if (type == UV_TTY) {
Packit Service 7c31a4
    /* Reopening a pty in master mode won't work either because the reopened
Packit Service 7c31a4
     * pty will be in slave mode (*BSD) or reopening will allocate a new
Packit Service 7c31a4
     * master/slave pair (Linux). Therefore check if the fd points to a
Packit Service 7c31a4
     * slave device.
Packit Service 7c31a4
     */
Packit Service 7c31a4
    if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0)
Packit Service 7c31a4
      r = uv__open_cloexec(path, mode | O_NOCTTY);
Packit Service 7c31a4
    else
Packit Service 7c31a4
      r = -1;
Packit Service 7c31a4
Packit Service 7c31a4
    if (r < 0) {
Packit Service 7c31a4
      /* fallback to using blocking writes */
Packit Service 7c31a4
      if (mode != O_RDONLY)
Packit Service 7c31a4
        flags |= UV_HANDLE_BLOCKING_WRITES;
Packit Service 7c31a4
      goto skip;
Packit Service 7c31a4
    }
Packit Service 7c31a4
Packit Service 7c31a4
    newfd = r;
Packit Service 7c31a4
Packit Service 7c31a4
    r = uv__dup2_cloexec(newfd, fd);
Packit Service 7c31a4
    if (r < 0 && r != UV_EINVAL) {
Packit Service 7c31a4
      /* EINVAL means newfd == fd which could conceivably happen if another
Packit Service 7c31a4
       * thread called close(fd) between our calls to isatty() and open().
Packit Service 7c31a4
       * That's a rather unlikely event but let's handle it anyway.
Packit Service 7c31a4
       */
Packit Service 7c31a4
      uv__close(newfd);
Packit Service 7c31a4
      return r;
Packit Service 7c31a4
    }
Packit Service 7c31a4
Packit Service 7c31a4
    fd = newfd;
Packit Service 7c31a4
  }
Packit Service 7c31a4
Packit Service 7c31a4
skip:
Packit Service 7c31a4
  uv__stream_init(loop, (uv_stream_t*) tty, UV_TTY);
Packit Service 7c31a4
Packit Service 7c31a4
  /* If anything fails beyond this point we need to remove the handle from
Packit Service 7c31a4
   * the handle queue, since it was added by uv__handle_init in uv_stream_init.
Packit Service 7c31a4
   */
Packit Service 7c31a4
Packit Service 7c31a4
  if (!(flags & UV_HANDLE_BLOCKING_WRITES))
Packit Service 7c31a4
    uv__nonblock(fd, 1);
Packit Service 7c31a4
Packit Service 7c31a4
#if defined(__APPLE__)
Packit Service 7c31a4
  r = uv__stream_try_select((uv_stream_t*) tty, &fd;;
Packit Service 7c31a4
  if (r) {
Packit Service 7c31a4
    int rc = r;
Packit Service 7c31a4
    if (newfd != -1)
Packit Service 7c31a4
      uv__close(newfd);
Packit Service 7c31a4
    QUEUE_REMOVE(&tty->handle_queue);
Packit Service 7c31a4
    do
Packit Service 7c31a4
      r = fcntl(fd, F_SETFL, saved_flags);
Packit Service 7c31a4
    while (r == -1 && errno == EINTR);
Packit Service 7c31a4
    return rc;
Packit Service 7c31a4
  }
Packit Service 7c31a4
#endif
Packit Service 7c31a4
Packit Service 7c31a4
  if (mode != O_WRONLY)
Packit Service 7c31a4
    flags |= UV_HANDLE_READABLE;
Packit Service 7c31a4
  if (mode != O_RDONLY)
Packit Service 7c31a4
    flags |= UV_HANDLE_WRITABLE;
Packit Service 7c31a4
Packit Service 7c31a4
  uv__stream_open((uv_stream_t*) tty, fd, flags);
Packit Service 7c31a4
  tty->mode = UV_TTY_MODE_NORMAL;
Packit Service 7c31a4
Packit Service 7c31a4
  return 0;
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
static void uv__tty_make_raw(struct termios* tio) {
Packit Service 7c31a4
  assert(tio != NULL);
Packit Service 7c31a4
Packit Service 7c31a4
#if defined __sun || defined __MVS__
Packit Service 7c31a4
  /*
Packit Service 7c31a4
   * This implementation of cfmakeraw for Solaris and derivatives is taken from
Packit Service 7c31a4
   * http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html.
Packit Service 7c31a4
   */
Packit Service 7c31a4
  tio->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
Packit Service 7c31a4
                    IGNCR | ICRNL | IXON);
Packit Service 7c31a4
  tio->c_oflag &= ~OPOST;
Packit Service 7c31a4
  tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
Packit Service 7c31a4
  tio->c_cflag &= ~(CSIZE | PARENB);
Packit Service 7c31a4
  tio->c_cflag |= CS8;
Packit Service 7c31a4
#else
Packit Service 7c31a4
  cfmakeraw(tio);
Packit Service 7c31a4
#endif /* #ifdef __sun */
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
Packit Service 7c31a4
  struct termios tmp;
Packit Service 7c31a4
  int fd;
Packit Service 7c31a4
Packit Service 7c31a4
  if (tty->mode == (int) mode)
Packit Service 7c31a4
    return 0;
Packit Service 7c31a4
Packit Service 7c31a4
  fd = uv__stream_fd(tty);
Packit Service 7c31a4
  if (tty->mode == UV_TTY_MODE_NORMAL && mode != UV_TTY_MODE_NORMAL) {
Packit Service 7c31a4
    if (tcgetattr(fd, &tty->orig_termios))
Packit Service 7c31a4
      return UV__ERR(errno);
Packit Service 7c31a4
Packit Service 7c31a4
    /* This is used for uv_tty_reset_mode() */
Packit Service 7c31a4
    uv_spinlock_lock(&termios_spinlock);
Packit Service 7c31a4
    if (orig_termios_fd == -1) {
Packit Service 7c31a4
      orig_termios = tty->orig_termios;
Packit Service 7c31a4
      orig_termios_fd = fd;
Packit Service 7c31a4
    }
Packit Service 7c31a4
    uv_spinlock_unlock(&termios_spinlock);
Packit Service 7c31a4
  }
Packit Service 7c31a4
Packit Service 7c31a4
  tmp = tty->orig_termios;
Packit Service 7c31a4
  switch (mode) {
Packit Service 7c31a4
    case UV_TTY_MODE_NORMAL:
Packit Service 7c31a4
      break;
Packit Service 7c31a4
    case UV_TTY_MODE_RAW:
Packit Service 7c31a4
      tmp.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
Packit Service 7c31a4
      tmp.c_oflag |= (ONLCR);
Packit Service 7c31a4
      tmp.c_cflag |= (CS8);
Packit Service 7c31a4
      tmp.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
Packit Service 7c31a4
      tmp.c_cc[VMIN] = 1;
Packit Service 7c31a4
      tmp.c_cc[VTIME] = 0;
Packit Service 7c31a4
      break;
Packit Service 7c31a4
    case UV_TTY_MODE_IO:
Packit Service 7c31a4
      uv__tty_make_raw(&tmp);
Packit Service 7c31a4
      break;
Packit Service 7c31a4
  }
Packit Service 7c31a4
Packit Service 7c31a4
  /* Apply changes after draining */
Packit Service 7c31a4
  if (tcsetattr(fd, TCSADRAIN, &tmp))
Packit Service 7c31a4
    return UV__ERR(errno);
Packit Service 7c31a4
Packit Service 7c31a4
  tty->mode = mode;
Packit Service 7c31a4
  return 0;
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) {
Packit Service 7c31a4
  struct winsize ws;
Packit Service 7c31a4
  int err;
Packit Service 7c31a4
Packit Service 7c31a4
  do
Packit Service 7c31a4
    err = ioctl(uv__stream_fd(tty), TIOCGWINSZ, &ws);
Packit Service 7c31a4
  while (err == -1 && errno == EINTR);
Packit Service 7c31a4
Packit Service 7c31a4
  if (err == -1)
Packit Service 7c31a4
    return UV__ERR(errno);
Packit Service 7c31a4
Packit Service 7c31a4
  *width = ws.ws_col;
Packit Service 7c31a4
  *height = ws.ws_row;
Packit Service 7c31a4
Packit Service 7c31a4
  return 0;
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
uv_handle_type uv_guess_handle(uv_file file) {
Packit Service 7c31a4
  struct sockaddr sa;
Packit Service 7c31a4
  struct stat s;
Packit Service 7c31a4
  socklen_t len;
Packit Service 7c31a4
  int type;
Packit Service 7c31a4
Packit Service 7c31a4
  if (file < 0)
Packit Service 7c31a4
    return UV_UNKNOWN_HANDLE;
Packit Service 7c31a4
Packit Service 7c31a4
  if (isatty(file))
Packit Service 7c31a4
    return UV_TTY;
Packit Service 7c31a4
Packit Service 7c31a4
  if (fstat(file, &s))
Packit Service 7c31a4
    return UV_UNKNOWN_HANDLE;
Packit Service 7c31a4
Packit Service 7c31a4
  if (S_ISREG(s.st_mode))
Packit Service 7c31a4
    return UV_FILE;
Packit Service 7c31a4
Packit Service 7c31a4
  if (S_ISCHR(s.st_mode))
Packit Service 7c31a4
    return UV_FILE;  /* XXX UV_NAMED_PIPE? */
Packit Service 7c31a4
Packit Service 7c31a4
  if (S_ISFIFO(s.st_mode))
Packit Service 7c31a4
    return UV_NAMED_PIPE;
Packit Service 7c31a4
Packit Service 7c31a4
  if (!S_ISSOCK(s.st_mode))
Packit Service 7c31a4
    return UV_UNKNOWN_HANDLE;
Packit Service 7c31a4
Packit Service 7c31a4
  len = sizeof(type);
Packit Service 7c31a4
  if (getsockopt(file, SOL_SOCKET, SO_TYPE, &type, &len))
Packit Service 7c31a4
    return UV_UNKNOWN_HANDLE;
Packit Service 7c31a4
Packit Service 7c31a4
  len = sizeof(sa);
Packit Service 7c31a4
  if (getsockname(file, &sa, &len))
Packit Service 7c31a4
    return UV_UNKNOWN_HANDLE;
Packit Service 7c31a4
Packit Service 7c31a4
  if (type == SOCK_DGRAM)
Packit Service 7c31a4
    if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
Packit Service 7c31a4
      return UV_UDP;
Packit Service 7c31a4
Packit Service 7c31a4
  if (type == SOCK_STREAM) {
Packit Service 7c31a4
#if defined(_AIX) || defined(__DragonFly__)
Packit Service 7c31a4
    /* on AIX/DragonFly the getsockname call returns an empty sa structure
Packit Service 7c31a4
     * for sockets of type AF_UNIX.  For all other types it will
Packit Service 7c31a4
     * return a properly filled in structure.
Packit Service 7c31a4
     */
Packit Service 7c31a4
    if (len == 0)
Packit Service 7c31a4
      return UV_NAMED_PIPE;
Packit Service 7c31a4
#endif /* defined(_AIX) || defined(__DragonFly__) */
Packit Service 7c31a4
Packit Service 7c31a4
    if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
Packit Service 7c31a4
      return UV_TCP;
Packit Service 7c31a4
    if (sa.sa_family == AF_UNIX)
Packit Service 7c31a4
      return UV_NAMED_PIPE;
Packit Service 7c31a4
  }
Packit Service 7c31a4
Packit Service 7c31a4
  return UV_UNKNOWN_HANDLE;
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
/* This function is async signal-safe, meaning that it's safe to call from
Packit Service 7c31a4
 * inside a signal handler _unless_ execution was inside uv_tty_set_mode()'s
Packit Service 7c31a4
 * critical section when the signal was raised.
Packit Service 7c31a4
 */
Packit Service 7c31a4
int uv_tty_reset_mode(void) {
Packit Service 7c31a4
  int saved_errno;
Packit Service 7c31a4
  int err;
Packit Service 7c31a4
Packit Service 7c31a4
  saved_errno = errno;
Packit Service 7c31a4
  if (!uv_spinlock_trylock(&termios_spinlock))
Packit Service 7c31a4
    return UV_EBUSY;  /* In uv_tty_set_mode(). */
Packit Service 7c31a4
Packit Service 7c31a4
  err = 0;
Packit Service 7c31a4
  if (orig_termios_fd != -1)
Packit Service 7c31a4
    if (tcsetattr(orig_termios_fd, TCSANOW, &orig_termios))
Packit Service 7c31a4
      err = UV__ERR(errno);
Packit Service 7c31a4
Packit Service 7c31a4
  uv_spinlock_unlock(&termios_spinlock);
Packit Service 7c31a4
  errno = saved_errno;
Packit Service 7c31a4
Packit Service 7c31a4
  return err;
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
void uv_tty_set_vterm_state(uv_tty_vtermstate_t state) {
Packit Service 7c31a4
}
Packit Service 7c31a4
Packit Service 7c31a4
int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state) {
Packit Service 7c31a4
  return UV_ENOTSUP;
Packit Service 7c31a4
}