From owner-freebsd-audit Sun Aug 19 0:21:56 2001 Delivered-To: freebsd-audit@freebsd.org Received: from obsecurity.dyndns.org (adsl-63-207-60-7.dsl.lsan03.pacbell.net [63.207.60.7]) by hub.freebsd.org (Postfix) with ESMTP id DC64237B412 for ; Sun, 19 Aug 2001 00:21:50 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 4D16266D03; Sun, 19 Aug 2001 00:21:50 -0700 (PDT) Date: Sun, 19 Aug 2001 00:21:50 -0700 From: Kris Kennaway To: audit@FreeBSD.org Subject: iostat signal handler patch Message-ID: <20010819002149.A52245@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="opJtzjQTFsWo+cga" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable iostat is still setgid kmem in RELENG_4..I don't know how easy it would be to backport the sysctl additions which allowed us to remove setgid kmem in -current, but in the meantime perhaps this patch should be committed. This patch is relative to the RELENG_4 code. Kris Index: iostat.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr2/ncvs/src/usr.sbin/iostat/iostat.c,v retrieving revision 1.17.2.2 diff -u -r1.17.2.2 iostat.c --- iostat.c 2001/07/19 04:15:42 1.17.2.2 +++ iostat.c 2001/08/19 07:20:02 @@ -108,6 +108,7 @@ #include #include #include +#include #include #include #include @@ -135,6 +136,7 @@ struct device_selection *dev_select; int maxshowdevs; int dflag =3D 0, Iflag =3D 0, Cflag =3D 0, Tflag =3D 0, oflag =3D 0, Kflag= =3D 0; +volatile sig_atomic_t phdr_flag =3D 0; =20 #define nlread(x, v) \ kvm_read(kd, namelist[x].n_value, &(v), sizeof(v)) @@ -142,6 +144,7 @@ /* local function declarations */ static void usage(void); static void phdr(int signo); +static void do_phdr(); static void devstats(int perf_select); static void cpustats(void); =20 @@ -406,8 +409,13 @@ long tmp; double etime; =20 + if (phdr_flag) { + phdr_flag =3D 0; + do_phdr(); + } + =09 if (!--headercount) { - phdr(0); + do_phdr(); headercount =3D 20; } (void)kvm_read(kd, namelist[X_TK_NIN].n_value, @@ -451,7 +459,7 @@ errx(1, "%s", devstat_errbuf); break; case 1: - phdr(0); + do_phdr(); headercount =3D 20; break; default: @@ -482,7 +490,7 @@ errx(1,"%s", devstat_errbuf); break; case 1: - phdr(0); + do_phdr(); headercount =3D 20; break; default: @@ -528,6 +536,13 @@ =20 static void phdr(int signo) +{ + + phdr_flag =3D 1;=09 +} + +static void +do_phdr()=20 { register int i; int printed; --opJtzjQTFsWo+cga Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7f2kMWry0BWjoQKURAoEPAKCk9RqoQ7LnVbJZTrrwiq/S7ANH5ACdERJe HAyawSM4Y4/pliDz1YQN4L0= =JqCR -----END PGP SIGNATURE----- --opJtzjQTFsWo+cga-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message