summaryrefslogtreecommitdiff
path: root/dialects/linux/dstore.c
blob: 80e28265678b6a2781663fb021e4101d1048d653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * dstore.c - Linux global storage for /proc-based lsof
 */


/*
 * Copyright 1997 Purdue Research Foundation, West Lafayette, Indiana
 * 47907.  All rights reserved.
 *
 * Written by Victor A. Abell
 *
 * This software is not subject to any license of the American Telephone
 * and Telegraph Company or the Regents of the University of California.
 *
 * Permission is granted to anyone to use this software for any purpose on
 * any computer system, and to alter it and redistribute it freely, subject
 * to the following restrictions:
 *
 * 1. Neither the authors nor Purdue University are responsible for any
 *    consequences of the use of this software.
 *
 * 2. The origin of this software must not be misrepresented, either by
 *    explicit claim or by omission.  Credit to the authors and Purdue
 *    University must appear in documentation and sources.
 *
 * 3. Altered versions must be plainly marked as such, and must not be
 *    misrepresented as being the original software.
 *
 * 4. This notice may not be removed or altered.
 */

#ifndef lint
static char copyright[] =
"@(#) Copyright 1997 Purdue Research Foundation.\nAll rights reserved.\n";
static char *rcsid = "$Id: dstore.c,v 1.4 2011/09/07 19:07:45 abe Exp $";
#endif


#include "lsof.h"

int HasNFS = 0;				/* NFS mount point status:
					 *     1 == there is an NFS mount point,
					 *          but its device number is
					 *          unknown
					 *     2 == there is an NFS mount point
					 *          and its device number is
					 *          known
					 */
int OffType = 0;			/* offset type:
					 *     0 == unknown
					 *     1 == lstat's st_size
					 *     2 == from /proc/<PID>/fdinfo */

/*
 * Pff_tab[] - table for printing file flags
 */

struct pff_tab Pff_tab[] = {
	{ (long)O_WRONLY,	FF_WRITE	},
	{ (long)O_RDWR,		FF_RDWR		},
	{ (long)O_CREAT,	FF_CREAT	},
	{ (long)O_EXCL,		FF_EXCL		},
	{ (long)O_NOCTTY,	FF_NOCTTY	},
	{ (long)O_TRUNC,	FF_TRUNC	},
	{ (long)O_APPEND,	FF_APPEND	},
	{ (long)O_NDELAY,	FF_NDELAY	},
	{ (long)O_SYNC,		FF_SYNC		},
	{ (long)O_ASYNC,	FF_ASYNC	},

#if	defined(O_DIRECT)
	{ (long)O_DIRECT,	FF_DIRECT	},
#endif	/* defined(O_DIRECT) */

#if	defined(O_DIRECTORY)
	{ (long)O_DIRECTORY,	FF_DIRECTORY	},
#endif	/* defined(O_DIRECTORY) */

#if	defined(O_NOFOLLOW)
	{ (long)O_NOFOLLOW,	FF_NOFOLNK	},
#endif	/* defined(O_NOFOLLOW) */

#if	defined(O_NOATIME)
	{ (long)O_NOATIME,	FF_NOATM	},
#endif	/* defined(O_NOATIME) */

#if	defined(O_DSYNC)
	{ (long)O_DSYNC,	FF_DSYNC	},
#endif	/* defined(O_DSYNC) */

#if	defined(O_RSYNC)
	{ (long)O_RSYNC,	FF_RSYNC	},
#endif	/* defined(O_RSYNC) */

#if	defined(O_LARGEFILE)
# if	O_LARGEFILE==0
	{ (long)0100000,	FF_LARGEFILE	},
# else	/* O_LARGEFILE!=0 */
	{ (long)O_LARGEFILE,	FF_LARGEFILE	},
# endif	/* O_LARGEFILE==0 */
#else	/* !defined(O_LARGEFILE) */
	{ (long)0100000,	FF_LARGEFILE	},
#endif	/* defined(O_LARGEFILE) */

	{ (long)0,		NULL		}
};


/*
 * Pof_tab[] - table for print process open file flags
 */

struct pff_tab Pof_tab[] = {
	{ (long)0,		NULL		}
};