uterm: fbdev: map FBs for read access
authorDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 15 Jan 2013 10:09:32 +0000 (11:09 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Tue, 15 Jan 2013 10:09:32 +0000 (11:09 +0100)
We want to provide read-access to users of get_buffers() so map memory
with PROT_READ. However, read is almost always horribly slow so this
should only be used as fallback.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/uterm_fbdev_video.c

index 1983bf8..2ca53fd 100644 (file)
@@ -298,7 +298,7 @@ static int display_activate_force(struct uterm_display *disp,
        if (disp->flags & DISPLAY_DBUF)
                len *= 2;
 
-       dfb->map = mmap(0, len, PROT_WRITE, MAP_SHARED, dfb->fd, 0);
+       dfb->map = mmap(0, len, PROT_READ | PROT_WRITE, MAP_SHARED, dfb->fd, 0);
        if (dfb->map == MAP_FAILED) {
                log_error("cannot mmap device %s (%d): %m", dfb->node,
                          errno);