summaryrefslogtreecommitdiffstats
path: root/source/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-28 19:23:43 +0000
committerJeremy Allison <jra@samba.org>2001-06-28 19:23:43 +0000
commitfe5cac150d7491a7dfdaf2a54998178bbfe5a303 (patch)
treea8f1935fb21351adf19b2738f50943197370f6dd /source/printing
parent0d112d7960353b33e9c5015c39a107a47e6f690d (diff)
downloadsamba-fe5cac150d7491a7dfdaf2a54998178bbfe5a303.tar.gz
samba-fe5cac150d7491a7dfdaf2a54998178bbfe5a303.tar.xz
samba-fe5cac150d7491a7dfdaf2a54998178bbfe5a303.zip
Properly instrument print_job_start()/print_job_end() so every fail case
logs a debug. We need this to track fail cases. Jeremy
Diffstat (limited to 'source/printing')
-rw-r--r--source/printing/printing.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/source/printing/printing.c b/source/printing/printing.c
index 5fd2fc56806..aab4c2f43f3 100644
--- a/source/printing/printing.c
+++ b/source/printing/printing.c
@@ -845,6 +845,7 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
SMB_BIG_UINT dspace, dsize;
if (sys_fsusage(path, &dspace, &dsize) == 0 &&
dspace < 2*(SMB_BIG_UINT)lp_minprintspace(snum)) {
+ DEBUG(3, ("print_job_start: disk space check failed.\n"));
errno = ENOSPC;
return -1;
}
@@ -852,18 +853,23 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
/* for autoloaded printers, check that the printcap entry still exists */
if (lp_autoloaded(snum) && !pcap_printername_ok(lp_servicename(snum), NULL)) {
+ DEBUG(3, ("print_job_start: printer name %s check failed.\n", lp_servicename(snum) ));
errno = ENOENT;
return -1;
}
/* Insure the maximum queue size is not violated */
if (lp_maxprintjobs(snum) && print_queue_length(snum) > lp_maxprintjobs(snum)) {
+ DEBUG(3, ("print_job_start: number of jobs (%d) larger than max printjobs per queue (%d).\n",
+ print_queue_length(snum), lp_maxprintjobs(snum) ));
errno = ENOSPC;
return -1;
}
/* Insure the maximum print jobs in the system is not violated */
if (lp_totalprintjobs() && get_total_jobs(snum) > lp_totalprintjobs()) {
+ DEBUG(3, ("print_job_start: number of jobs (%d) larger than max printjobs per system (%d).\n",
+ print_queue_length(snum), lp_totalprintjobs() ));
errno = ENOSPC;
return -1;
}
@@ -893,12 +899,16 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
tdb_lock_bystring(tdb, "INFO/nextjob");
next_jobid = tdb_fetch_int(tdb, "INFO/nextjob");
- if (next_jobid == -1) next_jobid = 1;
+ if (next_jobid == -1)
+ next_jobid = 1;
for (jobid = NEXT_JOBID(next_jobid); jobid != next_jobid; jobid = NEXT_JOBID(jobid)) {
- if (!print_job_exists(jobid)) break;
+ if (!print_job_exists(jobid))
+ break;
}
if (jobid == next_jobid || !print_job_store(jobid, &pjob)) {
+ DEBUG(3, ("print_job_start: either jobid (%d)==next_jobid(%d) or print_job_store failed.\n",
+ jobid, next_jobid ));
jobid = -1;
goto fail;
}
@@ -946,6 +956,8 @@ to open spool file %s.\n", pjob.filename));
}
tdb_unlock_bystring(tdb, "INFO/nextjob");
+
+ DEBUG(3, ("print_job_start: returning fail. Error = %s\n", strerror(errno) ));
return -1;
}
@@ -981,6 +993,7 @@ BOOL print_job_end(int jobid, BOOL normal_close)
*/
close(pjob->fd);
pjob->fd = -1;
+ DEBUG(3,("print_job_end: failed to stat file for jobid %d\n", jobid ));
goto fail;
}
@@ -998,7 +1011,8 @@ BOOL print_job_end(int jobid, BOOL normal_close)
ret = (*(current_printif->job_submit))(snum, pjob);
- if (ret) goto fail;
+ if (ret)
+ goto fail;
/* The print job has been sucessfully handed over to the back-end */
@@ -1007,11 +1021,13 @@ BOOL print_job_end(int jobid, BOOL normal_close)
print_job_store(jobid, pjob);
/* make sure the database is up to date */
- if (print_cache_expired(snum)) print_queue_update(snum);
+ if (print_cache_expired(snum))
+ print_queue_update(snum);
return True;
fail:
+
/* The print job was not succesfully started. Cleanup */
/* Still need to add proper error return propagation! 010122:JRR */
unlink(pjob->filename);