BSD 4_3_Tahoe release
[unix-history] / usr / src / sys / h / text.h
CommitLineData
95f51977
C
1/*
2 * Copyright (c) 1982, 1986 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
ca67e7b4 6 * @(#)text.h 7.2 (Berkeley) 10/13/86
95f51977 7 */
59703a43
C
8
9/*
10 * Text structure.
11 * One allocated per pure
12 * procedure on swap device.
13 * Manipulated by text.c
14 */
95f51977 15#define NXDAD 12 /* param.h:MAXTSIZ / vmparam.h:DMTEXT */
59703a43
C
16
17struct text
18{
95f51977
C
19 struct text *x_forw; /* forward link in free list */
20 struct text **x_back; /* backward link in free list */
21 swblk_t x_daddr[NXDAD]; /* disk addresses of dmtext-page segments */
59703a43
C
22 swblk_t x_ptdaddr; /* disk address of page table */
23 size_t x_size; /* size (clicks) */
24 struct proc *x_caddr; /* ptr to linked proc, if loaded */
25 struct inode *x_iptr; /* inode of prototype */
26 short x_rssize;
27 short x_swrss;
95f51977
C
28 short x_count; /* reference count */
29 short x_ccount; /* number of loaded references */
59703a43
C
30 char x_flag; /* traced, written flags */
31 char x_slptime;
32 short x_poip; /* page out in progress count */
ca67e7b4
C
33#if defined(tahoe)
34 short x_ckey; /* code cache key */
35#endif
59703a43
C
36};
37
38#ifdef KERNEL
39struct text *text, *textNTEXT;
40int ntext;
41#endif
42
95f51977
C
43#define XTRC 0x01 /* Text may be written, exclusive use */
44#define XWRIT 0x02 /* Text written into, must swap out */
45#define XLOAD 0x04 /* Currently being read from file */
46#define XLOCK 0x08 /* Being swapped in or out */
47#define XWANT 0x10 /* Wanted for swapping */
48#define XPAGI 0x20 /* Page in on demand from inode */
49#define XUNUSED 0x40 /* unused since swapped out for cache */
50
51/*
52 * Text table statistics
53 */
54struct xstats {
55 u_long alloc; /* calls to xalloc */
56 u_long alloc_inuse; /* found in use/sticky */
57 u_long alloc_cachehit; /* found in cache */
58 u_long alloc_cacheflush; /* flushed cached text */
59 u_long alloc_unused; /* flushed unused cached text */
60 u_long free; /* calls to xfree */
61 u_long free_inuse; /* still in use/sticky */
62 u_long free_cache; /* placed in cache */
63 u_long free_cacheswap; /* swapped out to place in cache */
64};