From: binary cat <dogedoge61@gmail.com>
To: 9front@9front.org
Subject: [9front] /proc/n/fd format clarification
Date: Sat, 5 Jun 2021 09:26:16 -0400 [thread overview]
Message-ID: <CAHtSCHJi2LtJBcos6JjeEpSSypspnPABazS10wHH_nQgDirFVw@mail.gmail.com> (raw)
proc(3) lists 8 entries for each line:
>The read-only file lists the open file descriptors of the process. The first line of the file is its current directory;
>subsequent lines list, one per line, the open files, giving the decimal file descriptor number [1]; whether the file is open for
>read (r) write (w), or both (rw) [2]; the type [3], device number [4], and qid [5] of the file; its I/O unit [6] (the amount of data that may be
>transferred on the file as a contiguous piece; see iounit(2)), its I/O offset [7]; and its name at the time it was opened [8].
But this still leaves me with some questions when I look at this:
0 r M 68 (0000000000000001 0 00) 8192 166 /dev/cons
It seems that the qid is split into 3 parts. What are those parts?
I found this in intro(5):
Replies (R-messages) to auth, attach, walk, open, and create
requests convey a qid field back to the client. The qid
represents the server's unique identification for the file
being accessed: two files on the same server hierarchy are
the same if and only if their qids are the same. (The
client may have multiple fids pointing to a single file on a
server and hence having a single qid.) The thirteen-byte
qid fields hold a one-byte type, specifying whether the file
is a directory, append-only file, etc., and two unsigned
integers: first the four-byte qid version, then the eight-
byte qid path. The path is an integer unique among all
files in the hierarchy. If a file is deleted and recreated
with the same name in the same directory, the old and new
path components of the qids should be different. The ver-
sion is a version number for a file; typically, it is incre-
mented every time the file is modified.
So this mentions 3 things, a path, a version, and a type. This
checks out, until you look at the supposed lengths. The path is
supposed to be 8 bytes, which would be 16 hex digits, that's ok,
but it says 4 bytes for the version, which would be 8 hex digits,
and we don't see anything like that here. What's going on here?
-- binarycat
next reply other threads:[~2021-06-05 14:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-05 13:26 binary cat [this message]
2021-06-05 21:04 ` [9front] " Anthony Martin
2021-06-05 21:58 ` [9front] " nicolagi
2021-06-07 17:16 ` binary cat
2021-06-07 23:37 ` ori
2021-06-07 23:46 ` Anthony Martin
2021-06-09 21:24 ` binary cat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHtSCHJi2LtJBcos6JjeEpSSypspnPABazS10wHH_nQgDirFVw@mail.gmail.com \
--to=dogedoge61@gmail.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).