summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man5/proc_pid_fdinfo.5
blob: 3703012bcfb54e8a32dd3b62bda985652adb4860 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
.\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
.\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
.\"
.\" SPDX-License-Identifier: GPL-3.0-or-later
.\"
.TH proc_pid_fdinfo 5 2023-08-15 "Linux man-pages 6.06"
.SH NAME
/proc/pid/fdinfo/ \- information about file descriptors
.SH DESCRIPTION
.TP
.IR /proc/ pid /fdinfo/ " (since Linux 2.6.22)"
This is a subdirectory containing one entry for each file which the
process has open, named by its file descriptor.
The files in this directory are readable only by the owner of the process.
The contents of each file can be read to obtain information
about the corresponding file descriptor.
The content depends on the type of file referred to by the
corresponding file descriptor.
.IP
For regular files and directories, we see something like:
.IP
.in +4n
.EX
.RB "$" " cat /proc/12015/fdinfo/4"
pos:    1000
flags:  01002002
mnt_id: 21
.EE
.in
.IP
The fields are as follows:
.RS
.TP
.I pos
This is a decimal number showing the file offset.
.TP
.I flags
This is an octal number that displays the
file access mode and file status flags (see
.BR open (2)).
If the close-on-exec file descriptor flag is set, then
.I flags
will also include the value
.BR O_CLOEXEC .
.IP
Before Linux 3.1,
.\" commit 1117f72ea0217ba0cc19f05adbbd8b9a397f5ab7
this field incorrectly displayed the setting of
.B O_CLOEXEC
at the time the file was opened,
rather than the current setting of the close-on-exec flag.
.TP
.I
.I mnt_id
This field, present since Linux 3.15,
.\" commit 49d063cb353265c3af701bab215ac438ca7df36d
is the ID of the mount containing this file.
See the description of
.IR /proc/ pid /mountinfo .
.RE
.IP
For eventfd file descriptors (see
.BR eventfd (2)),
we see (since Linux 3.8)
.\" commit cbac5542d48127b546a23d816380a7926eee1c25
the following fields:
.IP
.in +4n
.EX
pos:	0
flags:	02
mnt_id:	10
eventfd\-count:               40
.EE
.in
.IP
.I eventfd\-count
is the current value of the eventfd counter, in hexadecimal.
.IP
For epoll file descriptors (see
.BR epoll (7)),
we see (since Linux 3.8)
.\" commit 138d22b58696c506799f8de759804083ff9effae
the following fields:
.IP
.in +4n
.EX
pos:	0
flags:	02
mnt_id:	10
tfd:        9 events:       19 data: 74253d2500000009
tfd:        7 events:       19 data: 74253d2500000007
.EE
.in
.IP
Each of the lines beginning
.I tfd
describes one of the file descriptors being monitored via
the epoll file descriptor (see
.BR epoll_ctl (2)
for some details).
The
.I tfd
field is the number of the file descriptor.
The
.I events
field is a hexadecimal mask of the events being monitored for this file
descriptor.
The
.I data
field is the data value associated with this file descriptor.
.IP
For signalfd file descriptors (see
.BR signalfd (2)),
we see (since Linux 3.8)
.\" commit 138d22b58696c506799f8de759804083ff9effae
the following fields:
.IP
.in +4n
.EX
pos:	0
flags:	02
mnt_id:	10
sigmask:	0000000000000006
.EE
.in
.IP
.I sigmask
is the hexadecimal mask of signals that are accepted via this
signalfd file descriptor.
(In this example, bits 2 and 3 are set, corresponding to the signals
.B SIGINT
and
.BR SIGQUIT ;
see
.BR signal (7).)
.IP
For inotify file descriptors (see
.BR inotify (7)),
we see (since Linux 3.8)
the following fields:
.IP
.in +4n
.EX
pos:	0
flags:	00
mnt_id:	11
inotify wd:2 ino:7ef82a sdev:800001 mask:800afff ignored_mask:0 fhandle\-bytes:8 fhandle\-type:1 f_handle:2af87e00220ffd73
inotify wd:1 ino:192627 sdev:800001 mask:800afff ignored_mask:0 fhandle\-bytes:8 fhandle\-type:1 f_handle:27261900802dfd73
.EE
.in
.IP
Each of the lines beginning with "inotify" displays information about
one file or directory that is being monitored.
The fields in this line are as follows:
.RS
.TP
.I wd
A watch descriptor number (in decimal).
.TP
.I ino
The inode number of the target file (in hexadecimal).
.TP
.I sdev
The ID of the device where the target file resides (in hexadecimal).
.TP
.I mask
The mask of events being monitored for the target file (in hexadecimal).
.RE
.IP
If the kernel was built with exportfs support, the path to the target
file is exposed as a file handle, via three hexadecimal fields:
.IR fhandle\-bytes ,
.IR fhandle\-type ,
and
.IR f_handle .
.IP
For fanotify file descriptors (see
.BR fanotify (7)),
we see (since Linux 3.8)
the following fields:
.IP
.in +4n
.EX
pos:	0
flags:	02
mnt_id:	11
fanotify flags:0 event\-flags:88002
fanotify ino:19264f sdev:800001 mflags:0 mask:1 ignored_mask:0 fhandle\-bytes:8 fhandle\-type:1 f_handle:4f261900a82dfd73
.EE
.in
.IP
The fourth line displays information defined when the fanotify group
was created via
.BR fanotify_init (2):
.RS
.TP
.I flags
The
.I flags
argument given to
.BR fanotify_init (2)
(expressed in hexadecimal).
.TP
.I event\-flags
The
.I event_f_flags
argument given to
.BR fanotify_init (2)
(expressed in hexadecimal).
.RE
.IP
Each additional line shown in the file contains information
about one of the marks in the fanotify group.
Most of these fields are as for inotify, except:
.RS
.TP
.I mflags
The flags associated with the mark
(expressed in hexadecimal).
.TP
.I mask
The events mask for this mark
(expressed in hexadecimal).
.TP
.I ignored_mask
The mask of events that are ignored for this mark
(expressed in hexadecimal).
.RE
.IP
For details on these fields, see
.BR fanotify_mark (2).
.IP
For timerfd file descriptors (see
.BR timerfd (2)),
we see (since Linux 3.17)
.\" commit af9c4957cf212ad9cf0bee34c95cb11de5426e85
the following fields:
.IP
.in +4n
.EX
pos:    0
flags:  02004002
mnt_id: 13
clockid: 0
ticks: 0
settime flags: 03
it_value: (7695568592, 640020877)
it_interval: (0, 0)
.EE
.in
.RS
.TP
.I clockid
This is the numeric value of the clock ID
(corresponding to one of the
.B CLOCK_*
constants defined via
.IR <time.h> )
that is used to mark the progress of the timer (in this example, 0 is
.BR CLOCK_REALTIME ).
.TP
.I ticks
This is the number of timer expirations that have occurred,
(i.e., the value that
.BR read (2)
on it would return).
.TP
.I settime flags
This field lists the flags with which the timerfd was last armed (see
.BR timerfd_settime (2)),
in octal
(in this example, both
.B TFD_TIMER_ABSTIME
and
.B TFD_TIMER_CANCEL_ON_SET
are set).
.TP
.I it_value
This field contains the amount of time until the timer will next expire,
expressed in seconds and nanoseconds.
This is always expressed as a relative value,
regardless of whether the timer was created using the
.B TFD_TIMER_ABSTIME
flag.
.TP
.I it_interval
This field contains the interval of the timer,
in seconds and nanoseconds.
(The
.I it_value
and
.I it_interval
fields contain the values that
.BR timerfd_gettime (2)
on this file descriptor would return.)
.RE
.SH SEE ALSO
.BR proc (5)