I need to add SIGCHLD handling to child.c.  For that to work, child_open() must
be able to insert an additional pollfd into the event loop.  I am really unsure
how best to handle this.  One thought is to specify read/write/hangup/error
callbacks for each pollfd.

typedef int (*poll_cb_t)(device_t*);
struct pollfd_ex {
    device_t* dev;
    VEC_T(poll_cb_t) readable_cbs;
    VEC_T(poll_cb_t) writable_cbs;
    VEC_T(poll_cb_t) pollerr_cbs;
};

But the above has problems, since it effectively forbids the low-level or high-
level code from changing its callbacks after the device is opened.  Maybe this
is an acceptable restriction.

I'd like *something* to replace the current stupid pollfd_in/pollfd_out system
which is a pain to work with.  But there must still be a default sink and a
default source, or else what fd's are the buffers associated with?


Adding or removing devices inside the event loop is dangerous unless certain
precautions are taken.  I should document this.  Better yet, ensure safety.


The following functions, or similar, probably need to be implemented.  Right
now sending and receiving is implemented by directly accessing the input and
output buffers and the pollfd_out struct, which is dangerous in case of, say,
null_init().  I already have device_sendf()... maybe more of the same?

int device_send(device_t* dev, char** buf, int  len)
int device_recv(device_t* dev, char** buf, int* len)

# vim: set ts=4 sts=4 sw=4 tw=80 et syn=off:
