Linux-api Archive on
 help / color / Atom feed
From: Pascal Bouchareine <>
Subject: [RFC] fcntl: add description to fdinfo
Date: Tue, 21 Jul 2020 18:27:41 -0700
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 index

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='' \ \ \

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

Linux-api Archive on

Archives are clonable:
	git clone --mirror linux-api/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-api linux-api/ \
	public-inbox-index linux-api

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone