diff options
author | Jameson Nash <vtjnash@gmail.com> | 2018-08-28 10:47:17 -0400 |
---|---|---|
committer | Santiago Gimeno <santiago.gimeno@gmail.com> | 2018-09-19 18:19:28 +0200 |
commit | 40498795ab457dfa3a00a5aad45ba9db3bf71588 (patch) | |
tree | 6202925fc9668ff30a76df27526cd6dbb3c34403 /docs/src | |
parent | 956bf6b71a3e79fad106d46ba3f0bcbf999c0651 (diff) | |
download | libuv-40498795ab457dfa3a00a5aad45ba9db3bf71588.tar.gz libuv-40498795ab457dfa3a00a5aad45ba9db3bf71588.zip |
stream: autodetect direction
Previously, we required the user to specify the expected read/write
flags for a pipe or tty. But we've already been asking the OS to tell us
what they actually are (fcntl F_GETFL), so we can hopefully just use
that information directly.
Fixes: https://github.com/libuv/libuv/issues/1936
PR-URL: https://github.com/libuv/libuv/pull/1964
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/guide/utilities.rst | 8 | ||||
-rw-r--r-- | docs/src/tty.rst | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/docs/src/guide/utilities.rst b/docs/src/guide/utilities.rst index abe6fa8d..4d58838d 100644 --- a/docs/src/guide/utilities.rst +++ b/docs/src/guide/utilities.rst @@ -370,9 +370,10 @@ terminal information. The first thing to do is to initialize a ``uv_tty_t`` with the file descriptor it reads/writes from. This is achieved with:: - int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable) + int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int unused) -Set ``readable`` to true if you plan to use ``uv_read_start()`` on the stream. +The ``unused`` parameter is now auto-detected and ignored. It previously needed +to be set to use ``uv_read_start()`` on the stream. It is then best to use ``uv_tty_set_mode`` to set the mode to *normal* which enables most TTY formatting, flow-control and other settings. Other_ modes @@ -423,6 +424,9 @@ can try `ncurses`_. .. _ncurses: http://www.gnu.org/software/ncurses/ncurses.html +.. versionchanged:: 1.23.1: the `readable` parameter is now unused and ignored. + The appropriate value will now be auto-detected from the kernel. + ---- .. [#] I was first introduced to the term baton in this context, in Konstantin diff --git a/docs/src/tty.rst b/docs/src/tty.rst index 01a05852..9889a0a0 100644 --- a/docs/src/tty.rst +++ b/docs/src/tty.rst @@ -46,7 +46,7 @@ N/A API --- -.. c:function:: int uv_tty_init(uv_loop_t* loop, uv_tty_t* handle, uv_file fd, int readable) +.. c:function:: int uv_tty_init(uv_loop_t* loop, uv_tty_t* handle, uv_file fd, int unused) Initialize a new TTY stream with the given file descriptor. Usually the file descriptor will be: @@ -55,9 +55,6 @@ API * 1 = stdout * 2 = stderr - `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 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 @@ -67,8 +64,10 @@ API ioctl TIOCGPTN or TIOCPTYGNAME, for instance OpenBSD and Solaris. .. note:: - If reopening the TTY fails, libuv falls back to blocking writes for - non-readable TTY streams. + If reopening the TTY fails, libuv falls back to blocking writes. + + .. versionchanged:: 1.23.1: the `readable` parameter is now unused and ignored. + The correct value will now be auto-detected from the kernel. .. versionchanged:: 1.9.0: the path of the TTY is determined by :man:`ttyname_r(3)`. In earlier versions libuv opened |