struct aio_fork_pread_state {
struct aio_child *child;
+ size_t n;
+ void *data;
ssize_t ret;
struct vfs_aio_state vfs_aio_state;
};
if (req == NULL) {
return NULL;
}
+ state->n = n;
+ state->data = data;
if (n > 128*1024) {
/* TODO: support variable buffers */
return;
}
- state->child->busy = false;
-
retbuf = (struct rw_ret *)buf;
state->ret = retbuf->size;
state->vfs_aio_state.error = retbuf->ret_errno;
state->vfs_aio_state.duration = retbuf->duration;
+
+ if ((size_t)state->ret > state->n) {
+ tevent_req_error(req, EIO);
+ state->child->busy = false;
+ return;
+ }
+ memcpy(state->data, state->child->map->ptr, state->ret);
+
+ state->child->busy = false;
+
tevent_req_done(req);
}