/*
* 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 2007 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"
#include <syslog.h>
#include <strings.h>
#ifdef LP_USE_PAPI_ATTR
static char *extractReqno(char *req_file);
#endif
/**
** chfiles() - CHANGE OWNERSHIP OF FILES, RETURN TOTAL SIZE
**/
{
char *file;
total = 0;
{
{
/*
* Once this routine (chfiles) is called for a request,
* any temporary files are ``ours'', i.e. they are on our
* machine. A user running on an RFS-connected remote machine
* can't necessarily know our machine name, so can't put
* can. Of course, this is all done with mirrors, as Lp_Temp
* and Lp_Tmp/local-machine are symbolicly linked. So we just
* change the name. This saves on wear and tear later.
*/
{
}
}
return(-1);
case 0:
case S_IFREG:
break;
case S_IFIFO:
return(-1);
/*
* If any of the files is a FIFO, the size indicator
* becomes meaningless. On the other hand, returning
* a total of zero causes the request to be rejected,
* so we return something > 0.
*/
break;
case S_IFDIR:
case S_IFCHR:
case S_IFBLK:
default:
return(-1);
}
}
return(total);
}
/**
**/
{
char *path;
int reqfd;
int count = 0;
#ifdef LP_USE_PAPI_ATTR
#endif
char *p, *q;
/*
* The secure request file is removed first to prevent
* reloading should the system crash while in rmfiles().
*/
/*
* Copy the request file to the log file, if asked,
* or simply remove it.
*/
if (fd == -1)
register int n;
}
}
if (q = strrchr(p, '-')) {
*q = NULL;
}
Free(p);
#ifdef LP_USE_PAPI_ATTR
/* Look for a PAPI job attribute file, if it exists remove it */
{
/* PAPI job attribute file exists for this job so remove it */
}
#endif
}
if (file) /* remove file in filelist */
while(*file)
{
/*
* The copies of user files.
*/
count++;
file++;
}
char *p;
/*
* The filtered files. We can't rely on just the RS_FILTERED
* flag, since the request may have been cancelled while
* filtering. On the other hand, just checking "rp->slow"
* doesn't mean that the files exist, because the request
* may have been canceled BEFORE filtering started. Oh well.
*/
while(count > 0)
{
}
/*
*/
}
}
/**
** _alloc_req_id(void) - ALLOCATE NEXT REQUEST ID
**/
long
_alloc_req_id ( void )
{
static short started = 0;
static int fd;
static long start;
static long end;
static long incr;
static long curr;
static long wrap;
static char fmt[
+ 1 /* : */
+ 1 /* : */
+ 1 /* : */
+ 4 /* %ld\n */
+ 1 /* (nul) */
];
int len;
long ret;
if (!started) {
end = SEQF_DEF_END;
}
if (start < 0)
if (end > SEQF_DEF_END)
end = SEQF_DEF_END;
started = 1;
}
do {
/* write the new id file */
note("alloc_req_id(): out of ids\n");
return(SEQF_DEF_START-1);
} else
return (ret);
}
/**
** _alloc_file() - ALLOCATE FILES FOR A REQUEST
**/
char *
int num,
char * prefix,
)
{
static char base[
1 /* F */
+ 1 /* - */
+ 1 /* (nul) */
];
char * file;
char * cp;
int fd;
int plus;
if (num > BIGGEST_REQID)
return (0);
if (!prefix) {
int id;
return(NULL); /* Out of request IDs (errno = EEXIST) */
plus = 0;
} else {
return (0);
plus = 1;
}
while (num--) {
return (0);
} else {
}
}
#ifdef LP_USE_PAPI_ATTR
{
/*
* Initial job request (s_alloc_files) so create an empty PAPI
* Attribute file; note, this file will only be used if the
* print job has been submitted via the PAPI interface.
*/
{
{
return (0);
}
else
{
}
}
}
#endif
*cp = 0;
return (base);
}
#ifdef LP_USE_PAPI_ATTR
{
{
start++;
{
result[n] = '\0';
}
}
return (result);
} /* extractReqno() */
#endif