summaryrefslogtreecommitdiffstats
path: root/source3/printing
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
commitca4c584fb553c650753e6c621d58c1fa71e8adc8 (patch)
treeccdc8152feb0acb2cf71374116fdd53a172f0110 /source3/printing
parent3f1d1008428f9563d33dff96d1304e30dae3d0f2 (diff)
downloadsamba-ca4c584fb553c650753e6c621d58c1fa71e8adc8.tar.gz
samba-ca4c584fb553c650753e6c621d58c1fa71e8adc8.tar.xz
samba-ca4c584fb553c650753e6c621d58c1fa71e8adc8.zip
Optimisation to send only to correct processid.
Jeremy (This used to be commit 3807c747a4522c719fe67b876e4a3bd92bffcf7f)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printing.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index db67585332..acdaed46ae 100644
--- a/source3/printing/printing.c
+++ b/source3/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);
}
/****************************************************************************