• Nicolas Pitre's avatar
    vcs: restore and document initial POLLPRI event · 95252f9c
    Nicolas Pitre authored
    Restore and document the forced initial POLLPRI event reporting when
    poll() is used for the first time. This used to be the implemented
    behavior before recent changes. Because of the way poll() is implemented,
    this prevents losing an event happening between the last read() and the
    first poll() invocation.
    
    Since poll() for /dev/vcs* was not always supported, user space probes
    for its availability as follows:
    
    	int fd = open("/dev/vcsa", O_RDONLY);
    	struct pollfd p = { .fd = fd, .events = POLLPRI };
    	available = (poll(&p, 1, 0) == 1);
    
    Semantically, it makes sense to signal the first event as such even if
    it might be spurious. The screen could be modified, and modified back
    to its initial state before we get to read it, so users must be prepared
    for that anyway.
    Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    95252f9c
vc_screen.c 16.6 KB