s3: Remove a bunch of calls to procid_self()
authorVolker Lendecke <vl@samba.org>
Mon, 12 Dec 2011 13:55:54 +0000 (14:55 +0100)
committerVolker Lendecke <vlendec@samba.org>
Mon, 12 Dec 2011 20:50:25 +0000 (21:50 +0100)
All callers to messaging_[re]init only used procid_self()

28 files changed:
source3/include/g_lock.h
source3/include/messages.h
source3/include/proto.h
source3/lib/g_lock.c
source3/lib/messages.c
source3/lib/messages_ctdbd.c
source3/lib/server_contexts.c
source3/lib/util.c
source3/libnet/libnet_samsync.c
source3/nmbd/asyncdns.c
source3/nmbd/nmbd.c
source3/printing/print_cups.c
source3/printing/queue_process.c
source3/printing/spoolssd.c
source3/rpc_server/epmd.c
source3/rpc_server/lsasd.c
source3/smbd/process.c
source3/smbd/server.c
source3/torture/msgtest.c
source3/utils/dbwrap_tool.c
source3/utils/dbwrap_torture.c
source3/utils/net.c
source3/utils/net_g_lock.c
source3/utils/net_registry.c
source3/utils/smbcontrol.c
source3/utils/status.c
source3/winbindd/winbindd.c
source3/winbindd/winbindd_dual.c

index fc9a8721de81fdc85a3cb16c7417a372cb749d1b..f4b78094751b8cb35c378e0bd7c62489b7a475dc 100644 (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,
index 083cd562562f7abc151e6f6e9a60441685001e86..e3538f176599d7a4cdf8c87990e67fbaedcb2522 100644 (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,
index 2d61ef4a4ec7d929bd9e1699ba33a3b6af62a829..15cd7f9be0048629ab0323b44adab1a482309262 100644 (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);
index 65d7c44295c0a6d03fbe368666d8ddf8dd7b73e3..561617023f4a8e9bc698c4cc29a7f9f00058492b 100644 (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;
        }
index ab655af574c81509d198f5a2712848d40dc3d5b0..421d88375d521be6d933396b85257cecac51f429 100644 (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)) {
index 9e092bc699f89dfd736c096eeec6e26e206554ed..b7db2a76f094bbd85646bbf959adc3856c4c1f54 100644 (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;
index a95ea9acc2ac0816aba4df0305b46ca5b345638e..d49e33402fa6c55bd97f63d322837af43f043912 100644 (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;
index 9b9d34c22f4766acd2b3776e756e2f109f3d686d..2e432ab18eb861af824b9050e63adcaf4ce69810 100644 (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)));
index 75fc329e0af6b69617d6b5b516af340218a4b6a7..3ab635121ae497ead01ddf49fbb97082aecc83af 100644 (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;
index 9e7707b4102c925f2daf3d50c6af09c022c22832..0edec372cd4d31b10d78b15707148284b238994c 100644 (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"));
index 08a5504be42a037036dd7951bfc7f5a0aa5753fa..f61220b156eb9cbf513b1f57c355541100469ab0 100644 (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"));
index b8bbddfebd07cd63491c845c53f08d802a59e4a9..95ddd570bb797bd3e387e824c3c9a479971d784c 100644 (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");
index 7b2972d2c03700ffb79e107de900c3445ca1fc0d..5c00e8b00127297651770a8ab2fc033da4d8a6cb 100644 (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"));
index 5ea14c9f7a829d15689dd442a13074eafce09a6f..06ce61b9cde15dc5799934ee40c93fcbf7c2bc27 100644 (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");
index 8c7efb4747e6fd5226b1fc7d993f38e2e9306b4c..0d5e6ec6af8acede65a0dcf979d553cb59594d3d 100644 (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"));
index a4c07b1b1a2456129b33fcb49f914d909ac40cb9..575b863976dd60eb2c3eb3e4371d7ce306bbe593 100644 (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");
index 0d17ad7f8cedd8c9f37cd997e96b11632c60d614..3b3c1040cec0f8cc1eba6fb1d6a1f0c9afa73319 100644 (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)));
index 1786be65900ef14bcad36674d54ae472846a36f4..31b6fcad83b1495a12c60f72976ea65e75659d64 100644 (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);
index 1dd010b9d187c2e8b6a5bdf7e1e5501fb066e7d0..c7c95c167897b1e3ab3571ebecce3bdab38eefc2 100644 (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);
        }
index fe4e6ebef4374b322cc8bb6768b388dafe76c9a7..7850dc168e33b02c79dbc17c5e4996ebb5e6a5ea 100644 (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;
index 3ce1f53b41230a6787947c650dd4cb7243e424b1..9907f31f7672040290def5f047e889e1135f8202 100644 (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;
index ce9e7c57b210a3e5cfe827ba4de9d8be6489728d..70ed0aa47a74a776380280c2532881aaa94b9fe8 100644 (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);
 
index f8a7a8b62020b3bd185a3be1502665841ae8153d..b9d99160bc5fdceaa4fd808f4b53ca36cee066fd 100644 (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));
index 3c9177df52d5875f507606933fbabff355d0b7b1..90b0d19ff4e78673b6185c959637dba43a64fd80 100644 (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"),
index 97161a09bc96f23352ee357cc10ea105072b51a7..747c35ceba44b6f3e54f512a68b570b1dbbb88f3 100644 (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);
index 8bae5bc1ae56fc786ae0666f8e7dc35dd5c5b0c1..76f6167570b30a5ff1375dcf58e7fc1d10c15513 100644 (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;
index b33328c8d34b541295bee91c5d36ba6662bad61f..5e23859b4059d14f36e51641f5bccefd0341141d 100644 (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);
index 036ad2721340aa811053b744430eb7e89a17c59a..d0bcd3bd402a47bd811607efc1fd43677d8fc002 100644 (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"));