summaryrefslogtreecommitdiffstats
path: root/source3/modules/vfs_default.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-03-24 14:36:34 +0000
committerJeremy Allison <jra@samba.org>2014-03-27 06:06:12 +0100
commitc35fec883cf344a269e65670521e2580a91c24aa (patch)
tree17fbb77f4671ea8aaa94399de88471592ba6e436 /source3/modules/vfs_default.c
parentc5d07df6abe657ff196266bbfbb376ca7db0968b (diff)
downloadsamba-c35fec883cf344a269e65670521e2580a91c24aa.tar.gz
samba-c35fec883cf344a269e65670521e2580a91c24aa.tar.xz
samba-c35fec883cf344a269e65670521e2580a91c24aa.zip
asys: Allow multiple results to be received
This makes use of C99 dynamic arrays. In this performance-sensitive code, I would like to avoid malloc/free, and I think 15 years after the standard we might be able to use this feature. Alternatively, we could use the "results" memory area and store the jobids in the upper range, playing some cast-tricks. Should work as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/modules/vfs_default.c')
-rw-r--r--source3/modules/vfs_default.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 7dd9c0ca3e..02ab35b128 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -793,44 +793,39 @@ static void vfswrap_asys_finished(struct tevent_context *ev,
uint16_t flags, void *p)
{
struct asys_context *asys_ctx = (struct asys_context *)p;
- struct tevent_req *req;
- struct vfswrap_asys_state *state;
- int res;
- ssize_t ret;
- int err;
- void *private_data;
if ((flags & TEVENT_FD_READ) == 0) {
return;
}
while (true) {
- res = asys_result(asys_ctx, &ret, &err, &private_data);
- if (res == EINTR || res == EAGAIN) {
+ struct tevent_req *req;
+ struct vfswrap_asys_state *state;
+ struct asys_result result;
+ int res;
+
+ res = asys_results(asys_ctx, &result, 1);
+ if (res < 0) {
+ DEBUG(1, ("asys_result returned %s\n",
+ strerror(-res)));
return;
}
-#ifdef EWOULDBLOCK
- if (res == EWOULDBLOCK) {
- return;
- }
-#endif
-
- if (res == ECANCELED) {
+ if (res == 0) {
return;
}
- if (res != 0) {
- DEBUG(1, ("asys_result returned %s\n", strerror(res)));
+ if ((result.ret == -1) && (result.err == ECANCELED)) {
return;
}
- req = talloc_get_type_abort(private_data, struct tevent_req);
+ req = talloc_get_type_abort(result.private_data,
+ struct tevent_req);
state = tevent_req_data(req, struct vfswrap_asys_state);
talloc_set_destructor(state, NULL);
- state->ret = ret;
- state->err = err;
+ state->ret = result.ret;
+ state->err = result.err;
tevent_req_defer_callback(req, ev);
tevent_req_done(req);
}