The branch, v3-6-test has been updated via 9eb0084 s3:selftest: mark samba3.posix_s3.smb2.lock (dc).rw-exclusive as known to fail via c86299b tevent: More doc fixes via 86772b9 tevent: Some documentation fixes via d288159 tevent: Fix a typo from cef866a Fix a memleak in nss_wins
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 9eb0084726c18a43e581388032dd59c31525adb3 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Dec 27 11:18:44 2010 +0100 s3:selftest: mark samba3.posix_s3.smb2.lock (dc).rw-exclusive as known to fail This sometimes fails like this: [218/271 in 22m22s] samba3.posix_s3.smb2.lock (dc) UNEXPECTED(failure): samba3.posix_s3.smb2.lock (dc).rw-exclusive REASON: _StringException: _StringException: ../torture/smb2/lock.c:406: status was NT_STATUS_END_OF_FILE, expected NT_STATUS_OK: (../torture/smb2/lock.c:406) command: LD_LIBRARY_PATH=/memdisk/tridge/flakey/b18675/source3/source3/bin/shared:/memdisk/tridge/flakey/b18675/source3/source3/bin: bin/smbtorture4 --configfile=$SMB_CONF_PATH --maximum-runtime=1200 --target=samba3 --basedir=/memdisk/tridge/flakey/b18675/source3/source3/st --option="torture:winbindd_netbios_name=$SERVER" --option="torture:winbindd_netbios_domain=$DOMAIN" --option=torture:localdir=/memdisk/tridge/flakey/b18675/source3/source3/st/dc/share --option=torture:sharedelay=100000 //$SERVER_IP/tmp -U$USERNAME%$PASSWORD smb2.lock 2>&1 | ../selftest/filter-subunit --prefix "samba3.posix_s3.smb2.lock (dc)." expanded command: LD_LIBRARY_PATH=/memdisk/tridge/flakey/b18675/source3/source3/bin/shared:/memdisk/tridge/flakey/b18675/source3/source3/bin: bin/smbtorture4 --configfile=/memdisk/tridge/flakey/b18675/source3/source3/st/client/client.conf --maximum-runtime=1200 --target=samba3 --basedir=/memdisk/tridge/flakey/b18675/source3/source3/st --option="torture:winbindd_netbios_name=LOCALDC2" --option="torture:winbindd_netbios_domain=SAMBA-TEST" --option=torture:localdir=/memdisk/tridge/flakey/b18675/source3/source3/st/dc/share --option=torture:sharedelay=100000 //127.0.0.2/tmp -Utridge%localdc2pass smb2.lock 2>&1 | ../selftest/filter-subunit --prefix "samba3.posix_s3.smb2.lock (dc)." ERROR: Testsuite[samba3.posix_s3.smb2.lock (dc)] REASON: Exit code was 1 metze Autobuild-User: Stefan Metzmacher <me...@samba.org> Autobuild-Date: Mon Dec 27 12:08:51 CET 2010 on sn-devel-104 (cherry picked from commit e1de884eaa28d8ac67d4060e76e146e0216447ff) commit c86299b76a05746f12d2c5b576ec01d27c759ce6 Author: Volker Lendecke <v...@samba.org> Date: Sat Dec 25 23:45:30 2010 +0100 tevent: More doc fixes Autobuild-User: Volker Lendecke <vlen...@samba.org> Autobuild-Date: Sun Dec 26 10:20:51 CET 2010 on sn-devel-104 (cherry picked from commit d2de01f95bc55529281e2860222330d5021d3d69) commit 86772b9a7a0a6c30203c84b2a9cd28fa8217e417 Author: Volker Lendecke <v...@samba.org> Date: Sat Dec 25 23:09:19 2010 +0100 tevent: Some documentation fixes Autobuild-User: Volker Lendecke <vlen...@samba.org> Autobuild-Date: Sat Dec 25 23:58:20 CET 2010 on sn-devel-104 (cherry picked from commit f16740a408a7a5f648a4cb4b5bef098cf3aec458) commit d2881592fd0bfc9f25e863a608c032fdb24bfb54 Author: Volker Lendecke <v...@samba.org> Date: Sat Dec 25 15:19:16 2010 +0100 tevent: Fix a typo Autobuild-User: Volker Lendecke <vlen...@samba.org> Autobuild-Date: Sat Dec 25 22:56:18 CET 2010 on sn-devel-104 (cherry picked from commit 5353eaea33f34752a27ed47fee26426227f5a752) ----------------------------------------------------------------------- Summary of changes: lib/tevent/doc/mainpage.dox | 2 +- lib/tevent/tevent.h | 119 +++++++++++++++++++++++++++++++----------- source3/selftest/knownfail | 1 + 3 files changed, 90 insertions(+), 32 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/tevent/doc/mainpage.dox b/lib/tevent/doc/mainpage.dox index 5cd3969..e2f986e 100644 --- a/lib/tevent/doc/mainpage.dox +++ b/lib/tevent/doc/mainpage.dox @@ -8,7 +8,7 @@ * signals, and the classic file descriptor events. * * Tevent also provide helpers to deal with asynchronous code providing the - * tevent_req (tevent tequest) functions. + * tevent_req (tevent request) functions. * * @section tevent_download Download * diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index 82c1483..1c01a63 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -509,50 +509,65 @@ int tevent_set_debug_stderr(struct tevent_context *ev); * @defgroup tevent_request The tevent request functions. * @ingroup tevent * - * This represents an async request being processed by callbacks via an event - * context. A user can issue for example a write request to a socket, giving - * an implementation function the fd, the buffer and the number of bytes to - * transfer. The function issuing the request will immediately return without - * blocking most likely without having sent anything. The API user then fills - * in req->async.fn and req->async.private_data, functions that are called - * when the request is finished. - * - * It is up to the user of the async request to talloc_free it after it has - * finished. This can happen while the completion function is called. + * A tevent_req represents an asynchronous computation. + * + * The tevent_req group of API calls is the recommended way of + * programming async computations within tevent. In particular the + * file descriptor (tevent_add_fd) and timer (tevent_add_timed) events + * are considered too low-level to be used in larger computations. To + * read and write from and to sockets, Samba provides two calls on top + * of tevent_add_fd: read_packet_send/recv and writev_send/recv. These + * requests are much easier to compose than the low-level event + * handlers called from tevent_add_fd. + * + * An async computation is started by a computation_send + * function. When it is finished, its result can be received by a + * computation_recv function. + * + * It is up to the user of the async computation to talloc_free it + * after it has finished. If an async computation should be aborted, + * the tevent_req structure can be talloc_free'ed. After it has + * finished, it should talloc_free'ed by the API user. * * @{ */ /** - * An async request moves between the following 4 states: + * An async request moves from TEVENT_REQ_INIT to + * TEVENT_REQ_IN_PROGRESS. All other states are valid after a request + * has finished. */ enum tevent_req_state { /** - * we are creating the request + * We are creating the request */ TEVENT_REQ_INIT, /** - * we are waiting the request to complete + * We are waiting the request to complete */ TEVENT_REQ_IN_PROGRESS, /** - * the request is finished + * The request is finished successfully */ TEVENT_REQ_DONE, /** - * A user error has occurred + * A user error has occurred. The user error has been + * indicated by tevent_req_error(), it can be retrieved via + * tevent_req_is_error(). */ TEVENT_REQ_USER_ERROR, /** - * Request timed out + * Request timed out after the timeout set by tevent_req_set_endtime. */ TEVENT_REQ_TIMED_OUT, /** - * No memory in between + * An internal allocation has failed, or tevent_req_nomem has + * been given a NULL pointer as the first argument. */ TEVENT_REQ_NO_MEMORY, /** - * the request is already received by the caller + * The request has been received by the caller. No further + * action is valid. */ TEVENT_REQ_RECEIVED }; @@ -583,9 +598,17 @@ void tevent_req_set_callback(struct tevent_req *req, tevent_req_fn fn, void *pvt #ifdef DOXYGEN /** - * @brief Get the private data casted to the given type for a callback from + * @brief Get the private data cast to the given type for a callback from * a tevent request structure. * + * @code + * static void computation_done(struct tevent_req *subreq) { + * struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); + * struct computation_state *state = tevent_req_data(req, struct computation_state); + * .... more things, eventually maybe call tevent_req_done(req); + * } + * @endcode + * * @param[in] req The structure to get the callback data from. * * @param[in] type The type of the private callback data to get. @@ -621,9 +644,11 @@ void *tevent_req_callback_data_void(struct tevent_req *req); * * @param[in] req The structure to get the private data from. * + * @param[in] type The type of the private data + * * @return The private data or NULL if not set. */ -void *tevent_req_data(struct tevent_req *req); +void *tevent_req_data(struct tevent_req *req, #type); #else void *_tevent_req_data(struct tevent_req *req); #define tevent_req_data(_req, _type) \ @@ -755,22 +780,22 @@ bool _tevent_req_cancel(struct tevent_req *req, const char *location); /** * @brief Create an async tevent request. * - * The new async request will be initialized in state ASYNC_REQ_IN_PROGRESS. + * The new async request will be initialized in state TEVENT_REQ_IN_PROGRESS. * - * @param[in] mem_ctx The memory context for the result. - * - * @param[in] pstate The private state of the request. - * - * @param[in] state_size The size of the private state of the request. + * @code + * struct tevent_req *req; + * struct computation_state *state; + * req = tevent_req_create(mem_ctx, &state, struct computation_state); + * @endcode * + * @param[in] mem_ctx The memory context for the result. + * @param[in] pstate Pointer to the private request state. * @param[in] type The name of the request. * * @return A new async request. NULL on error. */ struct tevent_req *tevent_req_create(TALLOC_CTX *mem_ctx, - void *pstate, - size_t state_size, - const char *type); + void **pstate, #type); #else struct tevent_req *_tevent_req_create(TALLOC_CTX *mem_ctx, void *pstate, @@ -904,12 +929,30 @@ bool _tevent_req_nomem(const void *p, * @brief Finish a request before the caller had the change to set the callback. * * An implementation of an async request might find that it can either finish - * the request without waiting for an external event, or it can't even start + * the request without waiting for an external event, or it can not even start * the engine. To present the illusion of a callback to the user of the API, * the implementation can call this helper function which triggers an * immediate timed event. This way the caller can use the same calling * conventions, independent of whether the request was actually deferred. * + * @code + * struct tevent_req *computation_send(TALLOC_CTX *mem_ctx, + * struct tevent_context *ev) + * { + * struct tevent_req *req, *subreq; + * struct computation_state *state; + * req = tevent_req_create(mem_ctx, &state, struct computation_state); + * if (req == NULL) { + * return NULL; + * } + * subreq = subcomputation_send(state, ev); + * if (tevent_req_nomem(subreq, req)) { + * return tevent_req_post(req, ev); + * } + * return req; + * } + * @endcode + * * @param[in] req The finished request. * * @param[in] ev The tevent_context for the timed event. @@ -961,7 +1004,21 @@ bool tevent_req_poll(struct tevent_req *req, struct tevent_context *ev); /** - * @brief Get the tevent request and the actual error code you've set. + * @brief Get the tevent request state and the actual error set by + * tevent_req_error. + * + * @code + * int computation_recv(struct tevent_req *req, uint64_t *perr) + * { + * enum tevent_req_state state; + * uint64_t err; + * if (tevent_req_is_error(req, &state, &err)) { + * *perr = err; + * return -1; + * } + * return 0; + * } + * @endcode * * @param[in] req The tevent request to get the error from. * diff --git a/source3/selftest/knownfail b/source3/selftest/knownfail index 54cffa8..fde9b76 100644 --- a/source3/selftest/knownfail +++ b/source3/selftest/knownfail @@ -3,3 +3,4 @@ samba3.posix_s3.rap.printing # fails sometimes on sn-devel samba3.posix_s3.rpc.spoolss.*printserver.enum_printers_old # fails on some hosts due to timing issues ? samba3.posix_s3.rpc.spoolss.printer.*addprinterex.print_test # another intermittent failure +samba3.posix_s3.smb2.lock.*.rw-exclusive # another intermittent failure -- Samba Shared Repository