[systemd-devel] [PATCH] man: add instruction on clearing file descriptors

Lennart Poettering lennart at poettering.net
Thu Dec 10 15:19:21 UTC 2020


On Mo, 07.12.20 19:42, Mantas Mikulėnas (grawity at gmail.com) wrote:

> I'm not sure if it's more portable. I recall FreeBSD only exposing 0–2 in
> its /dev/fd by default unless you mounted a separate virtual filesystem
> there. NetBSD seems to always have 64 devnodes no matter how many fds.
>
> I don't think there's a *good* portable method (which is why closerange()
> is being added) and besides that I'm not sure if that is even in scope for
> this systemd-centric manpage...the whole idea is that under systemd, a
> daemon shouldn't need that.

Yes, I fully agree. This is messy and generally not portable. If you
care about portability maybe go the RLIMIT_NOFILE way, which is of
course terrible inefficient, but that's the price you have to pay for
portability I guess.

Anyway, I don't think mentioning /dev/fd/ is generally helpful, it's
misleading at best I think.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list