1 
2 /* Option Flags */
3 typedef unsigned short opt_type;
4 
5 #define OPT_VERBOSE 1
6 #define OPT_ALLFILES 2
7 #define OPT_MOUNTS 4
8 #define OPT_KILL 8
9 #define OPT_INTERACTIVE 16
10 #define OPT_SILENT 32
11 #define OPT_USER 64
12 #define OPT_ISMOUNTPOINT 128
13 #define OPT_WRITE 256
14 
15 struct procs {
16 	pid_t pid;
17 	uid_t uid;
18 	char access;
19 	char proc_type;
20 	char *username;
21 	char *command;
22 	struct procs *next;
23 };
24 
25 /* For the access field above */
26 #define ACCESS_CWD 1
27 #define ACCESS_EXE 2
28 #define ACCESS_FILE 4
29 #define ACCESS_ROOT 8
30 #define ACCESS_MMAP 16
31 #define ACCESS_FILEWR 32
32 
33 /* For the proc_type field above */
34 #define PTYPE_NORMAL 0
35 #define PTYPE_MOUNT 1
36 #define PTYPE_KNFSD 2
37 #define PTYPE_SWAP 3
38 
39 struct names {
40 	char *filename;
41 	unsigned char name_space;
42     struct stat st;
43 	struct procs *matched_procs;
44 	struct names *next;
45 };
46 
47 struct ip_connections {
48 	struct names *name;
49 	unsigned long lcl_port;
50 	unsigned long rmt_port;
51 	struct in_addr rmt_address;
52 	struct ip_connections *next;
53 };
54 
55 struct ip6_connections {
56 	struct names *name;
57 	unsigned long lcl_port;
58 	unsigned long rmt_port;
59 	struct in6_addr rmt_address;
60 	struct ip6_connections *next;
61 };
62 
63 struct inode_list {
64 	struct names *name;
65 	dev_t	device;
66 	ino_t	inode;
67 	struct inode_list *next;
68 };
69 
70 struct device_list {
71 	struct names *name;
72 	dev_t	device;
73 	struct device_list *next;
74 };
75 
76 struct unixsocket_list {
77 	char *sun_name;
78 	ino_t	inode;
79 	ino_t	net_inode;
80 	dev_t	dev;
81 	struct unixsocket_list *next;
82 };
83 
84 struct mount_list {
85 	char *mountpoint;
86 	struct mount_list *next;
87 };
88 
89 #if defined (__GNUC__) && defined(__OPTIMIZE__)
90 # include "lists.h"
91 typedef struct mntinfo_s {
92     list_t   this;
93     int id, parid;
94     dev_t     dev;
95     size_t   nlen;
96     char  *mpoint;
97 } mntinfo_t;
98 #endif
99 
100 #define NAMESPACE_FILE 0
101 #define NAMESPACE_TCP 1
102 #define NAMESPACE_UDP 2
103 
104 #define MAX_PATHNAME 200
105 #define MAX_CMDNAME 16
106 
107 #define KNFSD_EXPORTS "/proc/fs/nfs/exports"
108 #define PROC_MOUNTS "/proc/mounts"
109 #define PROC_SWAPS "/proc/swaps"
110