summaryrefslogtreecommitdiff
path: root/source3/printing/printing.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing/printing.c')
-rw-r--r--source3/printing/printing.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 97eaaebcc4..7e1f59f590 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -796,12 +796,21 @@ write to a print file
****************************************************************************/
int print_job_write(int jobid, const char *buf, int size)
{
- int fd;
+ int return_code;
+ struct printjob *pjob = print_job_find(jobid);
- fd = print_job_fd(jobid);
- if (fd == -1) return -1;
+ if (!pjob)
+ return -1;
+ /* don't allow another process to get this info - it is meaningless */
+ if (pjob->pid != local_pid)
+ return -1;
- return write(fd, buf, size);
+ return_code = write(pjob->fd, buf, size);
+ if (return_code>0) {
+ pjob->size += size;
+ print_job_store(jobid, pjob);
+ }
+ return return_code;
}
/****************************************************************************
@@ -1044,6 +1053,23 @@ to open spool file %s.\n", pjob.filename));
}
/****************************************************************************
+ Update the number of pages spooled to jobid
+****************************************************************************/
+
+void print_job_endpage(int jobid)
+{
+ struct printjob *pjob = print_job_find(jobid);
+ if (!pjob)
+ return;
+ /* don't allow another process to get this info - it is meaningless */
+ if (pjob->pid != local_pid)
+ return;
+
+ pjob->page_count++;
+ print_job_store(jobid, pjob);
+}
+
+/****************************************************************************
Print a file - called on closing the file. This spools the job.
If normal close is false then we're tearing down the jobs - treat as an
error.
@@ -1137,6 +1163,7 @@ static int traverse_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *
ts->queue[i].job = jobid;
ts->queue[i].size = pjob.size;
+ ts->queue[i].page_count = pjob.page_count;
ts->queue[i].status = pjob.status;
ts->queue[i].priority = 1;
ts->queue[i].time = pjob.starttime;