utility.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" /* from SVR4 bnu:utility.c 2.9 */
#include "uucp.h"
static void logError();
#define TY_ASSERT 1
#define TY_ERROR 2
/*
* produce an assert error message
* input:
* s1 - string 1
* s2 - string 2
* i1 - integer 1 (usually errno)
* file - __FILE of calling module
* line - __LINE__ of calling module
*/
void
{
return;
}
/*
* produce an assert error message
* input: -- same as assert
*/
void
{
return;
}
#define EFORMAT "%sERROR (%.9s) pid: %ld (%s) %s %s (%d) [FILE: %s, LINE: %d]\n"
static void
{
if (Debug)
else {
}
return;
if (!Debug)
return;
}
/* timeStamp - create standard time string
* return
* pointer to time string
*/
char *
{
static char str[20];
return(str);
}
/*
* Function: countProcs - Count Process to Stay Within Limits
*
* There are a number of cases in BNU when we want to limit the number
* of processes of a certain type that are running at a given time. This
* process is used to check the number of existing processes, to determine
* if a new one is allowed.
*
* The strategy is that all processes of a given type will place a lock
* file with a specific prefix in a single directory, usually
* path prefix, and countProcs will count the number of files that begin
* with the prefix and compare the count to the allowable maximum.
*
* Parameters:
*
* prefix - A full path prefix for lock files that identify
* processes that are to be counted.
* maxCount - Maximum number of allowable processes.
*
* Returns:
*
* TRUE is returned if this process is allowed to continue, and
* FALSE is returned if the maximum is exceeded.
*/
int
char * prefix;
int maxCount;
{
register char * namePrefix; /* Points to file name part */
char directory[MAXNAMESIZE];
register int processes; /* Count of processes. */
/* Separate prefix into directory part and file name part. */
/* Check to see if we can continue. */
return TRUE;
else
return FALSE;
}
/*
* return the number of files in directory <dir> who's names
* begin with <prefix>
* This is used to count the number of processes of a certain
* type that are currently running.
*
*/
int
{
int i = 0;
i++;
}
return(i);
}