svn commit: r357696 - head/lib/libc/gen

Konstantin Belousov kib at FreeBSD.org
Sun Feb 9 12:12:04 UTC 2020


Author: kib
Date: Sun Feb  9 12:12:03 2020
New Revision: 357696
URL: https://svnweb.freebsd.org/changeset/base/357696

Log:
  Add AT_BSDFLAGS support to _elf_aux_info(3).
  
  Tested by:	pho
  Disscussed with:	cem, emaste, jilles
  Sponsored by:	The FreeBSD Foundation
  Differential revision:	https://reviews.freebsd.org/D12773

Modified:
  head/lib/libc/gen/auxv.c

Modified: head/lib/libc/gen/auxv.c
==============================================================================
--- head/lib/libc/gen/auxv.c	Sun Feb  9 12:10:37 2020	(r357695)
+++ head/lib/libc/gen/auxv.c	Sun Feb  9 12:12:03 2020	(r357696)
@@ -67,7 +67,7 @@ __init_elf_aux_vector(void)
 }
 
 static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
-static int pagesize, osreldate, canary_len, ncpus, pagesizes_len;
+static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
 static int hwcap_present, hwcap2_present;
 static char *canary, *pagesizes, *execpath;
 static void *timekeep;
@@ -86,6 +86,10 @@ init_aux(void)
 
 	for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) {
 		switch (aux->a_type) {
+		case AT_BSDFLAGS:
+			bsdflags = aux->a_un.a_val;
+			break;
+
 		case AT_CANARY:
 			canary = (char *)(aux->a_un.a_ptr);
 			break;
@@ -323,6 +327,13 @@ _elf_aux_info(int aux, void *buf, int buflen)
 				res = 0;
 			} else
 				res = ENOENT;
+		} else
+			res = EINVAL;
+		break;
+	case AT_BSDFLAGS:
+		if (buflen == sizeof(int)) {
+			*(int *)buf = bsdflags;
+			res = 0;
 		} else
 			res = EINVAL;
 		break;


More information about the svn-src-head mailing list