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.
This commit is contained in:
Christian Prochaska 2014-02-10 20:03:55 +01:00 committed by Christian Helmuth
parent 7fd53b52df
commit 148b8efe8e
2 changed files with 35 additions and 2 deletions

View File

@ -53,8 +53,8 @@ namespace {
bool supports_open(const char *pathname, int flags) bool supports_open(const char *pathname, int flags)
{ {
return !Genode::strcmp(pathname, return (Genode::strcmp(pathname,
"/sys/class/drm/card0/device/device"); "/sys/class/drm/card0/device/device") == 0);
} }
Libc::File_descriptor *open(const char *pathname, int flags) Libc::File_descriptor *open(const char *pathname, int flags)
@ -88,6 +88,23 @@ namespace {
context(fd)->position += count; context(fd)->position += count;
return 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;
}
}; };
} }

View File

@ -139,6 +139,20 @@ namespace {
return Libc::file_descriptor_allocator()->alloc(this, context); 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) int ioctl(Libc::File_descriptor *fd, int request, char *argp)
{ {
if (verbose_ioctl) if (verbose_ioctl)
@ -152,6 +166,8 @@ namespace {
return _driver->ioctl(_client, drm_command(request), argp); return _driver->ioctl(_client, drm_command(request), argp);
} }
bool supports_mmap() { return true; }
/** /**
* Pseudo mmap specific for DRM device * Pseudo mmap specific for DRM device
* *