diff options
author | Volker Lendecke <vl@samba.org> | 2010-08-08 15:35:31 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-08-08 18:09:33 +0200 |
commit | bc760e79c868c11af9771c0179c18c9d543b9294 (patch) | |
tree | 168f59aef87292c5a7d1626103833bf9205e429b | |
parent | 75b4dfd14d4dac5268c01351768b2317fcce34fb (diff) | |
download | samba-bc760e79c868c11af9771c0179c18c9d543b9294.tar.gz samba-bc760e79c868c11af9771c0179c18c9d543b9294.tar.bz2 samba-bc760e79c868c11af9771c0179c18c9d543b9294.zip |
s3: Lift the smbd_messaging_context from start_background_queue
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/printing/printing.c | 20 | ||||
-rw-r--r-- | source3/smbd/server.c | 3 |
3 files changed, 12 insertions, 14 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 8c432d26fa..1b80461055 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4442,7 +4442,8 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid); bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid); void rap_jobid_delete(const char* sharename, uint32 jobid); bool print_backend_init(struct messaging_context *msg_ctx); -void start_background_queue(void); +void start_background_queue(struct tevent_context *ev, + struct messaging_context *msg); void printing_end(void); /* The following definitions come from printing/printing_db.c */ diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 28ea4f04fe..8fff73d054 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1488,7 +1488,8 @@ static pid_t background_lpq_updater_pid = -1; /**************************************************************************** main thread of the background lpq updater ****************************************************************************/ -void start_background_queue(void) +void start_background_queue(struct tevent_context *ev, + struct messaging_context *msg_ctx) { /* Use local variables for this as we don't * need to save the parent side of this, just @@ -1524,9 +1525,7 @@ void start_background_queue(void) close(pause_pipe[0]); pause_pipe[0] = -1; - status = reinit_after_fork(server_messaging_context(), - server_event_context(), - procid_self(), true); + status = reinit_after_fork(msg_ctx, ev, procid_self(), true); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("reinit_after_fork() failed\n")); @@ -1534,8 +1533,7 @@ void start_background_queue(void) } smbd_setup_sig_term_handler(); - smbd_setup_sig_hup_handler(server_event_context(), - server_messaging_context()); + smbd_setup_sig_hup_handler(ev, msg_ctx); if (!serverid_register(procid_self(), FLAG_MSG_GENERAL|FLAG_MSG_SMBD @@ -1547,12 +1545,10 @@ void start_background_queue(void) exit(1); } - messaging_register(server_messaging_context(), NULL, - MSG_PRINTER_UPDATE, print_queue_receive); + messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE, + print_queue_receive); - fde = tevent_add_fd(server_event_context(), - server_event_context(), - pause_pipe[1], TEVENT_FD_READ, + fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ, printing_pause_fd_handler, NULL); if (!fde) { @@ -1561,7 +1557,7 @@ void start_background_queue(void) } DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); - ret = tevent_loop_wait(server_event_context()); + ret = tevent_loop_wait(ev); /* should not be reached */ DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n", ret, (ret == 0) ? "out of events" : strerror(errno))); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 9a003a01b7..b24cb35295 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1114,7 +1114,8 @@ extern void build_options(bool screen); if (is_daemon && !interactive && lp_parm_bool(-1, "smbd", "backgroundqueue", true)) { - start_background_queue(); + start_background_queue(smbd_event_context(), + smbd_messaging_context()); } if (!is_daemon) { |