Date: Sat, 07 Feb 2026 13:27:09 +0100 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Lionel Cons <lionelcons1972@gmail.com>, Freebsd hackers list <freebsd-hackers@freebsd.org> Subject: Re: Implementing O_SYMLINK in FreeBSD? Message-ID: <86wm0oagde.fsf@ltc.des.dev> In-Reply-To: <aYZuY2th1CXXAULX@kib.kiev.ua> (Konstantin Belousov's message of "Sat, 7 Feb 2026 00:42:43 %2B0200") References: <CAPJSo4VDAb5yPh%2BLV9qDgFPUisuTWk1DhB3boGPenrY3GJo2yQ@mail.gmail.com> <aYZuY2th1CXXAULX@kib.kiev.ua>
index | next in thread | previous in thread | raw e-mail
Konstantin Belousov <kostikbel@gmail.com> writes: > Lionel Cons <lionelcons1972@gmail.com> writes: > > Would it be possible to implement O_SYMLINK to open a symlink > > directly in FreeBSD? > What is the semantic, exactly? You get a file descriptor that represents the symbolic link. You cannot read(2) from it or write(2) to it but you can fchflags(2), fchmod(2), fchown(2), f[gs]etxattr(2) (their equivalent of extattr_[gs]et_fd(2)), fstat(2) etc. and there is an freadlink(2). It can make it easier to safely copy symbolic links, or safely extract them from an archive. I would love to see it in FreeBSD. Note that O_SYMLINK is not like O_DIRECTORY; it is not an error to use O_SYMLINK when opening something that is not a symbolic link. It just means “if the name refers to a link, open the link, not the target”. DES -- Dag-Erling Smørgrav - des@FreeBSD.orghome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86wm0oagde.fsf>
