diff options
author | Jeremy Allison <jra@samba.org> | 2001-06-28 19:23:43 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-06-28 19:23:43 +0000 |
commit | eb57553512d22fa2de4233cf7161a4cbb55ce04a (patch) | |
tree | 954530ae3f55b1b77657c06ef92cc5f2754aadb6 | |
parent | 39117f1650f4b1a85d6d6d403398503c85b33e72 (diff) | |
download | samba-eb57553512d22fa2de4233cf7161a4cbb55ce04a.tar.gz samba-eb57553512d22fa2de4233cf7161a4cbb55ce04a.tar.bz2 samba-eb57553512d22fa2de4233cf7161a4cbb55ce04a.zip |
Properly instrument print_job_start()/print_job_end() so every fail case
logs a debug. We need this to track fail cases.
Jeremy
(This used to be commit fe5cac150d7491a7dfdaf2a54998178bbfe5a303)
-rw-r--r-- | source3/printing/printing.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 5fd2fc5680..aab4c2f43f 100644 --- a/source3/printing/printing.c +++ b/source3/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); |