diff options
author | cjihrig <cjihrig@gmail.com> | 2017-10-02 19:44:44 -0400 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-10-05 12:08:33 -0700 |
commit | fca6c5839a6154275913656dfedb3242959031e3 (patch) | |
tree | e1fed70c4929b71306e6a18a92bf5501245a286c /deps/uv/src/unix/tty.c | |
parent | b9a55a93c91fb7fd7ac81e182f843f28014179ca (diff) | |
download | android-node-v8-fca6c5839a6154275913656dfedb3242959031e3.tar.gz android-node-v8-fca6c5839a6154275913656dfedb3242959031e3.tar.bz2 android-node-v8-fca6c5839a6154275913656dfedb3242959031e3.zip |
deps: upgrade libuv to 1.15.0
PR-URL: https://github.com/nodejs/node/pull/15745
Refs: https://github.com/nodejs/node/pull/15380
Refs: https://github.com/nodejs/node/issues/15683
Fixes: https://github.com/nodejs/node/issues/15394
Fixes: https://github.com/nodejs/node/issues/15770
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/uv/src/unix/tty.c')
-rw-r--r-- | deps/uv/src/unix/tty.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/deps/uv/src/unix/tty.c b/deps/uv/src/unix/tty.c index b2d37f4c2c..357f9748f6 100644 --- a/deps/uv/src/unix/tty.c +++ b/deps/uv/src/unix/tty.c @@ -48,6 +48,42 @@ static int uv__tty_is_slave(const int fd) { char dummy[256]; result = ioctl(fd, TIOCPTYGNAME, &dummy) != 0; +#elif defined(__NetBSD__) + /* + * NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the slave + * device name for both descriptors, the master one and slave one. + * + * Implement function to compare major device number with pts devices. + * + * The major numbers are machine-dependent, on NetBSD/amd64 they are + * respectively: + * - master tty: ptc - major 6 + * - slave tty: pts - major 5 + */ + + struct stat sb; + /* Lookup device's major for the pts driver and cache it. */ + static devmajor_t pts = NODEVMAJOR; + + if (pts == NODEVMAJOR) { + pts = getdevmajor("pts", S_IFCHR); + if (pts == NODEVMAJOR) + abort(); + } + + /* Lookup stat structure behind the file descriptor. */ + if (fstat(fd, &sb) != 0) + abort(); + + /* Assert character device. */ + if (!S_ISCHR(sb.st_mode)) + abort(); + + /* Assert valid major. */ + if (major(sb.st_rdev) == NODEVMAJOR) + abort(); + + result = (pts == major(sb.st_rdev)); #else /* Fallback to ptsname */ |