• Ilija Hadzic's avatar
    staging: usbip: userspace: eliminate glib dependency · 328f7f8a
    Ilija Hadzic authored
    USBIP daemon relies on functions available in glib2 library
    to spawn handler code for incoming connection. This makes the
    whole program dependent on glib2 library, which is a GNOME library
    that on systems that don't have GNOME results in pulling more
    dependency, only to be able to run a relatively trivial
    socket-based program.
    
    While this may not seem to be a problem on full-blown desktops
    that already have the necessary libraries, it is a big issue
    on small embedded systems (think USB hub with an Ethernet port)
    that only have bare essentials in their file systems.
    
    This patch eliminates glib2 dependency by reworking the
    code to use lower level system calls to dispatch connection
    handler. Instead of using glib2-style event loop and dispatching
    mechanism, just do a ppoll(2) system call in our own loop and call
    accept(2) followed by fork(2) on the socket that has incoming
    connection. Stevens' books taught us that more than twenty
    years ago. No need for anything smarter in a simple server, such
    as usbipd.
    Signed-off-by: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    328f7f8a
usbipd.c 11.9 KB