requeue.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6.1.4 */
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
#include "lpsched.h"
#include "validate.h"
/*
* The routines in this file are used to examine queued requests
* to see if something must be done about them. We don't bother
* checking requests that are:
*
* - printing (we could, to allow the administrator to stop
* a request by making a configuration change, but that
* can lead to trouble (yet another way to terminate a child)
* and the administrator can always disable the request to
* force it to stop printing and be reevaluated);
*
* - changing, since once the change is complete the request
* will be reevaluated again anyway;
*
* - notifying, since the request is essentially finished
*
* - being sent or already sent to a remote machine;
*
* - done.
*
* Requests that are being held or are filtering ARE to be considered,
* because things may have changed to make them impossible to print.
*/
/**
** queue_attract() - REASSIGN REQUEST(S) TO PRINTER, IF POSSIBLE
**/
void
{
int called_schedule = 0;
/*
* Evaluate requests that:
* - meet a criteria set by a function passed.
* - are already queued for the printer
* - are destined for a class containing this printer
* - or are destined for any printer
* We stop on the first one that will work on the printer,
* and schedule an interface for the printer (which will
* find the first request ready, namely the one we stopped on).
*/
( \
)
if (
&& (
)
)
/*
* Don't need to evaluate the request if it
* is already queued!
*/
if (
) {
/*
* This request was attracted to the
* printer but maybe it now needs to be
* filtered. If so, filter it but see if
* there's another request all set to go.
*/
if (NEEDS_FILTERING(prs))
else {
if (!called_schedule) {
called_schedule = 1;
}
if (attract_just_one)
break;
}
}
}
return;
}
/**
** queue_repel() - REASSIGN REQUESTS TO ANOTHER PRINTER, IF POSSIBLE
**/
int
{
register int all_can = 1;
/*
* Reevaluate all requests that are assigned to this
* printer, to see if there's another printer that
* can handle them.
*
* If the "move_off" flag is set, don't consider the current
* printer when reevaluating, but also don't cancel the request
* if it can't be moved off the printer.
* (Currently this is only used when deciding if a printer
* can be deleted.)
*/
/*
* "all_can" keeps track of whether all of the requests
* of interest to the caller (governed by "qchk_p") can
* be moved to another printer. Now we don't move certain
* requests (active, done, gone remote), and some of those
* matter in the ``all can'' consideration.
*/
continue;
all_can = 0;
continue;
} else
/*
* If this request needs to be filtered,
* try to schedule it for filtering,
* otherwise schedule it for printing.
* We are inefficient here, because we may
* try to schedule many requests but the
* filtering slot(s) and printers are
* busy; but the requests may languish
* if we don't check here.
*/
if (NEEDS_FILTERING(prs))
else
} else {
all_can = 0;
if (!move_off)
else
}
return (all_can);
}
/**
** queue_check() - CHECK ALL REQUESTS AGAIN
**/
void
{
if (NEEDS_FILTERING(prs))
else
else
return;
}
/**
** qchk_waiting() - CHECK IF REQUEST IS READY TO PRINT
** qchk_filter() - CHECK IF REQUEST NEEDS A FILTER
** qchk_form() - CHECK IF REQUEST NEEDS A FORM
** qchk_pwheel() - CHECK IF REQUEST NEEDS PRINT A WHEEL
**/
int
{
return (
&& !NEEDS_FILTERING(prs)
);
}
int
{
/*
* No need to reevaluate this request if it isn't using a filter
* or if it is done or is being changed.
*/
return (
);
}
int
{
}
char * pwheel_in_question;
int
{
}