mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Silence warnings generated by sysctl to standard error.
This commit is contained in:
parent
ba2b547fcd
commit
3c44c845fe
@ -95,7 +95,7 @@ done
|
||||
[ ! -f ${srcdir}/sys/sys/param.h ] \
|
||||
&& err "Source directory is missing sys/sys/param.h"
|
||||
|
||||
ncpu=$(sysctl -n hw.ncpu)
|
||||
ncpu=$(sysctl -qn hw.ncpu)
|
||||
njobs=$((ncpu*2))
|
||||
j="-j${njobs}"
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ done
|
||||
[ ! -f ${srcdir}/sys/sys/param.h ] \
|
||||
&& err "Source directory is missing sys/sys/param.h"
|
||||
|
||||
ncpu=$(sysctl -n hw.ncpu)
|
||||
ncpu=$(sysctl -qn hw.ncpu)
|
||||
njobs=$((ncpu*2))
|
||||
j="-j${njobs}"
|
||||
|
||||
|
||||
@ -2823,6 +2823,7 @@ function interface_wireless_configure($if, &$wl, &$wlcfg) {
|
||||
}
|
||||
$ifconfig = "/sbin/ifconfig";
|
||||
$sysctl = "/sbin/sysctl";
|
||||
$sysctl_args = "-q";
|
||||
$killall = "/usr/bin/killall";
|
||||
|
||||
/* Set all wireless ifconfig variables (split up to get rid of needed checking) */
|
||||
@ -3068,7 +3069,7 @@ EOD;
|
||||
if (!empty($wl_sysctl)) {
|
||||
fwrite($fd_set, "# sysctls for {$baseif}\n");
|
||||
foreach ($wl_sysctl as $wl_sysctl_line) {
|
||||
fwrite($fd_set, "{$sysctl} {$wl_sysctl_prefix}.{$wl_sysctl_line}\n");
|
||||
fwrite($fd_set, "{$sysctl} ${sysctl_args} {$wl_sysctl_prefix}.{$wl_sysctl_line}\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -634,7 +634,7 @@ function enable_rrd_graphing() {
|
||||
}
|
||||
|
||||
/* the Memory stats gathering function. */
|
||||
$rrdupdatesh .= "MEM=`$sysctl -n vm.stats.vm.v_page_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_free_count vm.stats.vm.v_cache_count vm.stats.vm.v_wire_count | ";
|
||||
$rrdupdatesh .= "MEM=`$sysctl -qn vm.stats.vm.v_page_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_free_count vm.stats.vm.v_cache_count vm.stats.vm.v_wire_count | ";
|
||||
$rrdupdatesh .= " $awk '{getline active;getline inactive;getline free;getline cache;getline wire;printf ";
|
||||
$rrdupdatesh .= "((active/$0) * 100)\":\"((inactive/$0) * 100)\":\"((free/$0) * 100)\":\"((cache/$0) * 100)\":\"(wire/$0 * 100)}'`\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$mem N:\${MEM}\n";
|
||||
|
||||
@ -59,7 +59,7 @@ function get_default_sysctl_value($id) {
|
||||
|
||||
function get_sysctl_descr($sysctl) {
|
||||
unset($output);
|
||||
$_gb = exec("/sbin/sysctl -nd {$sysctl}", $output);
|
||||
$_gb = exec("/sbin/sysctl -qnd {$sysctl}", $output);
|
||||
|
||||
return $output[0];
|
||||
}
|
||||
|
||||
@ -2031,7 +2031,7 @@ function get_sysctl($names) {
|
||||
$name_list = array(escapeshellarg($names));
|
||||
}
|
||||
|
||||
exec("/sbin/sysctl -i " . implode(" ", $name_list), $output);
|
||||
exec("/sbin/sysctl -iq " . implode(" ", $name_list), $output);
|
||||
$values = array();
|
||||
foreach ($output as $line) {
|
||||
$line = explode(": ", $line, 2);
|
||||
@ -2076,12 +2076,12 @@ function set_sysctl($values) {
|
||||
$value_list[] = escapeshellarg($key) . "=" . escapeshellarg($value);
|
||||
}
|
||||
|
||||
exec("/sbin/sysctl -i " . implode(" ", $value_list), $output, $success);
|
||||
exec("/sbin/sysctl -iq " . implode(" ", $value_list), $output, $success);
|
||||
|
||||
/* Retry individually if failed (one or more read-only) */
|
||||
if ($success <> 0 && count($value_list) > 1) {
|
||||
foreach ($value_list as $value) {
|
||||
exec("/sbin/sysctl -i " . $value, $output);
|
||||
exec("/sbin/sysctl -iq " . $value, $output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,13 +33,13 @@ else
|
||||
fi
|
||||
|
||||
if [ -z "$AVAILMEM" ]; then
|
||||
MEM=`/sbin/sysctl hw.physmem | cut -d':' -f2`
|
||||
MEM=`/sbin/sysctl -q hw.physmem | cut -d':' -f2`
|
||||
AVAILMEM=`/bin/expr $MEM / 1048576`
|
||||
fi
|
||||
|
||||
|
||||
# Get amount of ram installed on this system
|
||||
REALMEM=`/sbin/sysctl hw.realmem | /usr/bin/awk '{print $2/1048576}' | /usr/bin/awk -F '.' '{print $1}'`
|
||||
REALMEM=`/sbin/sysctl -q hw.realmem | /usr/bin/awk '{print $2/1048576}' | /usr/bin/awk -F '.' '{print $1}'`
|
||||
export REALMEM
|
||||
export LOWMEM
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ if [ -f /var/log/dmesg.boot ]; then
|
||||
fi
|
||||
|
||||
# Check for different HZ
|
||||
HZ=`/sbin/sysctl -n kern.hz`
|
||||
HZ=`/sbin/sysctl -qn kern.hz`
|
||||
if [ "$HZ" = "1" ]; then
|
||||
NOTELENGTH="10"
|
||||
fi
|
||||
|
||||
@ -336,7 +336,7 @@ defCmdT("OS-Message Buffer", "/sbin/dmesg -a");
|
||||
defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
|
||||
|
||||
/* OS/Hardware Status */
|
||||
defCmdT("OS-sysctl values", "/sbin/sysctl -a");
|
||||
defCmdT("OS-sysctl values", "/sbin/sysctl -aq");
|
||||
defCmdT("OS-Kernel Environment", "/bin/kenv");
|
||||
defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
|
||||
defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
|
||||
|
||||
@ -30,7 +30,7 @@ $thermal_sensors_allow_multiple_widget_copies = true;
|
||||
//NOTE: depends on proper config in System >> Advanced >> Miscellaneous tab >> Thermal Sensors section.
|
||||
function getThermalSensorsData() {
|
||||
|
||||
$_gb = exec("/sbin/sysctl -a | grep temperature", $dfout);
|
||||
$_gb = exec("/sbin/sysctl -aq | grep temperature", $dfout);
|
||||
$dfout_filtered = array_filter($dfout, function($v) {
|
||||
return strpos($negsign, ' -') === false;
|
||||
});
|
||||
|
||||
@ -26,7 +26,7 @@ require_once("guiconfig.inc");
|
||||
//called by showThermalSensorsData() (jQuery Ajax call) in thermal_sensors.js
|
||||
if (isset($_REQUEST["getThermalSensorsData"])) {
|
||||
|
||||
$_gb = exec("/sbin/sysctl -a | grep temperature", $dfout);
|
||||
$_gb = exec("/sbin/sysctl -aq | grep temperature", $dfout);
|
||||
$dfout_filtered = array_filter($dfout, function($v) {
|
||||
return strpos($negsign, ' -') === false;
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user