Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jul 2010 21:46:09 GMT
From:      Ilya Bakulin <kibab@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 180508 for review
Message-ID:  <201007052146.o65Lk9AJ080229@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180508?ac=10

Change 180508 by kibab@kibab_kibab-nb on 2010/07/05 21:45:35

	Finish IFC.

Affected files ...

.. //depot/projects/soc2010/kibab_sysctlreg/src_lib_libc/gen/feature_present.c#2 edit
.. //depot/projects/soc2010/kibab_sysctlreg/src_sys/arm/include/bootinfo.h#2 integrate

Differences ...

==== //depot/projects/soc2010/kibab_sysctlreg/src_lib_libc/gen/feature_present.c#2 (text+ko) ====

@@ -29,13 +29,34 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/gen/feature_present.c 175220 2008-01-10 22:11:21Z jhb $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/feature_present.c,v 1.1 2008/01/10 22:11:21 jhb Exp $");
 
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+
+/*
+ * Helper function to test if the named feature is disabled
+ * by the environment variable FEATURES_DISABLE.
+ * Returns true if the feature is disabled.
+ */
+static int
+is_feature_disabled(const char *str_to_test) {
+	char *token, *dis_features;
+
+	dis_features = getenv("FEATURES_DISABLE");
+	if(!dis_features)
+		return (0);
 
+	while ((token = strsep(&dis_features, " ")) != NULL) {
+		if (strcmp(token, str_to_test)==0)
+			return (1);
+	}
+	return (0);
+}
+
 /*
  * Returns true if the named feature is present in the currently
  * running kernel.  A feature's presence is indicated by an integer
@@ -48,6 +69,8 @@
 	size_t len;
 	int i;
 
+	if (is_feature_disabled((feature)))
+		return (0);
 	if (asprintf(&mib, "kern.features.%s", feature) < 0)
 		return (0);
 	len = sizeof(i);
@@ -60,3 +83,4 @@
 		return (0);
 	return (i != 0);
 }
+

==== //depot/projects/soc2010/kibab_sysctlreg/src_sys/arm/include/bootinfo.h#2 (text+ko) ====




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007052146.o65Lk9AJ080229>