From owner-freebsd-net@FreeBSD.ORG Tue Jan 22 18:24:00 2013 Return-Path: Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1CA4F43B; Tue, 22 Jan 2013 18:24:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 844AEB0A; Tue, 22 Jan 2013 18:23:56 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r0MINmdD036579; Tue, 22 Jan 2013 20:23:48 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.4 kib.kiev.ua r0MINmdD036579 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r0MINmlf036578; Tue, 22 Jan 2013 20:23:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 22 Jan 2013 20:23:48 +0200 From: Konstantin Belousov To: Oliver Fromme Subject: Re: Processes' FIBs Message-ID: <20130122182348.GA36551@kib.kiev.ua> References: <201201171221.q0HCLRsh034506@lurza.secnetix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tKW2IUtsqtDRztdT" Content-Disposition: inline In-Reply-To: <201201171221.q0HCLRsh034506@lurza.secnetix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-net@FreeBSD.ORG, gibbs@freebsd.org, Oliver Fromme , freebsd-hackers@FreeBSD.ORG X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 18:24:00 -0000 --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 17, 2012 at 01:21:27PM +0100, Oliver Fromme wrote: > Kostik Belousov wrote: > > The patch misses compat32 bits and breaks compat32 ps/top. >=20 > Right, thank you for pointing it out! I missed it because > I only have i386 for testing. >=20 > I've created new patch sets for releng8 and current. These > include compat32 support and an entry for the manual page. >=20 > Would someone with amd64 please test the compat32 part? > I've been using this code on i386 for a few days without > any problems. >=20 > I've attached the patch for current below. Both patch sets > are also available from this URL: > http://www.secnetix.de/olli/tmp/ki_fibnum/ >=20 > Testing is easy: Apply the patch, rebuild bin/ps and kernel. > Make sure that your kernel config has "options ROUTETABLES=3D16" > so multiple FIBs are supported. Reboot. Open a shell with > setfib, e.g. "setfib 3 /bin/sh" (no root required), type > "ps -ax -o user,pid,fib,command" or something similar, and > verify that the shell process and its children are listed > with the correct FIB. When testing on amd64, use both the > native ps and an i386 binary. >=20 > Thank you very much! >=20 > Best regards > Oliver >=20 > --- sys/sys/user.h.orig 2011-11-07 22:13:19.000000000 +0100 > +++ sys/sys/user.h 2012-01-17 11:33:59.000000000 +0100 > @@ -83,7 +83,7 @@ > * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and > * function kvm_proclist in lib/libkvm/kvm_proc.c . > */ > -#define KI_NSPARE_INT 9 > +#define KI_NSPARE_INT 8 > #define KI_NSPARE_LONG 12 > #define KI_NSPARE_PTR 6 > =20 > @@ -186,6 +186,7 @@ > */ > char ki_sparestrings[50]; /* spare string space */ > int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ > + int ki_fibnum; /* Default FIB number */ > u_int ki_cr_flags; /* Credential flags */ > int ki_jid; /* Process jail ID */ > int ki_numthreads; /* XXXKSE number of threads in total */ > --- sys/kern/kern_proc.c.orig 2012-01-15 19:47:24.000000000 +0100 > +++ sys/kern/kern_proc.c 2012-01-17 12:52:36.000000000 +0100 > @@ -836,6 +836,7 @@ > kp->ki_swtime =3D (ticks - p->p_swtick) / hz; > kp->ki_pid =3D p->p_pid; > kp->ki_nice =3D p->p_nice; > + kp->ki_fibnum =3D p->p_fibnum; > kp->ki_start =3D p->p_stats->p_start; > timevaladd(&kp->ki_start, &boottime); > PROC_SLOCK(p); > @@ -1121,6 +1122,7 @@ > bcopy(ki->ki_comm, ki32->ki_comm, COMMLEN + 1); > bcopy(ki->ki_emul, ki32->ki_emul, KI_EMULNAMELEN + 1); > bcopy(ki->ki_loginclass, ki32->ki_loginclass, LOGINCLASSLEN + 1); > + CP(*ki, *ki32, ki_fibnum); > CP(*ki, *ki32, ki_cr_flags); > CP(*ki, *ki32, ki_jid); > CP(*ki, *ki32, ki_numthreads); > --- sys/compat/freebsd32/freebsd32.h.orig 2011-11-11 08:17:00.000000000 += 0100 > +++ sys/compat/freebsd32/freebsd32.h 2012-01-17 11:34:00.000000000 +0100 > @@ -319,6 +319,7 @@ > char ki_loginclass[LOGINCLASSLEN+1]; > char ki_sparestrings[50]; > int ki_spareints[KI_NSPARE_INT]; > + int ki_fibnum; > u_int ki_cr_flags; > int ki_jid; > int ki_numthreads; > --- bin/ps/keyword.c.orig 2011-09-29 08:31:42.000000000 +0200 > +++ bin/ps/keyword.c 2012-01-17 12:54:49.000000000 +0100 > @@ -85,6 +85,7 @@ > {"etimes", "ELAPSED", NULL, USER, elapseds, 0, CHAR, NULL, 0}, > {"euid", "", "uid", 0, NULL, 0, CHAR, NULL, 0}, > {"f", "F", NULL, 0, kvar, KOFF(ki_flag), INT, "x", 0}, > + {"fib", "FIB", NULL, 0, kvar, NULL, 2, KOFF(ki_fibnum), INT, "d", 0}, > {"flags", "", "f", 0, NULL, 0, CHAR, NULL, 0}, > {"gid", "GID", NULL, 0, kvar, KOFF(ki_groups), UINT, UIDFMT, 0}, > {"group", "GROUP", NULL, LJUST, egroupname, 0, CHAR, NULL, 0}, > --- bin/ps/ps.1.orig 2011-11-22 22:53:06.000000000 +0100 > +++ bin/ps/ps.1 2012-01-17 12:56:17.000000000 +0100 > @@ -29,7 +29,7 @@ > .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 > .\" $FreeBSD: src/bin/ps/ps.1,v 1.112 2011/11/22 21:53:06 trociny Exp $ > .\" > -.Dd November 22, 2011 > +.Dd January 17, 2012 > .Dt PS 1 > .Os > .Sh NAME > @@ -506,6 +506,9 @@ > minutes:seconds. > .It Cm etimes > elapsed running time, in decimal integer seconds > +.It Cm fib > +default FIB number, see > +.Xr setfib 1 > .It Cm flags > the process flags, in hexadecimal (alias > .Cm f ) Just reviving the recent thread after the ping. The patch looks fine to me, and is still not committed. --tKW2IUtsqtDRztdT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQ/tkzAAoJEJDCuSvBvK1Bi80P/28DJbyfmQzf9WL8B7bvqkW2 Pw8rsP2jSi23RbOkczbDI1g2CuKUeb6eLJfq7ubAuu+nwnvR4Ue3lY09ntGGGK2G sKbBTH9hMjaAX41Z7zkRDQg/058S00Zd3znaQBQMJJncty3MRg76OhttFP83OENX XEm3HWid9YoNc1zOlMw3fTCDPntuCpZQ3RFUr2Ps0nwEeolYLMZ3+aWYxlDy9Mtj Aw2/wI8rFArTVd9ZF0vd3bdqYkMqmarJr/8VAyIf6nIbaAR0FD5mqkQxzqwLY62k WTBP0tHhY5ZpHjY84S5FFPVE+ecShjWs3FmS1aTVFyk+90UtOyBMSZb3th0AZmCQ PclVx3jgp9ViZNgqgav/nC26GeTKqMxcv8bQYFrJswIxWTZZ1Djm0DcOrglDuPB1 blYiZTmhTHtEa4nfnlbOEXISiWS0iYQoczRZNfZOzX+1+d2L2cc+skVkun7hVUDx SjHyTqIq+BHl9SJ5gFpZldqO7geAc6mDOlUd/L7VSt97FPGp+CY6ErLzC2I14NM3 9sBrfEUmx9qUcI1udTf/b9SMeoPmSPE/DM0ma+bejeg9Yu+xsaDhMe4zE7vaToAG U9lZmRIqGdRR3WeZkDz5pEpk81c96TVkOqA7UBwdzlVi0uEh2JYmJ+piLgyzgYAR vew7p39yNKtXWuXUiNdJ =dxsd -----END PGP SIGNATURE----- --tKW2IUtsqtDRztdT--