> void my_process_read(my_data *d, unsigned int events) {
> int n, s;
>
> do {
> s = d->buffer_size - d->in_buffer;
> if ((n = read(d->fd, d->buffer + d->in_buffer, s)) > 0) {
> process_partial_buffer(d, s);
> d->in_buffer += s;
> }
> } while (n == s);
> if (s == -1 && errno != EAGAIN) {
> handle_read_error(d);
> return;
> }
> if (events & EPOLLRDHUP) {
> d->flags |= HANGUP;
> schedule_removal(d);
> }
> }
Ouch, this is obviously :
void my_process_read(my_data *d, unsigned int events) {
int n, s;
do {
s = d->buffer_size - d->in_buffer;
if ((n = read(d->fd, d->buffer + d->in_buffer, s)) > 0) {
process_partial_buffer(d, n);
d->in_buffer += n;
}
} while (n == s);
if (n == -1 && errno != EAGAIN) {
handle_read_error(d);
return;
}
if (events & EPOLLRDHUP) {
d->flags |= HANGUP;
schedule_removal(d);
}
}
- Davide
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/