summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-10-16 23:52:14 +0000
committerJeremy Allison <jra@samba.org>2001-10-16 23:52:14 +0000
commit3807c747a4522c719fe67b876e4a3bd92bffcf7f (patch)
tree75c8ca79d5db6de3196e02280c162d7ec01c1113
parent8ef9dff3074e7979579ce66a204e8ec7bf62a587 (diff)
downloadsamba-3807c747a4522c719fe67b876e4a3bd92bffcf7f.tar.gz
samba-3807c747a4522c719fe67b876e4a3bd92bffcf7f.tar.xz
samba-3807c747a4522c719fe67b876e4a3bd92bffcf7f.zip
Optimisation to send only to correct processid.
Jeremy
-rw-r--r--source/printing/printing.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/printing/printing.c b/source/printing/printing.c
index db675853327..acdaed46aec 100644
--- a/source/printing/printing.c
+++ b/source/printing/printing.c
@@ -477,14 +477,24 @@ static void print_queue_receive(int msg_type, pid_t src, void *buf, size_t len)
print_queue_update_background(snum);
}
+static pid_t background_lpq_updater_pid;
+
/****************************************************************************
main thread of the background lpq updater
****************************************************************************/
void start_background_queue(void)
{
- DEBUG(3,("Starting background LPQ thread\n"));
- if(sys_fork()==0) {
- DEBUG(5,("background LPQ thread started\n"));
+ DEBUG(3,("start_background_queue: Starting background LPQ thread\n"));
+ background_lpq_updater_pid = sys_fork();
+
+ if (background_lpq_updater_pid == -1) {
+ DEBUG(5,("start_background_queue: background LPQ thread failed to start. %s\n", strerror(errno) ));
+ exit(1);
+ }
+
+ if(background_lpq_updater_pid == 0) {
+ /* Child. */
+ DEBUG(5,("start_background_queue: background LPQ thread started\n"));
claim_connection(NULL,"smbd lpq backend",MAXSTATUS,False);
@@ -498,10 +508,10 @@ void start_background_queue(void)
message_register(MSG_PRINTER_UPDATE, print_queue_receive);
- DEBUG(5,("background LPQ thread waiting for messages\n"));
+ DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n"));
while (1) {
pause();
- DEBUG(10,("background LPQ thread got a message\n"));
+ DEBUG(10,("start_background_queue: background LPQ thread got a message\n"));
message_dispatch();
}
}
@@ -512,7 +522,7 @@ update the internal database from the system print queue for a queue
****************************************************************************/
static void print_queue_update(int snum)
{
- message_send_all(conn_tdb_ctx(), MSG_PRINTER_UPDATE, &snum, sizeof(snum), False);
+ message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE, &snum, sizeof(snum), False);
}
/****************************************************************************