The branch, master has been updated via cf6cc948e04 s3:profile: make use of tevent_cached_getpid() in performance critical code via 0f544f33633 lib/util: make use of tevent_cached_getpid() in performance critical code via 94e130fb866 s3:lib/messages*: s/getpid/tevent_cached_getpid via bcfb257bbf9 lib/messaging: s/getpid/tevent_cached_getpid via 63d4db63fed tevent: version 0.13.0 via 673a8551d8a tevent: tevent_cached_getpid() tests via 087b1b0efda tevent: add tevent_cached_getpid() helper from 8ff2fe33bda smbd: Userspace symlink eval in filename_convert_dirfsp()
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit cf6cc948e04c52e0beb2dda246bb345588ea1e3d Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jul 25 14:29:35 2022 +0200 s3:profile: make use of tevent_cached_getpid() in performance critical code This avoids wasting getpid() during profiling. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Mon Jul 25 18:32:18 UTC 2022 on sn-devel-184 commit 0f544f33633468b5d249a10dc901e88a3820a97a Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jul 25 14:29:35 2022 +0200 lib/util: make use of tevent_cached_getpid() in performance critical code This avoids wasting getpid() calls in a lot of places... Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 94e130fb866d4b7bdbeacb4152093d827d5eb2bb Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jul 25 14:29:35 2022 +0200 s3:lib/messages*: s/getpid/tevent_cached_getpid Our messaging code is very performance critical and we should note waste time in getpid() syscalls... Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit bcfb257bbf99a6b709dacdf22da6a0e190742a90 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jul 25 14:29:35 2022 +0200 lib/messaging: s/getpid/tevent_cached_getpid Our messaging code is very performance critical and we should note waste time in getpid() syscalls... Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 63d4db63feda920c8020f8484a8b31065b7f1380 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jul 25 14:16:43 2022 +0200 tevent: version 0.13.0 - add tevent_cached_getpid() Note the changes to ABI/tevent-0.12.1.sigs only revert the temporary changes made there... Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 673a8551d8af3d832c5b8c0f76ea6db662e71a14 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jul 25 14:13:34 2022 +0200 tevent: tevent_cached_getpid() tests Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 087b1b0efda81c89493a42debcaa9013ce60cfaf Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jul 13 12:30:47 2022 +0000 tevent: add tevent_cached_getpid() helper This avoids a getpid() syscall per tevent_loop_once() iteration. We provide tevent_cached_getpid() also as helper for external consumers in order to have the logic only once. Note the change to ABI/tevent-0.12.1.sigs will be reverted with the bump to 0.13.0. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/messaging/messages_dgm.c | 14 ++--- lib/messaging/messages_dgm_ref.c | 6 +- .../ABI/{tevent-0.12.0.sigs => tevent-0.13.0.sigs} | 7 ++- lib/tevent/testsuite.c | 71 ++++++++++++++++++++++ lib/tevent/tevent.c | 41 ++++++++++++- lib/tevent/tevent.h | 16 +++++ lib/tevent/tevent_epoll.c | 7 ++- lib/tevent/tevent_port.c | 7 ++- lib/tevent/wscript | 2 +- lib/util/genrand_util.c | 3 +- lib/util/util.c | 3 +- source3/lib/messages.c | 6 +- source3/lib/messages_ctdb.c | 2 +- source3/lib/messages_ctdb_ref.c | 4 +- source3/profile/profile.c | 4 +- 15 files changed, 161 insertions(+), 32 deletions(-) copy lib/tevent/ABI/{tevent-0.12.0.sigs => tevent-0.13.0.sigs} (99%) Changeset truncated at 500 lines: diff --git a/lib/messaging/messages_dgm.c b/lib/messaging/messages_dgm.c index ef065def4d9..f71b49cc01f 100644 --- a/lib/messaging/messages_dgm.c +++ b/lib/messaging/messages_dgm.c @@ -283,7 +283,7 @@ static int messaging_dgm_out_destructor(struct messaging_dgm_out *out) DLIST_REMOVE(out->ctx->outsocks, out); if ((tevent_queue_length(out->queue) != 0) && - (getpid() == out->ctx->pid)) { + (tevent_cached_getpid() == out->ctx->pid)) { /* * We have pending jobs. We can't close the socket, * this has been handed over to messaging_dgm_out_queue_state. @@ -784,7 +784,7 @@ static int messaging_dgm_out_send_fragmented(struct tevent_context *ev, hdr = (struct messaging_dgm_fragment_hdr) { .msglen = msglen, - .pid = getpid(), + .pid = tevent_cached_getpid(), .sock = out->sock }; @@ -1011,7 +1011,7 @@ int messaging_dgm_init(struct tevent_context *ev, goto fail_nomem; } ctx->ev = ev; - ctx->pid = getpid(); + ctx->pid = tevent_cached_getpid(); ctx->recv_cb = recv_cb; ctx->recv_cb_private_data = recv_cb_private_data; @@ -1116,7 +1116,7 @@ static int messaging_dgm_context_destructor(struct messaging_dgm_context *c) close(c->sock); - if (getpid() == c->pid) { + if (tevent_cached_getpid() == c->pid) { struct sun_path_buf name; int ret; @@ -1154,7 +1154,7 @@ static int messaging_dgm_context_destructor(struct messaging_dgm_context *c) static void messaging_dgm_validate(struct messaging_dgm_context *ctx) { #ifdef DEVELOPER - pid_t pid = getpid(); + pid_t pid = tevent_cached_getpid(); struct sockaddr_storage addr; socklen_t addrlen = sizeof(addr); struct sockaddr_un *un_addr; @@ -1519,7 +1519,7 @@ int messaging_dgm_get_unique(pid_t pid, uint64_t *unique) messaging_dgm_validate(ctx); - if (pid == getpid()) { + if (pid == tevent_cached_getpid()) { /* * Protect against losing our own lock */ @@ -1632,7 +1632,7 @@ static int messaging_dgm_wipe_fn(pid_t pid, void *private_data) int messaging_dgm_wipe(void) { - pid_t pid = getpid(); + pid_t pid = tevent_cached_getpid(); messaging_dgm_forall(messaging_dgm_wipe_fn, &pid); return 0; } diff --git a/lib/messaging/messages_dgm_ref.c b/lib/messaging/messages_dgm_ref.c index 470dfbeabc7..4e38c2dea24 100644 --- a/lib/messaging/messages_dgm_ref.c +++ b/lib/messaging/messages_dgm_ref.c @@ -64,7 +64,7 @@ void *messaging_dgm_ref(TALLOC_CTX *mem_ctx, struct tevent_context *ev, tmp_refs = refs; - if ((refs != NULL) && (dgm_pid != getpid())) { + if ((refs != NULL) && (dgm_pid != tevent_cached_getpid())) { /* * Have to reinit after fork */ @@ -85,10 +85,10 @@ void *messaging_dgm_ref(TALLOC_CTX *mem_ctx, struct tevent_context *ev, *err = ret; return NULL; } - dgm_pid = getpid(); + dgm_pid = tevent_cached_getpid(); } else { int ret; - ret = messaging_dgm_get_unique(getpid(), unique); + ret = messaging_dgm_get_unique(tevent_cached_getpid(), unique); DBG_DEBUG("messaging_dgm_get_unique returned %s\n", strerror(ret)); if (ret != 0) { diff --git a/lib/tevent/ABI/tevent-0.12.0.sigs b/lib/tevent/ABI/tevent-0.13.0.sigs similarity index 99% copy from lib/tevent/ABI/tevent-0.12.0.sigs copy to lib/tevent/ABI/tevent-0.13.0.sigs index 22a8ce33413..68722a0e62f 100644 --- a/lib/tevent/ABI/tevent-0.12.0.sigs +++ b/lib/tevent/ABI/tevent-0.13.0.sigs @@ -22,6 +22,7 @@ _tevent_schedule_immediate: void (struct tevent_immediate *, struct tevent_conte _tevent_threaded_schedule_immediate: void (struct tevent_threaded_context *, struct tevent_immediate *, tevent_immediate_handler_t, void *, const char *, const char *) tevent_abort: void (struct tevent_context *, const char *) tevent_backend_list: const char **(TALLOC_CTX *) +tevent_cached_getpid: pid_t (void) tevent_cleanup_pending_signal_handlers: void (struct tevent_signal *) tevent_common_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) tevent_common_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) @@ -67,14 +68,14 @@ tevent_get_trace_signal_callback: void (struct tevent_context *, tevent_trace_si tevent_get_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t *, void *) tevent_immediate_get_tag: uint64_t (const struct tevent_immediate *) tevent_immediate_set_tag: void (struct tevent_immediate *, uint64_t) -tevent_queue_entry_get_tag: uint64_t (const struct tevent_queue_entry *) -tevent_queue_entry_set_tag: void (struct tevent_queue_entry *, uint64_t) tevent_loop_allow_nesting: void (struct tevent_context *) tevent_loop_set_nesting_hook: void (struct tevent_context *, tevent_nesting_hook, void *) tevent_num_signals: size_t (void) tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_entry_get_tag: uint64_t (const struct tevent_queue_entry *) +tevent_queue_entry_set_tag: void (struct tevent_queue_entry *, uint64_t) tevent_queue_entry_untrigger: void (struct tevent_queue_entry *) tevent_queue_length: size_t (struct tevent_queue *) tevent_queue_running: bool (struct tevent_queue *) @@ -142,8 +143,8 @@ tevent_timeval_until: struct timeval (const struct timeval *, const struct timev tevent_timeval_zero: struct timeval (void) tevent_trace_fd_callback: void (struct tevent_context *, struct tevent_fd *, enum tevent_event_trace_point) tevent_trace_immediate_callback: void (struct tevent_context *, struct tevent_immediate *, enum tevent_event_trace_point) -tevent_trace_queue_callback: void (struct tevent_context *, struct tevent_queue_entry *, enum tevent_event_trace_point) tevent_trace_point_callback: void (struct tevent_context *, enum tevent_trace_point) +tevent_trace_queue_callback: void (struct tevent_context *, struct tevent_queue_entry *, enum tevent_event_trace_point) tevent_trace_signal_callback: void (struct tevent_context *, struct tevent_signal *, enum tevent_event_trace_point) tevent_trace_timer_callback: void (struct tevent_context *, struct tevent_timer *, enum tevent_event_trace_point) tevent_update_timer: void (struct tevent_timer *, struct timeval) diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c index 3bf4bd7a574..8894e445203 100644 --- a/lib/tevent/testsuite.c +++ b/lib/tevent/testsuite.c @@ -1761,8 +1761,75 @@ static bool test_multi_tevent_threaded_2(struct torture_context *test, talloc_free(ev); return true; } + +struct test_cached_pid_thread_state { + pid_t thread_cached_pid; + pid_t thread_pid; +}; + +static void *test_cached_pid_thread(void *private_data) +{ + struct test_cached_pid_thread_state *state = + (struct test_cached_pid_thread_state *)private_data; + + state->thread_cached_pid = tevent_cached_getpid(); + state->thread_pid = getpid(); + + return NULL; +} #endif +static bool test_cached_pid(struct torture_context *test, + const void *test_data) +{ + pid_t parent_pid = getpid(); + pid_t child_pid; + pid_t finished_pid; + int child_status; + + torture_assert(test, tevent_cached_getpid() == parent_pid, "tevent_cached_getpid()"); + +#ifdef HAVE_PTHREAD + { + struct test_cached_pid_thread_state state = { .thread_cached_pid = -1, }; + pthread_t thread; + void *retval = NULL; + int ret; + + ret = pthread_create(&thread, NULL, test_cached_pid_thread, &state); + torture_assert(test, ret == 0, "pthread_create failed"); + + ret = pthread_join(thread, &retval); + torture_assert(test, ret == 0, "pthread_join failed"); + + torture_assert(test, state.thread_pid == parent_pid, "getpid() in thread"); + torture_assert(test, state.thread_cached_pid == parent_pid, "tevent_cached_getpid() in thread"); + } +#endif /* HAVE_PTHREAD */ + + child_pid = fork(); + if (child_pid == 0) { + /* child */ + pid_t pid = getpid(); + pid_t cached_pid = tevent_cached_getpid(); + + if (parent_pid == pid) { + exit(1); + } + if (pid != cached_pid) { + exit(2); + } + exit(0); + } + torture_assert(test, child_pid > 0, "fork failed"); + + finished_pid = waitpid(child_pid, &child_status, 0); + torture_assert(test, finished_pid == child_pid, "wrong child"); + torture_assert(test, child_status == 0, "child_status"); + + return true; +} + struct torture_suite *torture_local_event(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, "event"); @@ -1817,5 +1884,9 @@ struct torture_suite *torture_local_event(TALLOC_CTX *mem_ctx) #endif + torture_suite_add_simple_tcase_const(suite, "tevent_cached_getpid", + test_cached_pid, + NULL); + return suite; } diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 81268a1bd7a..262fdaa22ed 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -199,6 +199,7 @@ static void tevent_common_wakeup_fini(struct tevent_context *ev); static pthread_mutex_t tevent_contexts_mutex = PTHREAD_MUTEX_INITIALIZER; static struct tevent_context *tevent_contexts = NULL; static pthread_once_t tevent_atfork_initialized = PTHREAD_ONCE_INIT; +static pid_t tevent_cached_global_pid = 0; static void tevent_atfork_prepare(void) { @@ -263,6 +264,8 @@ static void tevent_atfork_child(void) struct tevent_context *ev; int ret; + tevent_cached_global_pid = getpid(); + for (ev = DLIST_TAIL(tevent_contexts); ev != NULL; ev = DLIST_PREV(ev)) { struct tevent_threaded_context *tctx; @@ -302,9 +305,41 @@ static void tevent_prep_atfork(void) if (ret != 0) { abort(); } + + tevent_cached_global_pid = getpid(); +} + +#endif + +static int tevent_init_globals(void) +{ +#ifdef HAVE_PTHREAD + int ret; + + ret = pthread_once(&tevent_atfork_initialized, tevent_prep_atfork); + if (ret != 0) { + return ret; + } +#endif + + return 0; } +_PUBLIC_ pid_t tevent_cached_getpid(void) +{ +#ifdef HAVE_PTHREAD + tevent_init_globals(); +#ifdef TEVENT_VERIFY_CACHED_GETPID + if (tevent_cached_global_pid != getpid()) { + tevent_abort(NULL, "tevent_cached_global_pid invalid"); + } +#endif + if (tevent_cached_global_pid != 0) { + return tevent_cached_global_pid; + } #endif + return getpid(); +} int tevent_common_context_destructor(struct tevent_context *ev) { @@ -434,13 +469,13 @@ static int tevent_common_context_constructor(struct tevent_context *ev) { int ret; -#ifdef HAVE_PTHREAD - - ret = pthread_once(&tevent_atfork_initialized, tevent_prep_atfork); + ret = tevent_init_globals(); if (ret != 0) { return ret; } +#ifdef HAVE_PTHREAD + ret = pthread_mutex_init(&ev->scheduled_mutex, NULL); if (ret != 0) { return ret; diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index 1c337adbf74..656df254be0 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -1909,6 +1909,22 @@ struct timeval tevent_timeval_add(const struct timeval *tv, uint32_t secs, */ struct timeval tevent_timeval_current_ofs(uint32_t secs, uint32_t usecs); +/** + * + * @brief A cached version of getpid() + * + * We use getpid() in a lot a performance critical situations + * in order to check if caches are still valid in the current process. + * + * Calling getpid() always add the cost of an additional syscall! + * + * When tevent is build with pthread support, we already make use + * of pthread_atfork(), so it's trivial to use it maintain a cache for getpid(). + * + * @return The pid of the current process. + */ +pid_t tevent_cached_getpid(void); + /* @} */ diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index 9cbe505c98a..1f1f47b2b21 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -206,7 +206,7 @@ static int epoll_init_ctx(struct epoll_event_context *epoll_ev) "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - epoll_ev->pid = getpid(); + epoll_ev->pid = tevent_cached_getpid(); talloc_set_destructor(epoll_ev, epoll_ctx_destructor); return 0; @@ -224,8 +224,9 @@ static void epoll_check_reopen(struct epoll_event_context *epoll_ev) struct tevent_fd *fde; bool *caller_panic_state = epoll_ev->panic_state; bool panic_triggered = false; + pid_t pid = tevent_cached_getpid(); - if (epoll_ev->pid == getpid()) { + if (epoll_ev->pid == pid) { return; } @@ -241,7 +242,7 @@ static void epoll_check_reopen(struct epoll_event_context *epoll_ev) "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - epoll_ev->pid = getpid(); + epoll_ev->pid = pid; epoll_ev->panic_state = &panic_triggered; for (fde=epoll_ev->ev->fd_events;fde;fde=fde->next) { fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; diff --git a/lib/tevent/tevent_port.c b/lib/tevent/tevent_port.c index e91d442389d..ccb65a711b2 100644 --- a/lib/tevent/tevent_port.c +++ b/lib/tevent/tevent_port.c @@ -95,7 +95,7 @@ static int port_init_ctx(struct port_event_context *port_ev) "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - port_ev->pid = getpid(); + port_ev->pid = tevent_cached_getpid(); talloc_set_destructor(port_ev, port_ctx_destructor); return 0; @@ -199,8 +199,9 @@ static int port_update_event(struct port_event_context *port_ev, struct tevent_f static int port_check_reopen(struct port_event_context *port_ev) { struct tevent_fd *fde; + pid_t pid = tevent_cached_getpid(); - if (port_ev->pid == getpid()) { + if (port_ev->pid == pid) { return 0; } @@ -217,7 +218,7 @@ static int port_check_reopen(struct port_event_context *port_ev) "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - port_ev->pid = getpid(); + port_ev->pid = pid; for (fde=port_ev->ev->fd_events;fde;fde=fde->next) { fde->additional_flags &= PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; if (port_update_event(port_ev, fde) != 0) { diff --git a/lib/tevent/wscript b/lib/tevent/wscript index 2ba920c976a..5c6f02cf302 100644 --- a/lib/tevent/wscript +++ b/lib/tevent/wscript @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tevent' -VERSION = '0.12.1' +VERSION = '0.13.0' import sys, os diff --git a/lib/util/genrand_util.c b/lib/util/genrand_util.c index 9aa35de3ae7..fdc2654a204 100644 --- a/lib/util/genrand_util.c +++ b/lib/util/genrand_util.c @@ -21,6 +21,7 @@ #include "replace.h" #include "system/locale.h" +#include <tevent.h> #include "lib/util/samba_util.h" #include "lib/util/debug.h" @@ -56,7 +57,7 @@ _PUBLIC_ uint64_t generate_unique_u64(uint64_t veto_value) int pid; } generate_unique_u64_state; - int pid = getpid(); + int pid = tevent_cached_getpid(); if (unlikely(pid != generate_unique_u64_state.pid)) { generate_unique_u64_state = (struct generate_unique_u64_state) { diff --git a/lib/util/util.c b/lib/util/util.c index 8c2a74fe5f3..02d1cbfda17 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -25,6 +25,7 @@ #include "replace.h" #include <talloc.h> +#include <tevent.h> #include "system/network.h" #include "system/filesys.h" #include "system/locale.h" @@ -422,7 +423,7 @@ _PUBLIC_ bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type) if ((ret != -1) && (lock.l_type != F_UNLCK) && (lock.l_pid != 0) && - (lock.l_pid != getpid())) { + (lock.l_pid != tevent_cached_getpid())) { DEBUG(3,("fcntl_lock: fd %d is locked by pid %d\n",fd,(int)lock.l_pid)); return true; } diff --git a/source3/lib/messages.c b/source3/lib/messages.c index 8641a9dad56..7d3d46960a9 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -525,7 +525,7 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx, } ctx->id = (struct server_id) { - .pid = getpid(), .vnn = NONCLUSTER_VNN + .pid = tevent_cached_getpid(), .vnn = NONCLUSTER_VNN }; ctx->event_ctx = ev; @@ -651,7 +651,7 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx) } msg_ctx->id = (struct server_id) { - .pid = getpid(), .vnn = msg_ctx->id.vnn + .pid = tevent_cached_getpid(), .vnn = msg_ctx->id.vnn }; lck_path = lock_path(talloc_tos(), "msg.lock"); @@ -907,7 +907,7 @@ static int send_all_fn(pid_t pid, void *private_data) struct send_all_state *state = private_data; NTSTATUS status; - if (pid == getpid()) { + if (pid == tevent_cached_getpid()) { DBG_DEBUG("Skip ourselves in messaging_send_all\n"); return 0; } diff --git a/source3/lib/messages_ctdb.c b/source3/lib/messages_ctdb.c index d3e2e3f8589..3e784bf7237 100644 --- a/source3/lib/messages_ctdb.c +++ b/source3/lib/messages_ctdb.c @@ -104,7 +104,7 @@ int messaging_ctdb_init(const char *sockname, int timeout, uint64_t unique_id, goto fail; } - ret = register_with_ctdbd(ctx->conn, getpid(), messaging_ctdb_recv, + ret = register_with_ctdbd(ctx->conn, tevent_cached_getpid(), messaging_ctdb_recv, ctx); if (ret != 0) { DBG_DEBUG("register_with_ctdbd returned %s (%d)\n", diff --git a/source3/lib/messages_ctdb_ref.c b/source3/lib/messages_ctdb_ref.c index 3570ed8ae4c..ed6285f2e36 100644 --- a/source3/lib/messages_ctdb_ref.c -- Samba Shared Repository