[DragonFlyBSD - Submit #3272] (New) fstat: Show offset for device files too.
bugtracker-admin at leaf.dragonflybsd.org
bugtracker-admin at leaf.dragonflybsd.org
Tue May 11 10:42:01 PDT 2021
Issue #3272 has been reported by falsifian.
----------------------------------------
Submit #3272: fstat: Show offset for device files too.
http://bugs.dragonflybsd.org/issues/3272
* Author: falsifian
* Status: New
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
This patch changes fstat to print, e.g, "da0:42" instead of just "da0"
if a process has /dev/da0 open at offset 42.
Tested minimally: I just wrote wrote a program that seeks to offset 42,
then ran fstat on it. Output:
root at copter-dfly:/usr/src/usr.bin/fstat # ./fstat -p6527
USER CMD PID FD PATH INUM MODE SZ|DV R/W
root f 6527 root / 1 drwxr-xr-x 0 r
root f 6527 wd /home/falsifian/tmp 23445 drwx------ 0 r
root f 6527 text /home/falsifian/tmp/f 301743 -rwxr-xr-x 0 r
root f 6527 0 /dev/pts/3 1402 crw------- pts/3:13384 rw
root f 6527 1 /dev/pts/3 1402 crw------- pts/3:13384 rw
root f 6527 2 /dev/pts/3 1402 crw------- pts/3:13384 rw
root f 6527 3 /dev/da0 1361 crw-r----- da0:42 r
(I wanted this when I first installed DragonflyBSD yesterday. I was
trying to figure out why newfs_hammer2 was stuck, and this might have
helped me narrow down the possibilities by checking whether the offset
was changing very slowly vs. not at all.)
Some notes / questions:
- fst.offset generally seems to come from the f_offset field of a
struct file. I am not familiar with that struct. It would be good if
someone who knows more could confirm my assumption that f_offset is
at least never going to be uninitialized garbage.
- For regular files, it looks like the size is no longer printed at all
since commit afdbde1b changed it to offset. Was that intentional? At
least the man page should be updated. (I'm happy to give that a try.)
- Should the indentation fix have been a separate commit? (For future
reference, at least.) I'm normally pretty pedantic about separating
commits, but didn't want to annoy anyone.
---Files--------------------------------
0001-Print-file-offset-for-device-files-too.patch (973 Bytes)
--
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
More information about the Submit
mailing list