Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Michael Droettboom <[email protected]>
* Nicolas Bouquet <[email protected]>
* Miguel Saldivar <[email protected]>
* Tyler Limkemann <tslimkemann42 gmail.com>
7 changes: 7 additions & 0 deletions src/library_syscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@ var SyscallsLibrary = {
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
return 0;
}
case {{{ cDefine('TIOCSWINSZ') }}}: {
// TODO: technically, this ioctl call should change the window size.
// but, since emscripten doesn't have any concept of a terminal window
// yet, we'll just silently throw it away as we do TIOCGWINSZ
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
return 0;
}
default: abort('bad ioctl syscall ' + op);
}
#endif // NO_FILESYSTEM
Expand Down
2 changes: 1 addition & 1 deletion src/struct_info.compiled.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/struct_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@
"TCSETSF",
"TIOCGPGRP",
"TIOCSPGRP",
"TIOCGWINSZ"
"TIOCGWINSZ",
"TIOCSWINSZ"
],
"structs": {}
},
Expand Down
17 changes: 17 additions & 0 deletions tests/other/ioctl/window_size/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdio.h>

int main() {
struct winsize ws;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != 0) {
puts("TIOCGWINSZ failed");
return -1;
}
if (ioctl(STDOUT_FILENO, TIOCSWINSZ, &ws) != 0) {
puts("TIOCSWINSZ failed");
return -1;
}
puts("success");
return 0;
}
1 change: 1 addition & 0 deletions tests/other/ioctl/window_size/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
success
3 changes: 3 additions & 0 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -8233,6 +8233,9 @@ def test_autotools_shared_check(self):
except OSError:
# Ignore missing python aliases.
pass

def test_ioctl_window_size(self):
self.do_other_test(os.path.join('other', 'ioctl', 'window_size'))

def test_fd_closed(self):
self.do_other_test(os.path.join('other', 'fd_closed'))