CONTRIBUTING.d/patches: Please provide a git-range-diff(1)
[man-pages.git] / man5 / proc_pid_fdinfo.5
blob1e23bbe02d75ad74b898ee668168c41d99cdc491
1 .\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
2 .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
4 .\"
5 .\" SPDX-License-Identifier: GPL-3.0-or-later
6 .\"
7 .TH proc_pid_fdinfo 5 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 /proc/pid/fdinfo/ \- information about file descriptors
10 .SH DESCRIPTION
11 .TP
12 .IR /proc/ pid /fdinfo/ " (since Linux 2.6.22)"
13 This is a subdirectory containing one entry for each file which the
14 process has open, named by its file descriptor.
15 The files in this directory are readable only by the owner of the process.
16 The contents of each file can be read to obtain information
17 about the corresponding file descriptor.
18 The content depends on the type of file referred to by the
19 corresponding file descriptor.
20 .IP
21 For regular files and directories, we see something like:
22 .IP
23 .in +4n
24 .EX
25 .RB "$" " cat /proc/12015/fdinfo/4"
26 pos:    1000
27 flags:  01002002
28 mnt_id: 21
29 .EE
30 .in
31 .IP
32 The fields are as follows:
33 .RS
34 .TP
35 .I pos
36 This is a decimal number showing the file offset.
37 .TP
38 .I flags
39 This is an octal number that displays the
40 file access mode and file status flags (see
41 .BR open (2)).
42 If the close-on-exec file descriptor flag is set, then
43 .I flags
44 will also include the value
45 .BR O_CLOEXEC .
46 .IP
47 Before Linux 3.1,
48 .\" commit 1117f72ea0217ba0cc19f05adbbd8b9a397f5ab7
49 this field incorrectly displayed the setting of
50 .B O_CLOEXEC
51 at the time the file was opened,
52 rather than the current setting of the close-on-exec flag.
53 .TP
55 .I mnt_id
56 This field, present since Linux 3.15,
57 .\" commit 49d063cb353265c3af701bab215ac438ca7df36d
58 is the ID of the mount containing this file.
59 See the description of
60 .IR /proc/ pid /mountinfo .
61 .RE
62 .IP
63 For eventfd file descriptors (see
64 .BR eventfd (2)),
65 we see (since Linux 3.8)
66 .\" commit cbac5542d48127b546a23d816380a7926eee1c25
67 the following fields:
68 .IP
69 .in +4n
70 .EX
71 pos:    0
72 flags:  02
73 mnt_id: 10
74 eventfd\-count:               40
75 .EE
76 .in
77 .IP
78 .I eventfd\-count
79 is the current value of the eventfd counter, in hexadecimal.
80 .IP
81 For epoll file descriptors (see
82 .BR epoll (7)),
83 we see (since Linux 3.8)
84 .\" commit 138d22b58696c506799f8de759804083ff9effae
85 the following fields:
86 .IP
87 .in +4n
88 .EX
89 pos:    0
90 flags:  02
91 mnt_id: 10
92 tfd:        9 events:       19 data: 74253d2500000009
93 tfd:        7 events:       19 data: 74253d2500000007
94 .EE
95 .in
96 .IP
97 Each of the lines beginning
98 .I tfd
99 describes one of the file descriptors being monitored via
100 the epoll file descriptor (see
101 .BR epoll_ctl (2)
102 for some details).
104 .I tfd
105 field is the number of the file descriptor.
107 .I events
108 field is a hexadecimal mask of the events being monitored for this file
109 descriptor.
111 .I data
112 field is the data value associated with this file descriptor.
114 For signalfd file descriptors (see
115 .BR signalfd (2)),
116 we see (since Linux 3.8)
117 .\" commit 138d22b58696c506799f8de759804083ff9effae
118 the following fields:
120 .in +4n
122 pos:    0
123 flags:  02
124 mnt_id: 10
125 sigmask:        0000000000000006
129 .I sigmask
130 is the hexadecimal mask of signals that are accepted via this
131 signalfd file descriptor.
132 (In this example, bits 2 and 3 are set, corresponding to the signals
133 .B SIGINT
135 .BR SIGQUIT ;
137 .BR signal (7).)
139 For inotify file descriptors (see
140 .BR inotify (7)),
141 we see (since Linux 3.8)
142 the following fields:
144 .in +4n
146 pos:    0
147 flags:  00
148 mnt_id: 11
149 inotify wd:2 ino:7ef82a sdev:800001 mask:800afff ignored_mask:0 fhandle\-bytes:8 fhandle\-type:1 f_handle:2af87e00220ffd73
150 inotify wd:1 ino:192627 sdev:800001 mask:800afff ignored_mask:0 fhandle\-bytes:8 fhandle\-type:1 f_handle:27261900802dfd73
154 Each of the lines beginning with "inotify" displays information about
155 one file or directory that is being monitored.
156 The fields in this line are as follows:
159 .I wd
160 A watch descriptor number (in decimal).
162 .I ino
163 The inode number of the target file (in hexadecimal).
165 .I sdev
166 The ID of the device where the target file resides (in hexadecimal).
168 .I mask
169 The mask of events being monitored for the target file (in hexadecimal).
172 If the kernel was built with exportfs support, the path to the target
173 file is exposed as a file handle, via three hexadecimal fields:
174 .IR fhandle\-bytes ,
175 .IR fhandle\-type ,
177 .IR f_handle .
179 For fanotify file descriptors (see
180 .BR fanotify (7)),
181 we see (since Linux 3.8)
182 the following fields:
184 .in +4n
186 pos:    0
187 flags:  02
188 mnt_id: 11
189 fanotify flags:0 event\-flags:88002
190 fanotify ino:19264f sdev:800001 mflags:0 mask:1 ignored_mask:0 fhandle\-bytes:8 fhandle\-type:1 f_handle:4f261900a82dfd73
194 The fourth line displays information defined when the fanotify group
195 was created via
196 .BR fanotify_init (2):
199 .I flags
201 .I flags
202 argument given to
203 .BR fanotify_init (2)
204 (expressed in hexadecimal).
206 .I event\-flags
208 .I event_f_flags
209 argument given to
210 .BR fanotify_init (2)
211 (expressed in hexadecimal).
214 Each additional line shown in the file contains information
215 about one of the marks in the fanotify group.
216 Most of these fields are as for inotify, except:
219 .I mflags
220 The flags associated with the mark
221 (expressed in hexadecimal).
223 .I mask
224 The events mask for this mark
225 (expressed in hexadecimal).
227 .I ignored_mask
228 The mask of events that are ignored for this mark
229 (expressed in hexadecimal).
232 For details on these fields, see
233 .BR fanotify_mark (2).
235 For timerfd file descriptors (see
236 .BR timerfd (2)),
237 we see (since Linux 3.17)
238 .\" commit af9c4957cf212ad9cf0bee34c95cb11de5426e85
239 the following fields:
241 .in +4n
243 pos:    0
244 flags:  02004002
245 mnt_id: 13
246 clockid: 0
247 ticks: 0
248 settime flags: 03
249 it_value: (7695568592, 640020877)
250 it_interval: (0, 0)
255 .I clockid
256 This is the numeric value of the clock ID
257 (corresponding to one of the
258 .B CLOCK_*
259 constants defined via
260 .IR <time.h> )
261 that is used to mark the progress of the timer (in this example, 0 is
262 .BR CLOCK_REALTIME ).
264 .I ticks
265 This is the number of timer expirations that have occurred,
266 (i.e., the value that
267 .BR read (2)
268 on it would return).
270 .I settime flags
271 This field lists the flags with which the timerfd was last armed (see
272 .BR timerfd_settime (2)),
273 in octal
274 (in this example, both
275 .B TFD_TIMER_ABSTIME
277 .B TFD_TIMER_CANCEL_ON_SET
278 are set).
280 .I it_value
281 This field contains the amount of time until the timer will next expire,
282 expressed in seconds and nanoseconds.
283 This is always expressed as a relative value,
284 regardless of whether the timer was created using the
285 .B TFD_TIMER_ABSTIME
286 flag.
288 .I it_interval
289 This field contains the interval of the timer,
290 in seconds and nanoseconds.
291 (The
292 .I it_value
294 .I it_interval
295 fields contain the values that
296 .BR timerfd_gettime (2)
297 on this file descriptor would return.)
299 .SH SEE ALSO
300 .BR proc (5)