[Bug 298134] usr.sbin/syslogd: add ability to write to unix domain sockets

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 04 Sep 2026 15:17:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298134

--- Comment #2 from Mikhail Teterin <mi@FreeBSD.org> ---
Created attachment 274413
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=274413&action=edit
One does not simply open(2) a socket

(In reply to Mark Johnston from comment #1)
> why can't the user just configure a unix socket as a log destination without specifying it as a unix socket?

Because, unfortunately, you can't just open(2) a socket. You have to create it
-- the file-descriptor -- first (with socket(2)) and then connect(2) it :(

We could detect it being a socket and act differently, but, if it is not there,
when syslogd starts, syslogd will just create a regular file...

> Why does casper return a dirfd to the sandboxed process instead of just returning a connected socket?

This allow fors future (re)connections, should the listening downstream process
not be up, when we're starting, or disappear part way through.

The directory has to exist, when we start, but the socket in it does not.

> I think F_SOCK should be F_UNIXSOCK or similar

Yes, and I actually first used exactly that name, but -- being longer than 8 --
it broke indentation. Maybe, F_UNIX?

> The change to make TypeNames use designated array initializers should be its own patch.

And have this PR depend on that one? Ok...

> BTW, for reviews it is easier to use phabricator.

Oh, I can't commit anything myself -- so this is not merely a code-review
request :) But I'll investigate the phrabricator -- haven't heard of it before,
thanks...

-- 
You are receiving this mail because:
You are the assignee for the bug.