linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] fcntl: add description to fdinfo
@ 2020-07-22  1:27 Pascal Bouchareine
  0 siblings, 0 replies; only message in thread
From: Pascal Bouchareine @ 2020-07-22  1:27 UTC (permalink / raw)
  To: linux-api

Hi,

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

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)

Thanks!

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-22  1:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  1:27 [RFC] fcntl: add description to fdinfo Pascal Bouchareine

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