|
|
1.1 root 1: # include <ingres.h>
2: # include <aux.h>
3: # include <opsys.h>
4: # include "ctlmod.h"
5: # include <sccs.h>
6:
7: SCCSID(@(#)av_files.c 7.1 2/5/81)
8:
9: /*
10: ** AV_FILES -- return number of files available for user files.
11: **
12: ** Takes NOFILE and reduces it by the number of files that are
13: ** open or could be open (for the catalog descriptors).
14: **
15: ** Parameters:
16: ** none.
17: **
18: ** Returns:
19: ** the number of available file descriptor to play with.
20: **
21: ** Side Effects:
22: ** none.
23: */
24:
25: extern struct desxx Desxx[];
26:
27: av_files()
28: {
29: auto long fopn;
30: register int nopn;
31: register int i;
32: register struct desxx *p;
33:
34: markopen(&fopn);
35: nopn = 0;
36: for (i = 0; i < 32; i++)
37: {
38: if (bitset(1 << i, fopn))
39: nopn++;
40: }
41:
42: /* now scan the descriptor cache */
43: for (p = Desxx; p->cach_relname != NULL; p++)
44: {
45: if (p->cach_alias != NULL)
46: continue;
47: if (p->cach_desc->relopn == 0)
48: nopn++;
49: }
50:
51: return (NOFILE - nopn);
52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.