Skip to content

Commit 8ba154b

Browse files
author
Julien Gilli
committed
deps: fix libuv build on SmartOS
1 parent 9575348 commit 8ba154b

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

deps/uv/src/unix/tty.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
103103
return 0;
104104
}
105105

106+
static void uv__tty_make_raw(struct termios* tio) {
107+
#ifdef __sun
108+
/*
109+
* This implementation of cfmakeraw for Solaris and derivatives is taken from
110+
* http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html.
111+
*/
112+
tio->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
113+
IGNCR | ICRNL | IXON);
114+
tio->c_oflag &= ~OPOST;
115+
tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
116+
tio->c_cflag &= ~(CSIZE | PARENB);
117+
tio->c_cflag |= CS8;
118+
#else
119+
cfmakeraw(tio);
120+
#endif /* #ifdef __sun */
121+
}
106122

107123
int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
108124
struct termios tmp;
@@ -138,7 +154,7 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
138154
tmp.c_cc[VTIME] = 0;
139155
break;
140156
case UV_TTY_MODE_IO:
141-
cfmakeraw(&tmp);
157+
uv__tty_make_raw(&tmp);
142158
break;
143159
}
144160

0 commit comments

Comments
 (0)