Commit Graph

25 Commits

Author SHA1 Message Date
Ben Noordhuis
7b66ea18ff unix: improve uv_guess_handle() implementation
Make it understand FIFOs, character devices and sockets.
2013-03-14 14:22:04 +01:00
Ben Noordhuis
9aab5d4837 Revert "unix: improve uv_guess_handle() implementation"
This reverts commit 98bcddc8dd.

It's making a lot of tests in the node.js test suite fail.
2013-01-11 13:40:25 +01:00
Ben Leslie
98bcddc8dd unix: improve uv_guess_handle() implementation
uv_guess_handle is currently squelching both fifo and all
sockets on to the UV_NAMED_PIPE type. Rather than treating
all sockets as UV_NAMED_PIPE, use getsockopt() and
getsockaddr() to determine if the socket is an AF_UNIX
stream (in which case return UV_NAMED_PIPE), or an AF_INET
stream (in which case return UV_TCP), or an AF_INET datagram
socket (in which case return UV_UDP).

Additionally, currently all other file descriptor types are
squelched to the UV_FILE type. Instead, only file descriptors
that are marked as regular files are treated as UV_FILE. All
other types (such as directories, character and block devices)
are now treated as UV_UNKNOWN_HANDLE.
2013-01-08 05:26:58 +01:00
Ben Noordhuis
5b63285805 unix, windows: ANSI-fy uv_tty_reset_mode() prototype 2013-01-06 22:31:47 +01:00
Fedor Indutny
731adacad2 unix: use select() for specific fds on OS X
kqueue(2) on osx doesn't work (emits EINVAL error) with specific fds
(i.e. /dev/tty, /dev/null, etc). When given such descriptors - start
select(2) watcher thread that will emit io events.
2012-12-09 15:43:08 +01:00
Ben Noordhuis
1282d64868 unix: remove dependency on libev 2012-11-16 17:33:25 +01:00
Ben Noordhuis
20bb1bfd70 Revert "unix: reopen tty as /dev/tty"
This reverts commit 31f9fbce63.

The reverted commit depends on commit 5da380a ("use select() for specific fds
on OS X") which polls /dev/tty file descriptors in a separate thread to work
around deficiencies in the kqueue API on OS X.

Unfortunately, 5da380a has a bug that effectively makes the select() thread
busy-loop. Revert this commit for now.
2012-11-04 01:07:14 +01:00
Ben Noordhuis
31f9fbce63 unix: reopen tty as /dev/tty
Reopen the file descriptor when it refers to a tty. This lets us put the tty in
non-blocking mode without affecting other processes that share it with us.

Fixes #601.
2012-10-24 15:39:11 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
e71495c84a unix: turn field stream->blocking into a flag
Saves 4 bytes.
2012-05-23 22:48:57 +02:00
Bert Belder
e38755485e Unix: namespace stream handle flags 2012-05-03 01:47:13 +02:00
Ben Noordhuis
b8649fdf00 unix: don't flush tty on switch to raw mode
Drain, don't flush the tty when switching from cooked to raw mode. Prevents
buffered keystrokes from getting lost. Switching back to cooked mode still
flushes.

Fixes joyent/node#2744.
2012-02-13 22:41:36 +01:00
Ben Noordhuis
bf8ccfce18 unix: fix segfault in uv_guess_handle()
Fixes #293.
2012-01-17 17:47:33 +01:00
Ryan Dahl
e1bee05ecd UNIX: Loop on blocking streams
Also removes a superfluous syscall during uv_tty_init for writable TTY
streams.
2011-11-02 16:47:01 -07:00
Ryan Dahl
5656e3c8bd Prepare for writable TTY to be blocking 2011-10-10 13:25:46 -07:00
Ryan Dahl
fe18438416 add uv_tty_reset_mode() 2011-09-30 13:09:06 -07:00
Ryan Dahl
153d3c7c57 unix: allow tty raw mode to be turned off 2011-09-30 11:21:51 -07:00
Erick Tryzelaar
23796d208c Fixes #76. Unify OS error reporting
As a nice fringe benefit, this also shaves a word
off of a windows TCP handle by replacing "uv_err_t
bind_error" with "int bind_error".
2011-09-27 19:05:33 -07:00
Ryan Dahl
03d0c57ea2 Remove uv_is_tty. Use uv_guess_handle instead. 2011-09-23 10:01:45 -07:00
Fedor Indutny
7ce34f2ada added missing headers file 2011-09-23 09:20:20 -07:00
Ryan Dahl
03652596cf unix: add uv_guess_handle and uv_tty_get_winsize 2011-09-22 19:35:46 -07:00
Ben Noordhuis
12d3680cd4 unix: fix warning: implicit declaration of function ‘isatty’ 2011-09-21 19:26:25 +02:00
Ryan Dahl
c1374ba587 Add uv_is_tty() 2011-09-20 11:48:47 -07:00
Ryan Dahl
e7eeacb4ae unix: implement uv_tty_set_mode 2011-09-12 14:52:59 -07:00
Ryan Dahl
4484d61fe1 Add interfaces for uv_pipe_open, uv_tty_init, uv_tty_set_mode
Nothing works - no tests. This is just to coordinate efforts between Bert
and I.
2011-09-12 14:32:14 -07:00