From 5adb6f0c5f3bfd2b18753ab40b6db04fe8f2984a Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Tue, 4 Sep 2018 14:39:24 +0200 Subject: [PATCH] socket_fs: show ioctl FIONREAD error message only once Fixes #2969 --- .../libports/src/lib/libc/socket_fs_plugin.cc | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc index c093f488e..11f92d8ff 100644 --- a/repos/libports/src/lib/libc/socket_fs_plugin.cc +++ b/repos/libports/src/lib/libc/socket_fs_plugin.cc @@ -30,6 +30,7 @@ #include #include #include +#include /* libc-internal includes */ #include "socket_fs_plugin.h" @@ -257,6 +258,7 @@ struct Socket_fs::Plugin : Libc::Plugin int fcntl(Libc::File_descriptor *, int, long) override; int close(Libc::File_descriptor *) override; int select(int, fd_set *, fd_set *, fd_set *, timeval *) override; + int ioctl(Libc::File_descriptor *, int, char *) override; }; @@ -963,6 +965,27 @@ int Socket_fs::Plugin::close(Libc::File_descriptor *fd) } +int Socket_fs::Plugin::ioctl(Libc::File_descriptor *, int request, char*) +{ + if (request == FIONREAD) { + /* + * This request occurs quite often when using the Arora web browser, + * so print the error message only once. + */ + static bool print_fionread_error_message = true; + if (print_fionread_error_message) { + Genode::error(__func__, " request FIONREAD not supported on sockets" + " (this message will not be shown again)"); + print_fionread_error_message = false; + } + return -1; + } + + Genode::error(__func__, " request ", request, " not supported on sockets"); + return -1; +} + + Plugin & Socket_fs::plugin() { static Plugin inst;