1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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 <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2022-07-25 14:29:35 +02:00 committed by Jeremy Allison
parent bcfb257bbf
commit 94e130fb86
3 changed files with 6 additions and 6 deletions

View File

@ -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;
}

View File

@ -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",

View File

@ -61,7 +61,7 @@ void *messaging_ctdb_ref(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
tmp_refs = refs;
if ((refs != NULL) && (ctdb_pid != getpid())) {
if ((refs != NULL) && (ctdb_pid != tevent_cached_getpid())) {
/*
* Have to reinit after fork
*/
@ -82,7 +82,7 @@ void *messaging_ctdb_ref(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
*err = ret;
return NULL;
}
ctdb_pid = getpid();
ctdb_pid = tevent_cached_getpid();
}
result->fde = messaging_ctdb_register_tevent_context(result, ev);