archive mirror
 help / color / mirror / Atom feed
From: Pascal Bouchareine <>
Subject: [RFC] fcntl: add description to fdinfo
Date: Tue, 21 Jul 2020 18:27:41 -0700	[thread overview]
Message-ID: <> (raw)


I am proposing to add a fcntl() command that would allow processes to
"self document" file descriptors - making this description available
through /proc/pid/fdinfo/fd, for netstat, lsof and friends to report.

I don't have experience proposing interface changes. I thought I'd
give more context here first, asking if that makes sense, and if
obvious traps, previous discussions or alternative solutions come to

The technical implementation I have adds an fcntl command
(F_SET_DESCRIPTION), a description member to struct file, and modifies
show_fdinfo() for the generic proc fd class to eventually report it.

If that sounds reasonable I'll happily follow up with a patch (and a
shorter description)


More context and motivation below:

For monitoring and debugging purposes, and during troubleshooting
sessions, it is often needed to quickly identify the role of an
established socket for a given process, or more globally for a group
of significant sockets, such as all AF_INET/INET6 sockets.

The available tools today let us try to infer this information from
the available (proto, host, port) tuples - but frequently these days
it boils down to HTTPs on generic load balancing or CDN endpoints,
providing little information about what is served behind a socket.

A way to improve that would be to allow processes to self-document
their dependencies, and attach additional information to their
sockets, in the form of a label or description string, somehow in the
same way setproctitle/prctl can be used to give hints about spawned
subprocesses roles.

Example usage/contexts that come to mind:

- netstat, ss, lsof having more details for users
- modern browsers often having lots of open tabs, and service worker
related connections, and a system user trying to identify the source
of some network activity at the time it is observed - reading website
names instead of CDN endpoints
- looking at some remote connections in a distributed system and
knowing the role of a couple stuck Send-Q sockets right away
- remember the intent for a connection (say, the target host of an
HTTP request, a database name, a data channel, ..) before information
is lost during resolution to a destination host, and attach this
information to the socket

                 reply	other threads:[~2020-07-22  1:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \
    --subject='Re: [RFC] fcntl: add description to fdinfo' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).