2
* dstore.c - /dev/kmem-based HP-UX global storage for lsof
7
* Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
8
* 47907. All rights reserved.
10
* Written by Victor A. Abell
12
* This software is not subject to any license of the American Telephone
13
* and Telegraph Company or the Regents of the University of California.
15
* Permission is granted to anyone to use this software for any purpose on
16
* any computer system, and to alter it and redistribute it freely, subject
17
* to the following restrictions:
19
* 1. Neither the authors nor Purdue University are responsible for any
20
* consequences of the use of this software.
22
* 2. The origin of this software must not be misrepresented, either by
23
* explicit claim or by omission. Credit to the authors and Purdue
24
* University must appear in documentation and sources.
26
* 3. Altered versions must be plainly marked as such, and must not be
27
* misrepresented as being the original software.
29
* 4. This notice may not be removed or altered.
33
static char copyright[] =
34
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
35
static char *rcsid = "$Id: dstore.c,v 1.11 2000/05/31 13:05:37 abe Exp abe $";
43
* Global storage definitions
49
char *AFSApath = (char *)NULL; /* alternate AFS name list path
51
# endif /* defined(HASAOPT) */
53
struct vfs *AFSVfsp = (struct vfs *)NULL;
54
/* AFS vfs struct kernel address */
55
#endif /* defined(HAS_AFS) */
57
int CloneMaj; /* clone major device number */
61
* Drive_Nl -- table to drive the building of Nl[] via build_Nl()
62
* (See lsof.h and misc.c.)
65
struct drive_Nl Drive_Nl[] = {
67
# if defined(hp9000s300) || defined(__hp9000s300)
68
{ "arFid", "_afs_rootFid" },
69
{ "avops", "_afs_vnodeops" },
70
{ "avol", "_afs_volumes" },
71
{ X_NCACHE, "_ncache" },
72
{ X_NCSIZE, "_ncsize" },
74
{ "nvops", "_nfs_vnodeops" },
75
{ "nvops3", "_nfs_vnodeops3" },
76
{ "nv3ops", "_nfs3_vnodeops" },
77
{ "nproc", "_nproc" },
78
{ "uvops", "_ufs_vnodeops" },
79
{ "vfops", "_vnodefops" },
82
{ "upmap", "_Usrptmap" },
84
# endif /* HPUXV<800 */
85
# endif /* defined(hp9000s300) || defined(__hp9000s300) */
87
# if defined(hp9000s800) || defined(__hp9000s800)
88
{ "arFid", "afs_rootFid" },
89
{ "avops", "afs_vnodeops" },
90
{ "avol", "afs_volumes" },
91
{ X_NCACHE, "ncache" },
92
{ X_NCSIZE, "ncsize" },
94
{ "nvops", "nfs_vnodeops" },
95
{ "nvops3", "nfs_vnodeops3" },
96
{ "nv3ops", "nfs3_vnodeops" },
98
{ "uvops", "ufs_vnodeops" },
99
{ "vfops", "vnodefops" },
102
{ "ubase", "ubase" },
103
{ "npids", "npids" },
104
# else /* HPUXV>=800 */
107
{ "clmaj", "clonemajor" },
108
# endif /* HPUXV>=1030 */
109
{ "cvops", "cdfs_vnodeops" },
110
{ "fvops", "fifo_vnodeops" },
111
{ "pvops", "pipe_vnodeops" },
112
{ "svops", "spec_vnodeops" },
113
{ "vvops", "vx_vnodeops" },
114
# endif /* HPUXV>=1000 */
115
# endif /* HPUXV<800 */
116
# endif /* defined(hp9000s800) || defined(__hp9000s800) */
118
{ "mvops", "mvfs_vnodeops" },
121
{ "chunksz", "sizeof_fd_chunk_t" },
122
# endif /* HPUXV>=1100 */
129
int HaveCloneMaj = 0; /* CloneMaj status */
130
int Kd = -1; /* /dev/kmem file descriptor */
131
KA_T Kpa; /* kernel proc structure address */
134
KA_T Ktp; /* kernel thread pointer from proc
136
#endif /* HPUXV>=1010 */
138
struct l_vfs *Lvfs = NULL; /* local vfs structure table */
141
int Mem = -1; /* /dev/mem file descriptor */
142
#endif /* HPUXV<800 */
144
#if HPUXV<800 && defined(hp9000s800)
145
int npids; /* number of PIDs (for uvadd()) */
146
struct proc *proc; /* process table address (for uvadd()) */
147
#endif /* HPUXV<800 && defined(hp9000s300) */
149
#if defined(HASFSTRUCT)
151
* Pff_tab[] - table for printing file flags
154
struct pff_tab Pff_tab[] = {
155
{ (long)FREAD, FF_READ },
156
{ (long)FWRITE, FF_WRITE },
157
{ (long)FNDELAY, FF_NDELAY },
158
{ (long)FAPPEND, FF_APPEND },
159
{ (long)FMARK, FF_MARK },
160
{ (long)FDEFER, FF_DEFER },
161
{ (long)FNBLOCK, FF_NBLOCK },
162
{ (long)FNOCTTY, FF_NOCTTY },
165
{ (long)FSYNC, FF_SYNC },
166
# else /* !defined(FSYNC) */
168
{ (long)O_SYNC, FF_SYNC },
169
# endif /* defined(O_SYNC) */
170
# endif /* defined(FSYNC) */
172
# if defined(FCOPYAVOID)
173
{ (long)FCOPYAVOID, FF_COPYAVOID },
174
# endif /* defined(FCOPYAVOID) */
176
# if defined(FPOSIX_AIO)
177
{ (long)FPOSIX_AIO, FF_POSIX_AIO },
178
# endif /* defined(FPOSIX_AIO) */
180
# if defined(FLARGEFILE)
181
{ (long)FLARGEFILE, FF_LARGEFILE },
182
# else /* !defined(FLARGEFILE) */
184
{ (long)0x800, FF_LARGEFILE },
185
# endif /* HPUXV>=1100 */
186
# endif /* defined(FLARGEFILE) */
188
{ (long)0x100, FF_KERNEL },
194
* Pof_tab[] - table for print process open file flags
198
#define UF_EXCLOSE 0x1
199
#define UF_MAPPED 0x2
200
#define UF_FDLOCK 0x4
202
# endif /* HPUXV>=1020 */
204
struct pff_tab Pof_tab[] = {
206
# if defined(UF_EXCLOSE)
207
{ (long)UF_EXCLOSE, POF_CLOEXEC },
208
# endif /* defined(UF_EXCLOSE) */
210
# if defined(UF_MAPPED)
211
{ (long)UF_MAPPED, POF_MAPPED },
212
# endif /* defined(UF_MAPPED) */
214
# if defined(UF_FDLOCK)
215
{ (long)UF_FDLOCK, POF_FDLOCK },
216
# endif /* defined(UF_FDLOCK) */
218
# if defined(UF_INUSE)
219
{ (long)UF_INUSE, POF_INUSE },
220
# endif /* defined(UF_INUSE) */
224
#endif /* defined(HASFSTRUCT) */
227
int Swap = -1; /* swap device file descriptor */
228
#endif /* HPUXV<800 */
230
#if HPUXV<800 && defined(hp9000s800)
231
struct user *ubase; /* user area base (for uvadd()) */
232
#endif /* HPUXV<800 && defined(hp9000s800) */
234
#if HPUXV<800 && defined(hp9000s300)
235
struct user *ubase; /* user area base (for uvadd()) */
236
struct pte *Usrptmap; /* user page table map pointer */
237
struct pte *usrpt; /* user page table pointer
238
* (for bktomx from vmmac.h) */
239
#endif /* HPUXV<800 && defined(hp9000s300) */
241
KA_T Vnfops; /* vnodefops switch address */