• Alessandro Rubini's avatar
    chardev: return POLLERR if user disables the trigger · a90aba09
    Alessandro Rubini authored
    Unfortunately, we sometimes have threads that block in the I/O
    operation (the use case is input), and need to be notified when
    another thread aborts the scheduled operation.  This sometimes applies
    to a user-requested reconfiguration of the trigger.
    
    This commit awakes processes sleeping on a cset when the trigger is
    disabled by a sysfs store, and the chardev interface returns POLLERR
    in the poll/select functions for control devices.
    
    We chose not to affect the data device nor read and write. This means
    all simple code (scripts, simple demos etc) is not affected.  But
    full-featured applications, which rely on poll, have this additional
    notification if they check the POLLERR bit.
    
    Note: select(2) reports files both readable and writable when the drive
    returns POLLERR, so applications should really use poll(2) instead.
    Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
    a90aba09
sysfs.c 30.9 KB