rstatus.c revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lpsched.h"
/**
** insertr()
**/
void
{
if (!Request_List) {
Request_List = r;
return;
}
if (r->prev)
if (prs == Request_List)
Request_List = r;
return;
}
continue;
return;
}
}
/**
** remover()
**/
void
{
if (r == Request_List) /* on the request chain */
Request_List = r->next;
if (r->next)
if (r->prev)
r->next = 0;
r->prev = 0;
return;
}
/**
** request_by_id()
**/
RSTATUS *
request_by_id(char *id)
{
return (prs);
return (0);
}
RSTATUS *
request_by_id_num( long num )
{
return (prs);
}
return(0);
}
/**
** rsort()
**/
int
{
/*
* Of two requests needing immediate handling, the first
* will be the request with the LATER date. In case of a tie,
* the first is the one with the larger request ID (i.e. the
* one that came in last).
*/
return (-1);
else
return (1);
else
return (-1);
return (1);
/*
* Of two requests not needing immediate handling, the first
* will be the request with the highest priority. If both have
* the same priority, the first is the one with the EARLIER date.
* In case of a tie, the first is the one with the smaller ID
* (i.e. the one that came in first).
*/
return (-1);
else
return (1);
else
/*NOTREACHED*/
}
static int
{
return (1);
return (0);
/*
* The dates are the same, so compare the request IDs.
* One problem with comparing request IDs is that the order
* of two IDs may be reversed if the IDs wrapped around. This
* is a very unlikely problem, because the cycle should take
* more than one second to wrap!
*/
else {
/*
* Use the request file name (ID-0) for comparison,
* because the real request ID (DEST-ID) won't compare
* properly because of the destination prefix.
* The strlen() comparison is necessary, otherwise
* IDs like "99-0" and "100-0" will compare wrong.
*/
return (1);
return (0);
else
}
/*NOTREACHED*/
}