[newlib 19/65] Make the path length of UNIX domain sockets

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jul 7 11:58:26 UTC 2022


From: "Jonathan T. Looney" <jtl at FreeBSD.org>

specified by a #define. Also, add a comment describing the historical context
for this length.

Reviewed by:	bz, jhb, kbowling (previous version)
MFC after:	2 weeks
Sponsored by:	Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D24272
---
 newlib/libc/sys/rtems/include/sys/un.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/un.h b/newlib/libc/sys/rtems/include/sys/un.h
index f83652e07..3c408628c 100644
--- a/newlib/libc/sys/rtems/include/sys/un.h
+++ b/newlib/libc/sys/rtems/include/sys/un.h
@@ -43,13 +43,21 @@ typedef	__sa_family_t	sa_family_t;
 #define	_SA_FAMILY_T_DECLARED
 #endif
 
+/*
+ * Historically, (struct sockaddr) needed to fit inside an mbuf.
+ * For this reason, UNIX domain sockets were therefore limited to
+ * 104 bytes. While this limit is no longer necessary, it is kept for
+ * binary compatibility reasons.
+ */
+#define	SUNPATHLEN	104
+
 /*
  * Definitions for UNIX IPC domain.
  */
 struct sockaddr_un {
 	unsigned char	sun_len;	/* sockaddr len including null */
 	sa_family_t	sun_family;	/* AF_UNIX */
-	char	sun_path[104];		/* path name (gag) */
+	char	sun_path[SUNPATHLEN];	/* path name (gag) */
 };
 
 #if __BSD_VISIBLE
-- 
2.35.3



More information about the devel mailing list