diff --git a/repos/ports/recipes/src/vbox5-nova/content.mk b/repos/ports/recipes/src/vbox5-nova/content.mk index 954da15763..30e99b7d79 100644 --- a/repos/ports/recipes/src/vbox5-nova/content.mk +++ b/repos/ports/recipes/src/vbox5-nova/content.mk @@ -43,7 +43,6 @@ MIRROR_FROM_LIBPORTS := lib/mk/libc-mem.mk \ src/lib/libc/internal/timer.h \ src/lib/libc/internal/types.h \ src/lib/libc/libc_mem_alloc.cc \ - include/libc-plugin \ lib/import/import-qemu-usb_include.mk \ lib/mk/qemu-usb_include.mk \ lib/mk/qemu-usb.mk \ diff --git a/repos/ports/recipes/src/vbox5/content.mk b/repos/ports/recipes/src/vbox5/content.mk index 1b2c8778f2..0ffb1fb667 100644 --- a/repos/ports/recipes/src/vbox5/content.mk +++ b/repos/ports/recipes/src/vbox5/content.mk @@ -44,7 +44,6 @@ MIRROR_FROM_LIBPORTS := lib/mk/libc-mem.mk \ src/lib/libc/internal/timer.h \ src/lib/libc/internal/types.h \ src/lib/libc/libc_mem_alloc.cc \ - include/libc-plugin \ lib/import/import-qemu-usb_include.mk \ lib/mk/qemu-usb_include.mk \ lib/mk/qemu-usb.mk \ diff --git a/repos/ports/src/virtualbox5/frontend/main.cc b/repos/ports/src/virtualbox5/frontend/main.cc index 5594a01a7c..1551587fba 100644 --- a/repos/ports/src/virtualbox5/frontend/main.cc +++ b/repos/ports/src/virtualbox5/frontend/main.cc @@ -42,8 +42,6 @@ static char c_vbox_file[128]; static char c_vbox_vmname[128]; -extern "C" void init_libc_vbox_logger(void); - /** * xpcom style memory allocation @@ -283,9 +281,6 @@ void Libc::Component::construct(Libc::Env &env) copy_cstring(c_vbox_vmname, vm_name.string(), sizeof(c_vbox_vmname)); } - /* enable stdout/stderr for VBox Log infrastructure */ - init_libc_vbox_logger(); - Libc::with_libc([&] () { static char argv0[] = { '_', 'm', 'a', 'i', 'n', 0}; static char *argv[1] = { argv0 }; diff --git a/repos/ports/src/virtualbox5/libc.cc b/repos/ports/src/virtualbox5/libc.cc index 99a1028b80..e85b1dcc18 100644 --- a/repos/ports/src/virtualbox5/libc.cc +++ b/repos/ports/src/virtualbox5/libc.cc @@ -133,13 +133,9 @@ extern "C" void *realloc(void *ptr, ::size_t size) extern "C" char *getenv(const char *name) { - /* - * Logging to the pseudo file '/log' is done via the libc plugin provided - * by 'logging.cc'. - */ if (Genode::strcmp(name, "VBOX_LOG_DEST") == 0 || Genode::strcmp(name, "VBOX_RELEASE_LOG_DEST") == 0) - return (char *)"file=log"; + return (char *)"file=/dev/log"; if (Genode::strcmp(name, "VBOX_LOG") == 0 || Genode::strcmp(name, "VBOX_RELEASE_LOG") == 0) diff --git a/repos/ports/src/virtualbox5/logger.cc b/repos/ports/src/virtualbox5/logger.cc deleted file mode 100644 index aab5e1da94..0000000000 --- a/repos/ports/src/virtualbox5/logger.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - * \brief Redirect VirtualBox LOG output to Genode LOG - * \author Norman Feske - * \date 2013-08-23 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* libc plugin interface */ -#include -#include - -/* libc includes */ -#include -#include -#include - - -namespace { - - struct Plugin_context : Libc::Plugin_context { }; - - class Plugin : public Libc::Plugin - { - private: - - Plugin_context _context; - - Libc::File_descriptor *_fd; - - char const *log_file_name() const { return "/log"; } - - bool _match(char const *name) const - { - return strcmp(name, log_file_name()) == 0; - } - - public: - - Plugin() : - _fd(Libc::file_descriptor_allocator()->alloc(this, &_context)) - { } - - bool supports_stat(const char *path) - { - return _match(path); - } - - bool supports_open(const char *path, int flags) - { - return _match(path); - } - - int stat(const char *path, struct stat *buf) - { - bool const match = _match(path); - if (buf && match) { - Genode::memset(buf, 0, sizeof(struct stat)); - buf->st_mode = S_IFCHR; - } - - errno = match ? 0 : ENOENT; - return match ? 0 : -1; - } - - Libc::File_descriptor *open(const char *pathname, int flags) - { - return _match(pathname) ? _fd : 0; - } - - int fcntl(Libc::File_descriptor *fd, int cmd, long arg) - { - switch (cmd) { - case F_GETFL: return O_WRONLY; - default: Genode::error("fcntl(): command ", cmd, " not supported"); - return -1; - } - } - - int fstat(Libc::File_descriptor *, struct stat *buf) - { - /* - * The following values were obtained with small test program that - * calls fstat for stdout on linux. - */ - buf->st_dev = 11; - buf->st_ino = 4; - buf->st_mode = 8592; - buf->st_nlink = 1; - buf->st_uid = 0; - buf->st_gid = 0; - buf->st_rdev = 34818; - buf->st_size = 0; - buf->st_blksize = 1024; - buf->st_blocks = 0; - - return 0; - } - - ssize_t write(Libc::File_descriptor *fd, const void *buf, ::size_t count) - { - if (fd != _fd) { - errno = EBADF; - return -1; - } - - char *src = (char *)buf; - - /* count does not include the trailing '\0' */ - int orig_count = count; - while (count > 0) { - char tmp[128]; - int curr_count= count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count; - strncpy(tmp, src, curr_count); - tmp[curr_count > 0 ? curr_count : 0] = 0; - Genode::log(Genode::Cstring(tmp)); - count -= curr_count; - src += curr_count; - } - return orig_count; - } - - int ioctl(Libc::File_descriptor *, int request, char *) - { - /* - * Some programs or libraries use to perform 'TIOCGETA' - * operations on stdout, in particular the termios module of - * Python. Those programs may break if 'tcgetattr' return with - * an error. We pretend to be more successful than we really - * are to make them happy. - */ - return 0; - } - }; - -} /* unnamed namespace */ - - -extern "C" void init_libc_vbox_logger(void) -{ - static Plugin plugin; -} diff --git a/repos/ports/src/virtualbox5/target.inc b/repos/ports/src/virtualbox5/target.inc index b7eb0fdb40..58d066b1ce 100644 --- a/repos/ports/src/virtualbox5/target.inc +++ b/repos/ports/src/virtualbox5/target.inc @@ -8,7 +8,7 @@ CC_WARN += -Wall SRC_CC = frontend/main.cc frontend/console.cc \ frontend/VirtualBoxErrorInfoImpl.cpp \ devices.cc drivers.cc dummies.cc libc.cc \ - logger.cc mm.cc pdm.cc pgm.cc rt.cc \ + mm.cc pdm.cc pgm.cc rt.cc \ hm.cc thread.cc dynlib.cc unimpl.cc LIBS += base