From 148b8efe8ec11a330fb63830f6b4db0b174c1e3e Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Mon, 10 Feb 2014 20:03:55 +0100 Subject: [PATCH] Adapt gallium and libdrm plugins to current libc This patch adapts the gallium and libdrm libc plugins to the current workings of the libc. Fixes #1070. --- .../src/lib/gallium/i915/query_device_id.cc | 21 +++++++++++++++++-- libports/src/lib/libdrm/ioctl.cc | 16 ++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/libports/src/lib/gallium/i915/query_device_id.cc b/libports/src/lib/gallium/i915/query_device_id.cc index e0f37d1ed9..d24ed5d913 100644 --- a/libports/src/lib/gallium/i915/query_device_id.cc +++ b/libports/src/lib/gallium/i915/query_device_id.cc @@ -53,8 +53,8 @@ namespace { bool supports_open(const char *pathname, int flags) { - return !Genode::strcmp(pathname, - "/sys/class/drm/card0/device/device"); + return (Genode::strcmp(pathname, + "/sys/class/drm/card0/device/device") == 0); } Libc::File_descriptor *open(const char *pathname, int flags) @@ -88,6 +88,23 @@ namespace { context(fd)->position += count; return count; } + + bool supports_stat(const char *path) + { + return (Genode::strcmp(path, "/sys") == 0) || + (Genode::strcmp(path, "/sys/class") == 0) || + (Genode::strcmp(path, "/sys/class/drm") == 0) || + (Genode::strcmp(path, "/sys/class/drm/card0") == 0) || + (Genode::strcmp(path, "/sys/class/drm/card0/device") == 0) || + (Genode::strcmp(path, "/sys/class/drm/card0/device/device") == 0); + } + + int stat(const char *path, struct stat *buf) + { + if (buf) + buf->st_mode = S_IFDIR; + return 0; + } }; } diff --git a/libports/src/lib/libdrm/ioctl.cc b/libports/src/lib/libdrm/ioctl.cc index 42afd72f11..92d1a010cb 100644 --- a/libports/src/lib/libdrm/ioctl.cc +++ b/libports/src/lib/libdrm/ioctl.cc @@ -139,6 +139,20 @@ namespace { return Libc::file_descriptor_allocator()->alloc(this, context); } + bool supports_stat(const char *path) + { + return (Genode::strcmp(path, "/dev") == 0 || + Genode::strcmp(path, "/dev/drm") == 0); + } + + int stat(const char *path, struct stat *buf) + { + if (buf) + buf->st_mode = S_IFDIR; + + return 0; + } + int ioctl(Libc::File_descriptor *fd, int request, char *argp) { if (verbose_ioctl) @@ -152,6 +166,8 @@ namespace { return _driver->ioctl(_client, drm_command(request), argp); } + bool supports_mmap() { return true; } + /** * Pseudo mmap specific for DRM device *