git: 039ec3ca1bec - main - devd: define _PATH_DEVD_SOCKET in <paths.h>

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 13 Nov 2026 02:37:59 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=039ec3ca1becc794c21e31ea6d5acef3fe053544

commit 039ec3ca1becc794c21e31ea6d5acef3fe053544
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-11-13 02:37:10 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-11-13 02:37:10 +0000

    devd: define _PATH_DEVD_SOCKET in <paths.h>
    
    Sweep through consumers and use the define.
    
    Reviewed by:            kfv, imp
    Differential Revision:  https://reviews.freebsd.org/D61344
---
 include/paths.h                 | 1 +
 lib/libdevdctl/consumer.cc      | 3 ++-
 lib/libusb/libusb10_hotplug.c   | 4 ++--
 sbin/devd/devd.cc               | 3 +--
 sbin/devd/tests/client_test.c   | 3 ++-
 usr.sbin/moused/moused/moused.c | 3 ++-
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/paths.h b/include/paths.h
index 9157c17524c7..eadc20a933d7 100644
--- a/include/paths.h
+++ b/include/paths.h
@@ -52,6 +52,7 @@
 #define	_PATH_CSHELL	"/bin/csh"
 #define	_PATH_CSMAPPER	"/usr/share/i18n/csmapper"
 #define	_PATH_DEFTAPE	"/dev/sa0"
+#define	_PATH_DEVD_SOCKET	"/var/run/devd.seqpacket.pipe"
 #define	_PATH_DEVGPIOC	"/dev/gpioc"
 #define	_PATH_DEVNULL	"/dev/null"
 #define	_PATH_DEVPOWER	"/dev/power"
diff --git a/lib/libdevdctl/consumer.cc b/lib/libdevdctl/consumer.cc
index 2d5e7ebf549b..b020fc402067 100644
--- a/lib/libdevdctl/consumer.cc
+++ b/lib/libdevdctl/consumer.cc
@@ -42,6 +42,7 @@
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <paths.h>
 #include <syslog.h>
 #include <unistd.h>
 
@@ -68,7 +69,7 @@ namespace DevdCtl
 /*============================= Class Definitions ============================*/
 /*----------------------------- DevdCtl::Consumer ----------------------------*/
 //- Consumer Static Private Data -----------------------------------------------
-const char Consumer::s_devdSockPath[] = "/var/run/devd.seqpacket.pipe";
+const char Consumer::s_devdSockPath[] = _PATH_DEVD_SOCKET;
 
 //- Consumer Public Methods ----------------------------------------------------
 Consumer::Consumer(Event::BuildMethod *defBuilder,
diff --git a/lib/libusb/libusb10_hotplug.c b/lib/libusb/libusb10_hotplug.c
index f03c1b48b8dc..db1b3fed84e3 100644
--- a/lib/libusb/libusb10_hotplug.c
+++ b/lib/libusb/libusb10_hotplug.c
@@ -29,6 +29,7 @@
 #else
 #include <assert.h>
 #include <errno.h>
+#include <paths.h>
 #include <poll.h>
 #include <pthread.h>
 #include <stdio.h>
@@ -54,7 +55,6 @@
 #include "libusb.h"
 #include "libusb10.h"
 
-#define DEVDPIPE	"/var/run/devd.seqpacket.pipe"
 #define DEVCTL_MAXBUF	1024
 
 typedef enum {
@@ -94,7 +94,7 @@ devd_init(libusb_context *ctx)
 		return (false);
 
 	devd_addr.sun_family = PF_LOCAL;
-	strlcpy(devd_addr.sun_path, DEVDPIPE, sizeof(devd_addr.sun_path));
+	strlcpy(devd_addr.sun_path, _PATH_DEVD_SOCKET, sizeof(devd_addr.sun_path));
 	if (connect(ctx->devd_pipe, (struct sockaddr *)&devd_addr,
 	    sizeof(devd_addr)) == -1) {
 		close(ctx->devd_pipe);
diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc
index cff50d2f8d80..02be99ea7c97 100644
--- a/sbin/devd/devd.cc
+++ b/sbin/devd/devd.cc
@@ -100,7 +100,6 @@
 #include "devd.hh"		/* C++ class definitions */
 
 #define STREAMPIPE "/var/run/devd.pipe"
-#define SEQPACKETPIPE "/var/run/devd.seqpacket.pipe"
 #define CF "/etc/devd.conf"
 #define SYSCTL "hw.bus.devctl_queue"
 
@@ -1049,7 +1048,7 @@ event_loop(void)
 	if (fd == -1)
 		err(1, "Can't open devctl device %s", PATH_DEVCTL);
 	stream_fd = create_socket(STREAMPIPE, SOCK_STREAM);
-	seqpacket_fd = create_socket(SEQPACKETPIPE, SOCK_SEQPACKET);
+	seqpacket_fd = create_socket(_PATH_DEVD_SOCKET, SOCK_SEQPACKET);
 	accepting = 1;
 	max_fd = max(fd, max(stream_fd, seqpacket_fd)) + 1;
 	while (!romeo_must_die) {
diff --git a/sbin/devd/tests/client_test.c b/sbin/devd/tests/client_test.c
index fdac3c98b3c6..f92d40dc9892 100644
--- a/sbin/devd/tests/client_test.c
+++ b/sbin/devd/tests/client_test.c
@@ -26,6 +26,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#include <paths.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -97,7 +98,7 @@ ATF_TC_BODY(seqpacket, tc)
 	bool got_create_event = false;
 	bool got_destroy_event = false;
 
-	s = common_setup(SOCK_SEQPACKET, "/var/run/devd.seqpacket.pipe");
+	s = common_setup(SOCK_SEQPACKET, _PATH_DEVD_SOCKET);
 	/*
 	 * Loop until both events are detected on _different_ reads
 	 * There may be extra events due to unrelated system activity
diff --git a/usr.sbin/moused/moused/moused.c b/usr.sbin/moused/moused/moused.c
index 7de6832a1eb8..4a44ed00f088 100644
--- a/usr.sbin/moused/moused/moused.c
+++ b/usr.sbin/moused/moused/moused.c
@@ -55,6 +55,7 @@
 #include <fnmatch.h>
 #include <libutil.h>
 #include <math.h>
+#include <paths.h>
 #include <setjmp.h>
 #include <signal.h>
 #include <stdarg.h>
@@ -1169,7 +1170,7 @@ connect_devd(void)
 {
 	static const struct sockaddr_un sa = {
 		.sun_family = AF_UNIX,
-		.sun_path = "/var/run/devd.seqpacket.pipe",
+		.sun_path = _PATH_DEVD_SOCKET,
 	};
 	struct kevent kev;
 	int fd;