summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-12-12 14:55:54 +0100
committerVolker Lendecke <vlendec@samba.org>2011-12-12 21:50:25 +0100
commit0f9d14820e222233d63b7a79b4b1ff044332ef41 (patch)
treed3e48dcf07b6d8364ac7cabf80391b626b5509fb
parent77dc976b53490e06dff649f199033fe799b714bf (diff)
downloadsamba-0f9d14820e222233d63b7a79b4b1ff044332ef41.tar.gz
samba-0f9d14820e222233d63b7a79b4b1ff044332ef41.tar.bz2
samba-0f9d14820e222233d63b7a79b4b1ff044332ef41.zip
s3: Remove a bunch of calls to procid_self()
All callers to messaging_[re]init only used procid_self()
-rw-r--r--source3/include/g_lock.h2
-rw-r--r--source3/include/messages.h4
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/lib/g_lock.c7
-rw-r--r--source3/lib/messages.c8
-rw-r--r--source3/lib/messages_ctdbd.c2
-rw-r--r--source3/lib/server_contexts.c1
-rw-r--r--source3/lib/util.c3
-rw-r--r--source3/libnet/libnet_samsync.c3
-rw-r--r--source3/nmbd/asyncdns.c2
-rw-r--r--source3/nmbd/nmbd.c2
-rw-r--r--source3/printing/print_cups.c2
-rw-r--r--source3/printing/queue_process.c2
-rw-r--r--source3/printing/spoolssd.c4
-rw-r--r--source3/rpc_server/epmd.c1
-rw-r--r--source3/rpc_server/lsasd.c4
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/server.c3
-rw-r--r--source3/torture/msgtest.c2
-rw-r--r--source3/utils/dbwrap_tool.c2
-rw-r--r--source3/utils/dbwrap_torture.c2
-rw-r--r--source3/utils/net.c3
-rw-r--r--source3/utils/net_g_lock.c4
-rw-r--r--source3/utils/net_registry.c2
-rw-r--r--source3/utils/smbcontrol.c2
-rw-r--r--source3/utils/status.c3
-rw-r--r--source3/winbindd/winbindd.c2
-rw-r--r--source3/winbindd/winbindd_dual.c1
28 files changed, 31 insertions, 45 deletions
diff --git a/source3/include/g_lock.h b/source3/include/g_lock.h
index fc9a8721de..f4b7809475 100644
--- a/source3/include/g_lock.h
+++ b/source3/include/g_lock.h
@@ -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,
diff --git a/source3/include/messages.h b/source3/include/messages.h
index 083cd56256..e3538f1765 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -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,
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2d61ef4a4e..15cd7f9be0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 65d7c44295..561617023f 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -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;
}
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index ab655af574..421d88375d 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -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)) {
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 9e092bc699..b7db2a76f0 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -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;
diff --git a/source3/lib/server_contexts.c b/source3/lib/server_contexts.c
index a95ea9acc2..d49e33402f 100644
--- a/source3/lib/server_contexts.c
+++ b/source3/lib/server_contexts.c
@@ -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;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 9b9d34c22f..2e432ab18e 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -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)));
diff --git a/source3/libnet/libnet_samsync.c b/source3/libnet/libnet_samsync.c
index 75fc329e0a..3ab635121a 100644
--- a/source3/libnet/libnet_samsync.c
+++ b/source3/libnet/libnet_samsync.c
@@ -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;
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 9e7707b410..0edec372cd 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -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"));
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 08a5504be4..f61220b156 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -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"));
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index b8bbddfebd..95ddd570bb 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -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");
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c
index 7b2972d2c0..5c00e8b001 100644
--- a/source3/printing/queue_process.c
+++ b/source3/printing/queue_process.c
@@ -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"));
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 5ea14c9f7a..06ce61b9cd 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -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");
diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c
index 8c7efb4747..0d5e6ec6af 100644
--- a/source3/rpc_server/epmd.c
+++ b/source3/rpc_server/epmd.c
@@ -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"));
diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c
index a4c07b1b1a..575b863976 100644
--- a/source3/rpc_server/lsasd.c
+++ b/source3/rpc_server/lsasd.c
@@ -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");
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 0d17ad7f8c..3b3c1040ce 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -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)));
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 1786be6590..31b6fcad83 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -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);
diff --git a/source3/torture/msgtest.c b/source3/torture/msgtest.c
index 1dd010b9d1..c7c95c1678 100644
--- a/source3/torture/msgtest.c
+++ b/source3/torture/msgtest.c
@@ -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);
}
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index fe4e6ebef4..7850dc168e 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -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;
diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c
index 3ce1f53b41..9907f31f76 100644
--- a/source3/utils/dbwrap_torture.c
+++ b/source3/utils/dbwrap_torture.c
@@ -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;
diff --git a/source3/utils/net.c b/source3/utils/net.c
index ce9e7c57b2..70ed0aa47a 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -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);
diff --git a/source3/utils/net_g_lock.c b/source3/utils/net_g_lock.c
index f8a7a8b620..b9d99160bc 100644
--- a/source3/utils/net_g_lock.c
+++ b/source3/utils/net_g_lock.c
@@ -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));
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 3c9177df52..90b0d19ff4 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -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"),
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 97161a09bc..747c35ceba 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -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);
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 8bae5bc1ae..76f6167570 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -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;
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index b33328c8d3..5e23859b40 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -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);
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 036ad27213..d0bcd3bd40 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -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"));