History log of /libuv/src/unix/tty.c (Results 1 – 25 of 66)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# a49f264d 11-Sep-2024 Ben Noordhuis

unix: restore tty attributes on handle close (#4399)

Libuv stores the `struct termios` for use inside uv_tty_reset_mode().

Node.js uses said function to restore the tty to its origi

unix: restore tty attributes on handle close (#4399)

Libuv stores the `struct termios` for use inside uv_tty_reset_mode().

Node.js uses said function to restore the tty to its original mode
on SIGINT or SIGTERM, when there is no opportunity to shut down the
process normally.

Track uv_tty_t handle closing, otherwise we might be trying to use a
stale termios.

The current solution is not ideal because there can be multiple handles
that refer to the same tty/pty and, for various reasons, we can't really
determine when we close the last handle. The last handle may not even be
inside the current process.

Still, all things considered, it's probably (hopefully!) an improvement
over the status quo.

Refs: https://github.com/libuv/libuv/issues/4398

show more ...


# 1b01b786 24-May-2023 Ben Noordhuis

unix,win: replace QUEUE with struct uv__queue (#4022)

Recent versions of gcc have started emitting warnings about the liberal
type casting inside the QUEUE macros. Although the warnings

unix,win: replace QUEUE with struct uv__queue (#4022)

Recent versions of gcc have started emitting warnings about the liberal
type casting inside the QUEUE macros. Although the warnings are false
positives, let's use them as the impetus to switch to a type-safer and
arguably cleaner approach.

Fixes: https://github.com/libuv/libuv/issues/4019

show more ...


# 5102b2c0 28-Nov-2022 Ben Noordhuis

unix: drop kfreebsd support (#3835)

Because kFreeBSD is dead. RIP.

Fixes: https://github.com/libuv/libuv/issues/3833


# acfe668e 18-Oct-2022 Ben Noordhuis

build: add MemorySanitizer (MSAN) support (#3788)

- unpoison results from linux system call wrappers

- unpoison results from stat/fstat/lstat to pacify clang 14
(fixed in late

build: add MemorySanitizer (MSAN) support (#3788)

- unpoison results from linux system call wrappers

- unpoison results from stat/fstat/lstat to pacify clang 14
(fixed in later versions)

- add MSAN build option

- turn on MSAN CI build

show more ...


# 71a782b6 01-Oct-2022 Ben Noordhuis

unix: simplify atomic op in uv_tty_reset_mode() (#3773)

Compare-and-exchange is only useful in a loop. Replace it with a simple
exchange.


# ac5180e2 19-Jul-2022 Ben Noordhuis

unix: switch to c11 atomics (#3688)

Fixes: https://github.com/libuv/libuv/issues/3683


# 7ca20a26 06-Jul-2022 Ben Noordhuis

unix: retry tcgetattr/tcsetattr() on EINTR (#3669)

EINTR is explicitly documented as a possible error code of tcsetattr().

The documentation for tcgetattr() is silent on the subject

unix: retry tcgetattr/tcsetattr() on EINTR (#3669)

EINTR is explicitly documented as a possible error code of tcsetattr().

The documentation for tcgetattr() is silent on the subject but better
safe than sorry.

Fixes: https://github.com/libuv/libuv/issues/3645

show more ...


# 3136561c 06-Jul-2022 Ben Noordhuis

unix: fix c99 comments (#3667)

Causes compilation errors for people that build libuv with a C89
compiler.

Refs: https://github.com/libuv/libuv/discussions/3666


# 5ec89b8c 10-Mar-2022 V-for-Vasili

aix, ibmi: handle server hang when remote sends TCP RST (#3482)

Workaround getsockname() not working for a TCP handle that has
received RST from the remote.

Co-authored-by: Jame

aix, ibmi: handle server hang when remote sends TCP RST (#3482)

Workaround getsockname() not working for a TCP handle that has
received RST from the remote.

Co-authored-by: Jameson Nash <vtjnash@gmail.com>

show more ...


# b6d51dc4 02-Jul-2021 Joshua M. Clulow

illumos,tty: UV_TTY_MODE_IO waits for 4 bytes

uv_tty_set_mode() allows a tty device to be set to raw mode with
UV_TTY_MODE_RAW, which correctly sets MIN and TIME to appropriate
value

illumos,tty: UV_TTY_MODE_IO waits for 4 bytes

uv_tty_set_mode() allows a tty device to be set to raw mode with
UV_TTY_MODE_RAW, which correctly sets MIN and TIME to appropriate
values for character input. When UV_TTY_MODE_IO is passed, on illumos
systems a compatibility implementation of cfmakeraw() is used that does
_not_ set MIN or TIME. As a result, consumers of IO mode will block
until a minimum of 4 bytes is available on the tty instead of just 1 as
is expected.

PR-URL: https://github.com/libuv/libuv/pull/3219
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...


Revision tags: v1.41.0, v1.40.0, v1.39.0, v1.38.1, v1.38.0, v1.37.0, v1.36.0
# 5f1ac8ee 24-Mar-2020 Kevin Adler

ibmi: Fix isatty EBADF handling and refactor

In e14c56b, support was added to implement true isatty() support when
running in the IBM i PASE environment, but it did not handle EBADF

ibmi: Fix isatty EBADF handling and refactor

In e14c56b, support was added to implement true isatty() support when
running in the IBM i PASE environment, but it did not handle EBADF
properly. This commit fixes the EBADF handling, but because the
handling was a bit more complicated than previously, it was moved to a
separate isatty function to keep the mainline code simpler.

This also documents why we can't just use isatty on PASE a little more
completely.

PR-URL: https://github.com/libuv/libuv/pull/2753
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>

show more ...

Revision tags: v1.35.0, v1.34.2, v1.34.1, v1.34.0, v1.33.1, v1.33.0, v1.32.0, v1.31.0, v1.30.1, v1.30.0, v1.29.1, v1.29.0, v1.28.0, v1.27.0, v1.26.0, v1.25.0, v1.24.1, v1.24.0, v1.23.2, v1.23.1, v1.23.0, v1.22.0, v1.21.0, v1.20.3, v1.20.2, v1.20.1, v1.20.0, v1.19.2, v1.19.1, v1.19.0, v1.18.0, v1.17.0, v1.16.1, v1.16.0, v1.15.0, v1.14.1, v1.14.0, v1.13.1, v1.13.0, v1.12.0, v1.11.0, v1.10.2, v1.10.1, v1.10.0
# 1399d851 04-Aug-2016 Jameson Nash

tty,unix: avoid affecting controlling TTY

Since this re-open logic is supposed to be transparent to the parent
program, this flag helps ensure that there are no unintended
side-effec

tty,unix: avoid affecting controlling TTY

Since this re-open logic is supposed to be transparent to the parent
program, this flag helps ensure that there are no unintended
side-effects. This flag is already the default (and only possible
option) on FreeBSD. Normally, Linux will also act as if you passed
NOCTTY. However, it appears that mac OS sometimes strips the parent
process of its controlling terminal if you don't pass this flag.

Fixes: https://github.com/libuv/libuv/issues/973
Fixes: https://github.com/JuliaLang/julia/issues/16398
PR-URL: https://github.com/libuv/libuv/pull/2619
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

# e14c56bd 16-Dec-2019 Xu Meng

ibmi: fix the false isatty() issue on IBMi

On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
Use ioctl() instead to identify whether it's actually a TTY.

P

ibmi: fix the false isatty() issue on IBMi

On IBMi PASE isatty() always returns true for stdin, stdout and stderr.
Use ioctl() instead to identify whether it's actually a TTY.

PR-URL: https://github.com/libuv/libuv/pull/2565
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>

show more ...

# fd2ce38d 02-Oct-2019 erw7

win,tty: add uv_tty_{get,set}_vterm_state

PR-URL: https://github.com/libuv/libuv/pull/2501
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul

win,tty: add uv_tty_{get,set}_vterm_state

PR-URL: https://github.com/libuv/libuv/pull/2501
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Reviewed-By: Jameson Nash <vtjnash+github@gmail.com>

show more ...

# 40498795 28-Aug-2018 Jameson Nash

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 ac

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>

show more ...

# 619937c7 28-Jun-2018 Ben Noordhuis

unix,win: merge handle flags

Some long overdue refactoring that unifies more of the UNIX and Windows
backends.

PR-URL: https://github.com/libuv/libuv/pull/1904
Reviewed-By:

unix,win: merge handle flags

Some long overdue refactoring that unifies more of the UNIX and Windows
backends.

PR-URL: https://github.com/libuv/libuv/pull/1904
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 89cbbc89 19-Jan-2018 Mason X

include,src: introduce UV__ERR() macro

Using -errno, -E**, and -pthread_function() can be
error prone, and breaks compatibility with some operating
systems that already negate errno'

include,src: introduce UV__ERR() macro

Using -errno, -E**, and -pthread_function() can be
error prone, and breaks compatibility with some operating
systems that already negate errno's (e.g. Haiku).

This commit adds a UV__ERR() macro that ensures libuv
errors are negative.

Fixes: https://github.com/libuv/help/issues/39
PR-URL: https://github.com/libuv/libuv/pull/1687
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 3877a90e 09-Sep-2017 Kamil Rytarowski

netbsd: implement uv__tty_is_slave()

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.

Wo

netbsd: implement uv__tty_is_slave()

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.

Workaround this problem and verify the device major and compare it with
the pts driver. Major numbers for the master and the slave TTY are
machine-dependent. On amd64 they are respectively 6 (ptc) and 5 (pts).

PR-URL: https://github.com/libuv/libuv/pull/1533
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

# 0a4b51fc 28-Jul-2016 Jeffrey Clark

build: GNU/kFreeBSD support

autotools support only, gvp does not support kfreebsd detection.

PR-URL: https://github.com/libuv/libuv/pull/960
Reviewed-By: Ben Noordhuis <info@bno

build: GNU/kFreeBSD support

autotools support only, gvp does not support kfreebsd detection.

PR-URL: https://github.com/libuv/libuv/pull/960
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# 1cff5b75 05-Jul-2016 John Barboza

zos: add support for new platform

- zos: disable test cases not applicable
- zos: build options
- zos: semaphore implementation
- zos: use compare and swap builtins
- zos: st

zos: add support for new platform

- zos: disable test cases not applicable
- zos: build options
- zos: semaphore implementation
- zos: use compare and swap builtins
- zos: struct rusage not the same as other platforms
- zos: backlog<=0 produces undefined behaviour
Will redefine backlog in the following way
* if backlog == 0, set it to 1
* if backlog < 0, set it to SOMAXCONN
- zos: define IMAXBEL as empty flag and implement uv__tty_make_raw
- zos: use udp multicast operations from aix
- zos: ESC in ebcdic
- zos: use LIBPATH for dynamic linker path
- zos: uv_udp_set_ttl only works for ipv6
- zos: increase pthread stack size by factor of 4
- zos: return ENODEV instead of ENXIO errors for setsockopt
- zos: use uv_cond_init the same way as aix
- test: enable oob test for zos
- zos: return EINVAL for zos error code EOPNOTSUPP

PR-URL: https://github.com/libuv/libuv/pull/937
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

Revision tags: v0.10.37
# 96b37293 22-May-2016 Michael Neumann

unix: correctly detect named pipes on DragonFly

This fixes test-stdio-over-pipes and test-pipe-sendmsg test cases.

~~~~
Assertion failed in test/test-stdio-over-pipes.c on l

unix: correctly detect named pipes on DragonFly

This fixes test-stdio-over-pipes and test-pipe-sendmsg test cases.

~~~~
Assertion failed in test/test-stdio-over-pipes.c on line 56: term_signal == 0
Assertion failed in test/test-pipe-sendmsg.c on line 86: pending == UV_NAMED_PIPE
~~~~

This fixes a longstanding issue with nodejs on DragonFly, which was
triggered whenever spawning a process and pipes were involed.

PR-URL: https://github.com/libuv/libuv/pull/884
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# c0fdc710 18-May-2016 Saúl Ibarra Corretgé

darwin: fix setting fd to non-blocking in select(() trick

When the select trick is used fd is replaced with the fake fd (one end
of the socketpair) so we're not setting the original fd i

darwin: fix setting fd to non-blocking in select(() trick

When the select trick is used fd is replaced with the fake fd (one end
of the socketpair) so we're not setting the original fd in non-blocking
mode.

Refs: https://github.com/nodejs/node/issues/6456#issuecomment-220018822
PR-URL: https://github.com/libuv/libuv/pull/879
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>

show more ...

Revision tags: v1.9.1, v1.9.0
# 387102b2 23-Mar-2016 Enno Boland

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

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>

show more ...

# b12624c1 20-Mar-2016 Ben Noordhuis

unix: retry ioctl(TIOCGWINSZ) on EINTR

Some platforms (notably Solaris) can fail in this ioctl() if interrupted
by a signal. Retry the system call when that happens.

Fixes: htt

unix: retry ioctl(TIOCGWINSZ) on EINTR

Some platforms (notably Solaris) can fail in this ioctl() if interrupted
by a signal. Retry the system call when that happens.

Fixes: https://github.com/nodejs/node/issues/5737
PR-URL: https://github.com/libuv/libuv/pull/772
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

show more ...

Revision tags: v1.8.0, v1.7.5
# 25506bb3 22-Sep-2015 Gireesh Punathil

unix: make uv_guess_handle work properly for AIX

On AIX, the getsockname API does not operate on the UNIX domain sockets
Please see: https://www-01.ibm.com/support/knowledgecenter/ssw_ai

unix: make uv_guess_handle work properly for AIX

On AIX, the getsockname API does not operate on the UNIX domain sockets
Please see: https://www-01.ibm.com/support/knowledgecenter/ssw_aix_61/
com.ibm.aix.commtrf2/getsockname.htm

This means that the internal helper routine uv_guess_handle in tty.c
fails in AIX, for common use cases.

There is no direct API support which helps identifying a UNIX domain
socket in AIX. getpeername() retrieves the information pertinent to
connected UNIX domain socket pairs, and using getpeername where
getsockname fails was a good workaround. However, there are edge cases
where one end of a socketpair comes for introspection while the other
end has been closed, which causes getpeername to fail.

A better solution is derived based on these facts:

1.getsockname() on a broken / un-broken socketpair does not actually
fail with -1, instead it returns 0. However, the API does not modify
the socketaddr structure passed to it, with the socket information.

2.This behavior of getsockname is observed only for UNIX domain socket,
among all possible types of sockets which I tested - ~30 of them.

So a practical and stable workaround for AIX is to return
UV_UNKNOWN_HANDLE if getsockname fails. If it passes and the length
of the structure returned is 0 then we know that the type is AF_UNIX
and return UV_NAMED_PIPE , otherwise we inspect in the same way as for
other platforms to derive the type.

PR-URL: https://github.com/libuv/libuv/pull/539
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

123