git: b27e21f304f2 - main - libc/resolv: Drop Solaris 2 compatibility

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Mon, 29 Jun 2026 15:52:05 UTC
The branch main has been updated by des:

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

commit b27e21f304f260d539288756c5bb85421a549d44
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-25 10:57:11 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-29 13:49:18 +0000

    libc/resolv: Drop Solaris 2 compatibility
    
    MFC after:      1 week
---
 lib/libc/nameser/ns_parse.c |  5 -----
 lib/libc/resolv/res_comp.c  | 11 -----------
 lib/libc/resolv/res_init.c  | 42 ------------------------------------------
 3 files changed, 58 deletions(-)

diff --git a/lib/libc/nameser/ns_parse.c b/lib/libc/nameser/ns_parse.c
index 40f19d33c2bc..fa21127a5c7e 100644
--- a/lib/libc/nameser/ns_parse.c
+++ b/lib/libc/nameser/ns_parse.c
@@ -38,12 +38,7 @@ static void	setsection(ns_msg *msg, ns_sect sect);
 
 /* Macros. */
 
-#if !defined(SOLARIS2) || defined(__COVERITY__)
 #define RETERR(err) do { errno = (err); return (-1); } while (0)
-#else
-#define RETERR(err) \
-	do { errno = (err); if (errno == errno) return (-1); } while (0)
-#endif
 
 #define PARSE_FMT_PRESO 0	/* Parse using presentation-format names */
 #define PARSE_FMT_WIRE 1	/* Parse using network-format names */
diff --git a/lib/libc/resolv/res_comp.c b/lib/libc/resolv/res_comp.c
index 55b71266b4ae..d9edcc9a4930 100644
--- a/lib/libc/resolv/res_comp.c
+++ b/lib/libc/resolv/res_comp.c
@@ -240,17 +240,6 @@ res_dnok(const char *dn) {
  * Note that one _ comes from C and the others come from us.
  */
 
-#ifdef SOLARIS2
-#ifdef  __putlong
-#undef  __putlong
-#endif
-#ifdef  __putshort
-#undef  __putshort
-#endif
-#pragma weak    putlong         =       __putlong
-#pragma weak    putshort        =       __putshort
-#endif /* SOLARIS2 */
-
 void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); }
 void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); }
 #ifndef __ultrix__
diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c
index b21a3fa1670f..e9e982fe27bb 100644
--- a/lib/libc/resolv/res_init.c
+++ b/lib/libc/resolv/res_init.c
@@ -95,10 +95,6 @@
 
 #include "res_private.h"
 
-#ifdef SOLARIS2
-#include <sys/systeminfo.h>
-#endif
-
 static void res_setoptions(res_state, const char *, const char *);
 
 #ifdef RESOLVSORT
@@ -219,28 +215,6 @@ __res_vinit(res_state statp, int preinit) {
 #endif
 	res_setservers(statp, u, nitems(u));
 
-#ifdef	SOLARIS2
-	/*
-	 * The old libresolv derived the defaultdomain from NIS/NIS+.
-	 * We want to keep this behaviour
-	 */
-	{
-		char buf[sizeof(statp->defdname)], *cp;
-		int ret;
-
-		if ((ret = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf))) > 0 &&
-			(unsigned int)ret <= sizeof(buf)) {
-			if (buf[0] == '+')
-				buf[0] = '.';
-			cp = strchr(buf, '.');
-			cp = (cp == NULL) ? buf : (cp + 1);
-			strncpy(statp->defdname, cp,
-				sizeof(statp->defdname) - 1);
-			statp->defdname[sizeof(statp->defdname) - 1] = '\0';
-		}
-	}
-#endif	/* SOLARIS2 */
-
 	/* Allow user to override the local domain definition */
 	if ((cp = secure_getenv("LOCALDOMAIN")) != NULL) {
 		(void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
@@ -580,22 +554,6 @@ res_setoptions(res_state statp, const char *options, const char *source)
 			if (statp->options & RES_DEBUG)
 				printf(";;\ttimeout=%d\n", statp->retrans);
 #endif
-#ifdef	SOLARIS2
-		} else if (!strncmp(cp, "retrans:", sizeof("retrans:") - 1)) {
-			/*
-		 	 * For backward compatibility, 'retrans' is
-		 	 * supported as an alias for 'timeout', though
-		 	 * without an imposed maximum.
-		 	 */
-			statp->retrans = atoi(cp + sizeof("retrans:") - 1);
-		} else if (!strncmp(cp, "retry:", sizeof("retry:") - 1)){
-			/*
-			 * For backward compatibility, 'retry' is
-			 * supported as an alias for 'attempts', though
-			 * without an imposed maximum.
-			 */
-			statp->retry = atoi(cp + sizeof("retry:") - 1);
-#endif	/* SOLARIS2 */
 		} else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){
 			i = atoi(cp + sizeof("attempts:") - 1);
 			if (i <= RES_MAXRETRY)