[RFC] fcntl: add description to fdinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux