Skip to content

Commit 3c44c84

Browse files
committed
Silence warnings generated by sysctl to standard error.
1 parent ba2b547 commit 3c44c84

File tree

11 files changed

+15
-14
lines changed

11 files changed

+15
-14
lines changed

build/scripts/build_freebsd.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ done
9595
[ ! -f ${srcdir}/sys/sys/param.h ] \
9696
&& err "Source directory is missing sys/sys/param.h"
9797

98-
ncpu=$(sysctl -n hw.ncpu)
98+
ncpu=$(sysctl -qn hw.ncpu)
9999
njobs=$((ncpu*2))
100100
j="-j${njobs}"
101101

build/scripts/install_freebsd.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ done
126126
[ ! -f ${srcdir}/sys/sys/param.h ] \
127127
&& err "Source directory is missing sys/sys/param.h"
128128

129-
ncpu=$(sysctl -n hw.ncpu)
129+
ncpu=$(sysctl -qn hw.ncpu)
130130
njobs=$((ncpu*2))
131131
j="-j${njobs}"
132132

src/etc/inc/interfaces.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -2823,6 +2823,7 @@ function interface_wireless_configure($if, &$wl, &$wlcfg) {
28232823
}
28242824
$ifconfig = "/sbin/ifconfig";
28252825
$sysctl = "/sbin/sysctl";
2826+
$sysctl_args = "-q";
28262827
$killall = "/usr/bin/killall";
28272828

28282829
/* Set all wireless ifconfig variables (split up to get rid of needed checking) */
@@ -3068,7 +3069,7 @@ EOD;
30683069
if (!empty($wl_sysctl)) {
30693070
fwrite($fd_set, "# sysctls for {$baseif}\n");
30703071
foreach ($wl_sysctl as $wl_sysctl_line) {
3071-
fwrite($fd_set, "{$sysctl} {$wl_sysctl_prefix}.{$wl_sysctl_line}\n");
3072+
fwrite($fd_set, "{$sysctl} ${sysctl_args} {$wl_sysctl_prefix}.{$wl_sysctl_line}\n");
30723073
}
30733074
}
30743075

src/etc/inc/rrd.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ function enable_rrd_graphing() {
634634
}
635635

636636
/* the Memory stats gathering function. */
637-
$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 | ";
637+
$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 | ";
638638
$rrdupdatesh .= " $awk '{getline active;getline inactive;getline free;getline cache;getline wire;printf ";
639639
$rrdupdatesh .= "((active/$0) * 100)\":\"((inactive/$0) * 100)\":\"((free/$0) * 100)\":\"((cache/$0) * 100)\":\"(wire/$0 * 100)}'`\n";
640640
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$mem N:\${MEM}\n";

src/etc/inc/system.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function get_default_sysctl_value($id) {
5959

6060
function get_sysctl_descr($sysctl) {
6161
unset($output);
62-
$_gb = exec("/sbin/sysctl -nd {$sysctl}", $output);
62+
$_gb = exec("/sbin/sysctl -qnd {$sysctl}", $output);
6363

6464
return $output[0];
6565
}

src/etc/inc/util.inc

+3-3
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ function get_sysctl($names) {
20312031
$name_list = array(escapeshellarg($names));
20322032
}
20332033

2034-
exec("/sbin/sysctl -i " . implode(" ", $name_list), $output);
2034+
exec("/sbin/sysctl -iq " . implode(" ", $name_list), $output);
20352035
$values = array();
20362036
foreach ($output as $line) {
20372037
$line = explode(": ", $line, 2);
@@ -2076,12 +2076,12 @@ function set_sysctl($values) {
20762076
$value_list[] = escapeshellarg($key) . "=" . escapeshellarg($value);
20772077
}
20782078

2079-
exec("/sbin/sysctl -i " . implode(" ", $value_list), $output, $success);
2079+
exec("/sbin/sysctl -iq " . implode(" ", $value_list), $output, $success);
20802080

20812081
/* Retry individually if failed (one or more read-only) */
20822082
if ($success <> 0 && count($value_list) > 1) {
20832083
foreach ($value_list as $value) {
2084-
exec("/sbin/sysctl -i " . $value, $output);
2084+
exec("/sbin/sysctl -iq " . $value, $output);
20852085
}
20862086
}
20872087

src/etc/rc.php_ini_setup

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ else
3333
fi
3434

3535
if [ -z "$AVAILMEM" ]; then
36-
MEM=`/sbin/sysctl hw.physmem | cut -d':' -f2`
36+
MEM=`/sbin/sysctl -q hw.physmem | cut -d':' -f2`
3737
AVAILMEM=`/bin/expr $MEM / 1048576`
3838
fi
3939

4040

4141
# Get amount of ram installed on this system
42-
REALMEM=`/sbin/sysctl hw.realmem | /usr/bin/awk '{print $2/1048576}' | /usr/bin/awk -F '.' '{print $1}'`
42+
REALMEM=`/sbin/sysctl -q hw.realmem | /usr/bin/awk '{print $2/1048576}' | /usr/bin/awk -F '.' '{print $1}'`
4343
export REALMEM
4444
export LOWMEM
4545

src/usr/local/bin/beep.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if [ -f /var/log/dmesg.boot ]; then
3535
fi
3636

3737
# Check for different HZ
38-
HZ=`/sbin/sysctl -n kern.hz`
38+
HZ=`/sbin/sysctl -qn kern.hz`
3939
if [ "$HZ" = "1" ]; then
4040
NOTELENGTH="10"
4141
fi

src/usr/local/www/status.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ function get_gateway_status() {
336336
defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
337337

338338
/* OS/Hardware Status */
339-
defCmdT("OS-sysctl values", "/sbin/sysctl -a");
339+
defCmdT("OS-sysctl values", "/sbin/sysctl -aq");
340340
defCmdT("OS-Kernel Environment", "/bin/kenv");
341341
defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
342342
defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");

src/usr/local/www/widgets/include/thermal_sensors.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $thermal_sensors_allow_multiple_widget_copies = true;
3030
//NOTE: depends on proper config in System >> Advanced >> Miscellaneous tab >> Thermal Sensors section.
3131
function getThermalSensorsData() {
3232

33-
$_gb = exec("/sbin/sysctl -a | grep temperature", $dfout);
33+
$_gb = exec("/sbin/sysctl -aq | grep temperature", $dfout);
3434
$dfout_filtered = array_filter($dfout, function($v) {
3535
return strpos($negsign, ' -') === false;
3636
});

src/usr/local/www/widgets/widgets/thermal_sensors.widget.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
//called by showThermalSensorsData() (jQuery Ajax call) in thermal_sensors.js
2727
if (isset($_REQUEST["getThermalSensorsData"])) {
2828

29-
$_gb = exec("/sbin/sysctl -a | grep temperature", $dfout);
29+
$_gb = exec("/sbin/sysctl -aq | grep temperature", $dfout);
3030
$dfout_filtered = array_filter($dfout, function($v) {
3131
return strpos($negsign, ' -') === false;
3232
});

0 commit comments

Comments
 (0)