File:  [CSRG BSD Unix] / 43BSD / ingres / source / ctlmod / av_files.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3

# include	<ingres.h>
# include	<aux.h>
# include	<opsys.h>
# include	"ctlmod.h"
# include	<sccs.h>

SCCSID(@(#)av_files.c	8.1	12/31/84)

/*
**  AV_FILES -- return number of files available for user files.
**
**	Takes NOFILE and reduces it by the number of files that are
**	open or could be open (for the catalog descriptors).
**
**	Parameters:
**		none.
**
**	Returns:
**		the number of available file descriptor to play with.
**
**	Side Effects:
**		none.
*/

extern struct desxx	Desxx[];

av_files()
{
	auto long		fopn;
	register int		nopn;
	register int		i;
	register struct desxx	*p;

	markopen(&fopn);
	nopn = 0;
	for (i = 0; i < 32; i++)
	{
		if (bitset(1 << i, fopn))
			nopn++;
	}

	/* now scan the descriptor cache */
	for (p = Desxx; p->cach_relname != NULL; p++)
	{
		if (p->cach_alias != NULL)
			continue;
		if (p->cach_desc->relopn == 0)
			nopn++;
	}

	return (NOFILE - nopn);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.