1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s3: Remove a bunch of calls to procid_self()

All callers to messaging_[re]init only used procid_self()
This commit is contained in:
Volker Lendecke 2011-12-12 14:55:54 +01:00 committed by Volker Lendecke
parent 77dc976b53
commit 0f9d14820e
28 changed files with 31 additions and 45 deletions

View File

@ -44,7 +44,7 @@ NTSTATUS g_lock_get(struct g_lock_ctx *ctx, const char *name,
struct server_id *pid);
NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
struct timeval timeout, struct server_id self,
struct timeval timeout,
void (*fn)(void *private_data), void *private_data);
int g_lock_locks(struct g_lock_ctx *ctx,

View File

@ -109,7 +109,6 @@ bool message_send_all(struct messaging_context *msg_ctx,
int *n_sent);
struct event_context *messaging_event_context(struct messaging_context *msg_ctx);
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
struct server_id server_id,
struct event_context *ev);
struct server_id messaging_server_id(const struct messaging_context *msg_ctx);
@ -117,8 +116,7 @@ struct server_id messaging_server_id(const struct messaging_context *msg_ctx);
/*
* re-init after a fork
*/
NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
struct server_id id);
NTSTATUS messaging_reinit(struct messaging_context *msg_ctx);
NTSTATUS messaging_register(struct messaging_context *msg_ctx,
void *private_data,

View File

@ -497,7 +497,6 @@ ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos
int set_blocking(int fd, bool set);
NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
struct event_context *ev_ctx,
struct server_id id,
bool parent_longlived);
void *malloc_(size_t size);
void *memalign_array(size_t el_size, size_t align, unsigned int count);

View File

@ -748,7 +748,6 @@ NTSTATUS g_lock_get(struct g_lock_ctx *ctx, const char *name,
static bool g_lock_init_all(TALLOC_CTX *mem_ctx,
struct tevent_context **pev,
struct messaging_context **pmsg,
const struct server_id self,
struct g_lock_ctx **pg_ctx)
{
struct tevent_context *ev = NULL;
@ -760,7 +759,7 @@ static bool g_lock_init_all(TALLOC_CTX *mem_ctx,
d_fprintf(stderr, "ERROR: could not init event context\n");
goto fail;
}
msg = messaging_init(mem_ctx, self, ev);
msg = messaging_init(mem_ctx, ev);
if (msg == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto fail;
@ -783,7 +782,7 @@ fail:
}
NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
struct timeval timeout, const struct server_id self,
struct timeval timeout,
void (*fn)(void *private_data), void *private_data)
{
struct tevent_context *ev = NULL;
@ -791,7 +790,7 @@ NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
struct g_lock_ctx *g_ctx = NULL;
NTSTATUS status;
if (!g_lock_init_all(talloc_tos(), &ev, &msg, self, &g_ctx)) {
if (!g_lock_init_all(talloc_tos(), &ev, &msg, &g_ctx)) {
status = NT_STATUS_ACCESS_DENIED;
goto done;
}

View File

@ -182,7 +182,6 @@ struct event_context *messaging_event_context(struct messaging_context *msg_ctx)
}
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
struct server_id server_id,
struct event_context *ev)
{
struct messaging_context *ctx;
@ -192,7 +191,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
return NULL;
}
ctx->id = server_id;
ctx->id = procid_self();
ctx->event_ctx = ev;
status = messaging_tdb_init(ctx, ctx, &ctx->local);
@ -237,14 +236,13 @@ struct server_id messaging_server_id(const struct messaging_context *msg_ctx)
/*
* re-init after a fork
*/
NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
struct server_id id)
NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
{
NTSTATUS status;
TALLOC_FREE(msg_ctx->local);
msg_ctx->id = id;
msg_ctx->id = procid_self();
status = messaging_tdb_init(msg_ctx, msg_ctx, &msg_ctx->local);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -69,7 +69,7 @@ struct ctdbd_connection *messaging_ctdbd_connection(void)
DEBUG(0,("event_context_init failed\n"));
}
msg = messaging_init(NULL, procid_self(), ev);
msg = messaging_init(NULL, ev);
if (!msg) {
DEBUG(0,("messaging_init failed\n"));
return NULL;

View File

@ -55,7 +55,6 @@ struct messaging_context *server_messaging_context(void)
* children exiting.
*/
server_msg_ctx = messaging_init(NULL,
procid_self(),
server_event_context());
}
return server_msg_ctx;

View File

@ -372,7 +372,6 @@ ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos
NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
struct event_context *ev_ctx,
struct server_id id,
bool parent_longlived)
{
NTSTATUS status = NT_STATUS_OK;
@ -399,7 +398,7 @@ NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
* For clustering, we need to re-init our ctdbd connection after the
* fork
*/
status = messaging_reinit(msg_ctx, id);
status = messaging_reinit(msg_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("messaging_reinit() failed: %s\n",
nt_errstr(status)));

View File

@ -81,8 +81,7 @@ NTSTATUS libnet_samsync_init_context(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(ctx->domain_sid_str);
}
ctx->msg_ctx = messaging_init(ctx, procid_self(),
event_context_init(ctx));
ctx->msg_ctx = messaging_init(ctx, event_context_init(ctx));
NT_STATUS_HAVE_NO_MEMORY(ctx->msg_ctx);
*ctx_p = ctx;

View File

@ -168,7 +168,7 @@ void start_async_dns(void)
status = reinit_after_fork(nmbd_messaging_context(),
nmbd_event_context(),
procid_self(), true);
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));

View File

@ -917,7 +917,7 @@ static bool open_sockets(bool isdaemon, int port)
status = reinit_after_fork(nmbd_messaging_context(),
nmbd_event_context(),
procid_self(), false);
false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));

View File

@ -433,7 +433,7 @@ static bool cups_pcap_load_async(struct tevent_context *ev,
close_all_print_db();
status = reinit_after_fork(msg_ctx, ev, procid_self(), true);
status = reinit_after_fork(msg_ctx, ev, true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
smb_panic("cups_pcap_load_async: reinit_after_fork() failed");

View File

@ -255,7 +255,7 @@ pid_t start_background_queue(struct tevent_context *ev,
close(pause_pipe[0]);
pause_pipe[0] = -1;
status = reinit_after_fork(msg_ctx, ev, procid_self(), true);
status = reinit_after_fork(msg_ctx, ev, true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));

View File

@ -285,7 +285,7 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx,
procid_self(), true);
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
@ -666,7 +666,7 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
status = reinit_after_fork(msg_ctx,
ev_ctx,
procid_self(), true);
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");

View File

@ -164,7 +164,6 @@ void start_epmd(struct tevent_context *ev_ctx,
status = reinit_after_fork(msg_ctx,
ev_ctx,
procid_self(),
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));

View File

@ -248,7 +248,7 @@ static bool lsasd_child_init(struct tevent_context *ev_ctx,
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx,
procid_self(), true);
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
@ -883,7 +883,7 @@ void start_lsasd(struct tevent_context *ev_ctx,
status = reinit_after_fork(msg_ctx,
ev_ctx,
procid_self(), true);
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");

View File

@ -2886,7 +2886,7 @@ bool fork_echo_handler(struct smbd_server_connection *sconn)
status = reinit_after_fork(sconn->msg_ctx,
sconn->ev_ctx,
procid_self(), false);
false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("reinit_after_fork failed: %s\n",
nt_errstr(status)));

View File

@ -451,7 +451,6 @@ static void smbd_accept_connection(struct tevent_context *ev,
status = reinit_after_fork(msg_ctx,
ev,
procid_self(),
true);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
@ -1120,7 +1119,7 @@ extern void build_options(bool screen);
status = reinit_after_fork(msg_ctx,
ev_ctx,
procid_self(), false);
false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);

View File

@ -54,7 +54,7 @@ static void pong_message(struct messaging_context *msg_ctx,
lp_load_global(get_dyn_CONFIGFILE());
if (!(evt_ctx = tevent_context_init(NULL)) ||
!(msg_ctx = messaging_init(NULL, procid_self(), evt_ctx))) {
!(msg_ctx = messaging_init(NULL, evt_ctx))) {
fprintf(stderr, "could not init messaging context\n");
exit(1);
}

View File

@ -457,7 +457,7 @@ int main(int argc, const char **argv)
goto done;
}
msg_ctx = messaging_init(mem_ctx, procid_self(), evt_ctx);
msg_ctx = messaging_init(mem_ctx, evt_ctx);
if (msg_ctx == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto done;

View File

@ -292,7 +292,7 @@ int main(int argc, const char *argv[])
goto done;
}
msg_ctx = messaging_init(mem_ctx, procid_self(), ev_ctx);
msg_ctx = messaging_init(mem_ctx, ev_ctx);
if (msg_ctx == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto done;

View File

@ -948,8 +948,7 @@ static struct functable net_func[] = {
/* Failing to init the msg_ctx isn't a fatal error. Only
root-level things (joining/leaving domains etc.) will be denied. */
c->msg_ctx = messaging_init(c, procid_self(),
event_context_init(c));
c->msg_ctx = messaging_init(c, event_context_init(c));
rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);

View File

@ -36,7 +36,7 @@ static bool net_g_lock_init(TALLOC_CTX *mem_ctx,
d_fprintf(stderr, "ERROR: could not init event context\n");
goto fail;
}
msg = messaging_init(mem_ctx, procid_self(), ev);
msg = messaging_init(mem_ctx, ev);
if (msg == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto fail;
@ -91,7 +91,7 @@ static int net_g_lock_do(struct net_context *c, int argc, const char **argv)
status = g_lock_do(name, G_LOCK_WRITE,
timeval_set(timeout / 1000, timeout % 1000),
procid_self(), net_g_lock_do_fn, &state);
net_g_lock_do_fn, &state);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "ERROR: g_lock_do failed: %s\n",
nt_errstr(status));

View File

@ -642,7 +642,7 @@ static int net_registry_increment(struct net_context *c, int argc,
}
status = g_lock_do("registry_increment_lock", G_LOCK_WRITE,
timeval_set(600, 0), procid_self(),
timeval_set(600, 0),
net_registry_increment_fn, &state);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, _("g_lock_do failed: %s\n"),

View File

@ -1478,7 +1478,7 @@ int main(int argc, const char **argv)
* shell needs 0. */
if (!(evt_ctx = tevent_context_init(NULL)) ||
!(msg_ctx = messaging_init(NULL, procid_self(), evt_ctx))) {
!(msg_ctx = messaging_init(NULL, evt_ctx))) {
fprintf(stderr, "could not init messaging context\n");
TALLOC_FREE(frame);
exit(1);

View File

@ -386,8 +386,7 @@ static int traverse_sessionid(const char *key, struct sessionid *session,
* connection, usable by the db_open() calls further
* down.
*/
msg_ctx = messaging_init(NULL, procid_self(),
event_context_init(NULL));
msg_ctx = messaging_init(NULL, event_context_init(NULL));
if (msg_ctx == NULL) {
fprintf(stderr, "messaging_init failed\n");
ret = -1;

View File

@ -1407,7 +1407,7 @@ int main(int argc, char **argv, char **envp)
status = reinit_after_fork(winbind_messaging_context(),
winbind_event_context(),
procid_self(), false);
false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);

View File

@ -1182,7 +1182,6 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
status = reinit_after_fork(
winbind_messaging_context(),
winbind_event_context(),
procid_self(),
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));