~peter-pearse/ubuntu/natty/lsof/prop001

« back to all changes in this revision

Viewing changes to dialects/hpux/kmem/dstore.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2006-05-15 18:08:45 UTC
  • mfrom: (1.2.2 upstream) (2.1.4 dapper)
  • Revision ID: james.westby@ubuntu.com-20060515180845-ag9wagz7dsf377d9
* Readded scripts which got lost with the upload of 4.77.dfsg.1-1.
* Documented the usage of example scripts. (closes: #184491)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * dstore.c - /dev/kmem-based HP-UX global storage for lsof
 
3
 */
 
4
 
 
5
 
 
6
/*
 
7
 * Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
 
8
 * 47907.  All rights reserved.
 
9
 *
 
10
 * Written by Victor A. Abell
 
11
 *
 
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.
 
14
 *
 
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:
 
18
 *
 
19
 * 1. Neither the authors nor Purdue University are responsible for any
 
20
 *    consequences of the use of this software.
 
21
 *
 
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.
 
25
 *
 
26
 * 3. Altered versions must be plainly marked as such, and must not be
 
27
 *    misrepresented as being the original software.
 
28
 *
 
29
 * 4. This notice may not be removed or altered.
 
30
 */
 
31
 
 
32
#ifndef lint
 
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 $";
 
36
#endif
 
37
 
 
38
 
 
39
#include "lsof.h"
 
40
 
 
41
 
 
42
/*
 
43
 * Global storage definitions
 
44
 */
 
45
 
 
46
#if     defined(HAS_AFS)
 
47
 
 
48
# if    defined(HASAOPT)
 
49
char *AFSApath = (char *)NULL;          /* alternate AFS name list path
 
50
                                         * (from -A) */
 
51
# endif /* defined(HASAOPT) */
 
52
 
 
53
struct vfs *AFSVfsp = (struct vfs *)NULL;
 
54
                                        /* AFS vfs struct kernel address */
 
55
#endif  /* defined(HAS_AFS) */
 
56
 
 
57
int CloneMaj;                           /* clone major device number */
 
58
 
 
59
 
 
60
/*
 
61
 * Drive_Nl -- table to drive the building of Nl[] via build_Nl()
 
62
 *             (See lsof.h and misc.c.)
 
63
 */
 
64
 
 
65
struct drive_Nl Drive_Nl[] = {
 
66
 
 
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"               },
 
73
        { "proc",       "_proc"                 },
 
74
        { "nvops",      "_nfs_vnodeops"         },
 
75
        { "nvops3",     "_nfs_vnodeops3"        },
 
76
        { "nv3ops",     "_nfs3_vnodeops"        },
 
77
        { "nproc",      "_nproc"                },
 
78
        { "uvops",      "_ufs_vnodeops"         },
 
79
        { "vfops",      "_vnodefops"            },
 
80
 
 
81
#  if   HPUXV<800
 
82
        { "upmap",      "_Usrptmap"             },
 
83
        { "upt",        "_usrpt"                },
 
84
#  endif        /* HPUXV<800 */
 
85
# endif /* defined(hp9000s300) || defined(__hp9000s300) */
 
86
 
 
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"                },
 
93
        { "proc",       "proc"                  },
 
94
        { "nvops",      "nfs_vnodeops"          },
 
95
        { "nvops3",     "nfs_vnodeops3"         },
 
96
        { "nv3ops",     "nfs3_vnodeops"         },
 
97
        { "nproc",      "nproc"                 },
 
98
        { "uvops",      "ufs_vnodeops"          },
 
99
        { "vfops",      "vnodefops"             },
 
100
 
 
101
#  if   HPUXV<800
 
102
        { "ubase",      "ubase"                 },
 
103
        { "npids",      "npids"                 },
 
104
#  else /* HPUXV>=800 */
 
105
#   if  HPUXV>=1000
 
106
#    if HPUXV>=1030
 
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) */
 
117
 
 
118
        { "mvops",      "mvfs_vnodeops"         },
 
119
 
 
120
# if    HPUXV>=1100
 
121
        { "chunksz",    "sizeof_fd_chunk_t"     },
 
122
# endif /* HPUXV>=1100 */
 
123
 
 
124
        { "",           ""                      },
 
125
        { NULL,         NULL                    }
 
126
};
 
127
 
 
128
 
 
129
int HaveCloneMaj = 0;                   /* CloneMaj status */
 
130
int Kd = -1;                            /* /dev/kmem file descriptor */
 
131
KA_T Kpa;                               /* kernel proc structure address */
 
132
 
 
133
#if     HPUXV>=1010
 
134
KA_T Ktp;                               /* kernel thread pointer from proc
 
135
                                         * struct */
 
136
#endif  /* HPUXV>=1010 */
 
137
 
 
138
struct l_vfs *Lvfs = NULL;              /* local vfs structure table */
 
139
 
 
140
#if     HPUXV<800
 
141
int Mem = -1;                   /* /dev/mem file descriptor */
 
142
#endif  /* HPUXV<800 */
 
143
 
 
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) */
 
148
 
 
149
#if     defined(HASFSTRUCT)
 
150
/*
 
151
 * Pff_tab[] - table for printing file flags
 
152
 */
 
153
 
 
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       },
 
163
 
 
164
# if    defined(FSYNC)
 
165
        { (long)FSYNC,          FF_SYNC         },
 
166
# else  /* !defined(FSYNC) */
 
167
#  if   defined(O_SYNC)
 
168
        { (long)O_SYNC,         FF_SYNC         },
 
169
#  endif        /* defined(O_SYNC) */
 
170
# endif /* defined(FSYNC) */
 
171
 
 
172
# if    defined(FCOPYAVOID)
 
173
        { (long)FCOPYAVOID,     FF_COPYAVOID    },
 
174
# endif /* defined(FCOPYAVOID) */
 
175
 
 
176
# if    defined(FPOSIX_AIO)
 
177
        { (long)FPOSIX_AIO,     FF_POSIX_AIO    },
 
178
# endif /* defined(FPOSIX_AIO) */
 
179
 
 
180
# if    defined(FLARGEFILE)
 
181
        { (long)FLARGEFILE,     FF_LARGEFILE    },
 
182
# else  /* !defined(FLARGEFILE) */
 
183
#  if   HPUXV>=1100
 
184
        { (long)0x800,          FF_LARGEFILE    },
 
185
#  endif        /* HPUXV>=1100 */
 
186
# endif /* defined(FLARGEFILE) */
 
187
 
 
188
        { (long)0x100,          FF_KERNEL       },
 
189
        { (long)0,              NULL            }
 
190
};
 
191
 
 
192
 
 
193
/*
 
194
 * Pof_tab[] - table for print process open file flags
 
195
 */
 
196
 
 
197
# if    HPUXV>=1020
 
198
#define UF_EXCLOSE      0x1
 
199
#define UF_MAPPED       0x2
 
200
#define UF_FDLOCK       0x4
 
201
#define UF_INUSE        0x8
 
202
# endif /* HPUXV>=1020 */
 
203
 
 
204
struct pff_tab Pof_tab[] = {
 
205
 
 
206
# if    defined(UF_EXCLOSE)
 
207
        { (long)UF_EXCLOSE,             POF_CLOEXEC     },
 
208
# endif /* defined(UF_EXCLOSE) */
 
209
 
 
210
# if    defined(UF_MAPPED)
 
211
        { (long)UF_MAPPED,              POF_MAPPED      },
 
212
# endif /* defined(UF_MAPPED) */
 
213
 
 
214
# if    defined(UF_FDLOCK)
 
215
        { (long)UF_FDLOCK,              POF_FDLOCK      },
 
216
# endif /* defined(UF_FDLOCK) */
 
217
 
 
218
# if    defined(UF_INUSE)
 
219
        { (long)UF_INUSE,               POF_INUSE       },
 
220
# endif /* defined(UF_INUSE) */
 
221
 
 
222
        { (long)0,              NULL            }
 
223
};
 
224
#endif  /* defined(HASFSTRUCT) */
 
225
 
 
226
#if     HPUXV<800
 
227
int Swap = -1;                  /* swap device file descriptor */
 
228
#endif  /* HPUXV<800 */
 
229
 
 
230
#if     HPUXV<800 && defined(hp9000s800)
 
231
struct user *ubase;             /* user area base (for uvadd()) */
 
232
#endif  /* HPUXV<800 && defined(hp9000s800) */
 
233
 
 
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) */
 
240
 
 
241
KA_T Vnfops;                    /* vnodefops switch address */