Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc Use sysctl to retrieve iostat names instead of parsing p...



details:   https://anonhg.NetBSD.org/src/rev/a83495bd1152
branches:  trunk
changeset: 828841:a83495bd1152
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Jan 06 23:44:06 2018 +0000

description:
Use sysctl to retrieve iostat names instead of parsing possibly
truncated iostat output.

Check dkctl listwedges output with grep.

Fixes PR 59205.

diffstat:

 etc/security |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 9cee125f72c1 -r a83495bd1152 etc/security
--- a/etc/security      Sat Jan 06 23:15:36 2018 +0000
+++ b/etc/security      Sat Jan 06 23:44:06 2018 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#      $NetBSD: security,v 1.121 2016/02/29 16:16:42 riastradh Exp $
+#      $NetBSD: security,v 1.122 2018/01/06 23:44:06 mlelstv Exp $
 #      from: @(#)security      8.1 (Berkeley) 6/9/93
 #
 
@@ -909,13 +909,13 @@
            egrep -v '\.(backup|current)(,v)?$' > $LABELS
        xargs rm < $LABELS
 
-       disks="$(iostat -x | cut -f 1 -d ' ' )"
+       disks="$(/sbin/sysctl -n hw.iostatnames)"
 
                # generate disklabels of all disks excluding:   cd fd md dk st
                # nfs and "device" (the header of iostat)
        for i in $disks; do
                case $i in
-               [cfm]d[0-9]*|dk[0-9]*|st[0-9]*|nfs[0-9]*|device)
+               [cfm]d[0-9]*|dk[0-9]*|st[0-9]*|nfs[0-9]*)
                        ;;
                *)
                        if disklabel $i > /dev/null 2>&1; then
@@ -943,7 +943,8 @@
                for i in $disks; do
                        case $i in
                        [elsw]d[0-9]*|cgd[0-9]*|ofdisk[0-9]*|r[al][0-9]*|raid[0-9]*)
-                               if /sbin/dkctl $i listwedges -qe; then
+                               if /sbin/dkctl $i listwedges |
+                                    grep -qe '[0-9] wedges:'; then
                                        /sbin/dkctl $i listwedges \
                                            > "$work_dir/wedges.$i" 2>/dev/null
                                fi



Home | Main Index | Thread Index | Old Index