xref: /openbsd-src/usr.bin/fstat/fstat.h (revision ce7279d89b71439c96c854f612f4ac93a461fdc4)
1666d0576Smillert /*
2*bf198cc6Smillert  * Copyright (c) 2009 Todd C. Miller <millert@openbsd.org>
3666d0576Smillert  *
4666d0576Smillert  * Permission to use, copy, modify, and distribute this software for any
5666d0576Smillert  * purpose with or without fee is hereby granted, provided that the above
6666d0576Smillert  * copyright notice and this permission notice appear in all copies.
7666d0576Smillert  *
8666d0576Smillert  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9666d0576Smillert  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10666d0576Smillert  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11666d0576Smillert  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12666d0576Smillert  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13666d0576Smillert  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14666d0576Smillert  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15666d0576Smillert  */
16666d0576Smillert 
17666d0576Smillert struct fuser {
18666d0576Smillert 	TAILQ_ENTRY(fuser) tq;
19666d0576Smillert 	uid_t uid;
20666d0576Smillert 	pid_t pid;
21666d0576Smillert 	int flags;
22666d0576Smillert #define F_ROOT 0x01	/* is procs root directory */
23666d0576Smillert #define F_CWD  0x02	/* is procs cwd */
24666d0576Smillert #define F_OPEN 0x04	/* just has it open */
2564f4df25Smillert #define F_TEXT 0x08	/* is procs executable text */
26666d0576Smillert };
27666d0576Smillert 
28666d0576Smillert struct filearg {
29666d0576Smillert 	SLIST_ENTRY(filearg) next;
30666d0576Smillert 	dev_t dev;
31666d0576Smillert 	ino_t ino;
32666d0576Smillert 	char *name;
33666d0576Smillert 	TAILQ_HEAD(fuserhead, fuser) fusers;
34666d0576Smillert };
35666d0576Smillert 
36666d0576Smillert SLIST_HEAD(fileargs, filearg);
37666d0576Smillert 
38666d0576Smillert extern int uflg;
39666d0576Smillert extern int cflg;
40666d0576Smillert extern int fsflg;
41666d0576Smillert extern int sflg;
42666d0576Smillert extern int signo;
43666d0576Smillert extern struct fileargs fileargs;
44666d0576Smillert 
45666d0576Smillert extern char *__progname;
46666d0576Smillert 
47cef0bbe1Sguenther void fuser_check(struct kinfo_file *);
48666d0576Smillert void fuser_run(void);
49666d0576Smillert void usage(void);
50