diff options
author | Enno Boland <g@s01.de> | 2016-03-23 23:18:53 +0100 |
---|---|---|
committer | Saúl Ibarra Corretgé <saghul@gmail.com> | 2016-04-01 11:13:22 +0200 |
commit | 387102b2475776e5e40a3f6da5041eb674ad4abf (patch) | |
tree | a21fc90a0acd1c77b12408c542b14819deec7700 /docs/src | |
parent | 643c9e9c32895e166e372200779ed7d5b2365d18 (diff) | |
download | libuv-387102b2475776e5e40a3f6da5041eb674ad4abf.tar.gz libuv-387102b2475776e5e40a3f6da5041eb674ad4abf.zip |
unix: open ttyname instead of /dev/tty
Find the real name of the tty using ttyname_r(3) instead of
opening "/dev/tty" which causes trouble if the fd doesn't point to the
controlling terminal.
PR-URL: https://github.com/libuv/libuv/pull/779
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/tty.rst | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/docs/src/tty.rst b/docs/src/tty.rst index 655dca9c..01a05852 100644 --- a/docs/src/tty.rst +++ b/docs/src/tty.rst @@ -58,14 +58,22 @@ API `readable`, specifies if you plan on calling :c:func:`uv_read_start` with this stream. stdin is readable, stdout is not. - On Unix this function will try to open ``/dev/tty`` and use it if the passed - file descriptor refers to a TTY. This lets libuv put the tty in non-blocking - mode without affecting other processes that share the tty. + On Unix this function will determine the path of the fd of the terminal + using :man:`ttyname_r(3)`, open it, and use it if the passed file descriptor + refers to a TTY. This lets libuv put the tty in non-blocking mode without + affecting other processes that share the tty. + + This function is not thread safe on systems that don't support + ioctl TIOCGPTN or TIOCPTYGNAME, for instance OpenBSD and Solaris. .. note:: - If opening ``/dev/tty`` fails, libuv falls back to blocking writes for + If reopening the TTY fails, libuv falls back to blocking writes for non-readable TTY streams. + .. versionchanged:: 1.9.0: the path of the TTY is determined by + :man:`ttyname_r(3)`. In earlier versions libuv opened + `/dev/tty` instead. + .. versionchanged:: 1.5.0: trying to initialize a TTY stream with a file descriptor that refers to a file returns `UV_EINVAL` on UNIX. |