From owner-svn-src-head@freebsd.org Thu Jul 21 17:54:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A767BA14A6; Thu, 21 Jul 2016 17:54:15 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5780B1CFF; Thu, 21 Jul 2016 17:54:14 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from xc1.bsdpad.com ([195.154.136.64]:31941) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1bQIAm-000dqG-jg (Exim 4.86_36-e07b163) (return-path ); Thu, 21 Jul 2016 18:54:12 +0100 Date: Thu, 21 Jul 2016 18:52:25 +0100 From: Ruslan Bukin To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303151 - in head/sys: dev/pty kern sys Message-ID: <20160721175225.GA84153@bsdpad.com> References: <201607211634.u6LGYvIH038339@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <201607211634.u6LGYvIH038339@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2016 17:54:15 -0000 Hi, I get the issues below with GCC 6.1 [...] =3D=3D=3D> lib/libsbuf (obj,all,install) /home/rb743/opt/new17/bin/riscv64-unknown-freebsd11.0-gcc -isystem /home/rb= 743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/include -L/home= /rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/lib --sysroo= t=3D/home/rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp -B/home= /rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/bin -O2 -pi= pe -msoft-float -MD -MF.depend.subr_prf.o -MTsubr_prf.o -std=3Dgnu99 -fs= tack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wn= o-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith= -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-param= eter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-d= ecls -Wold-style-definition -Wno-pointer-sign -Wno-error=3Dunused-function = -Wno-error=3Denum-compare -Wno-error=3Dlogical-not-parentheses -Wno-error= =3Dbool-compare -Wno-error=3Duninitialized -Wno-error=3Darray-bounds -Wno-e= rror=3Dclobbered -Wno-error=3Dcast-align -Wno-error=3Dextra -Wno-error=3Dat= tributes -Wno-error=3Dinline -Wno-error=3Dunused-but-set-variable -Wno-erro= r=3Dunused-value -Wno-error=3Dstrict-aliasing -Wno-error=3Daddress -Wno-err= or=3Dunused-const-variable=3D -Wno-error=3Dnonnull-compare -Wno-error=3Dshi= ft-negative-value -Wno-error=3Dmisleading-indentation -Wno-error=3Dtautolog= ical-compare -c /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/ker= n/subr_prf.c -o subr_prf.o /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1200:1:= error: no previous prototype for 'counted_warning' [-Werror=3Dmissing-prot= otypes] counted_warning(unsigned *counter, const char *msg) ^~~~~~~~~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c: In fun= ction 'counted_warning': /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1209:7:= error: implicit declaration of function 'atomic_cmpset_int' [-Werror=3Dimp= licit-function-declaration] if (atomic_cmpset_int(counter, c, c - 1)) { ^~~~~~~~~~~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1209:3:= error: nested extern declaration of 'atomic_cmpset_int' [-Werror=3Dnested-= externs] if (atomic_cmpset_int(counter, c, c - 1)) { ^~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1210:9:= error: 'curthread' undeclared (first use in this function) td =3D curthread; ^~~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1210:9:= note: each undeclared identifier is reported only once for each function i= t appears in /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= error: implicit declaration of function 'log' [-Werror=3Dimplicit-function= -declaration] log(LOG_INFO, "pid %d (%s) %s%s\n", ^~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= error: incompatible implicit declaration of built-in function 'log' [-Werr= or] /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= note: include '' or provide a declaration of 'log' /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:8:= error: 'LOG_INFO' undeclared (first use in this function) log(LOG_INFO, "pid %d (%s) %s%s\n", ^~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1212:10= : error: dereferencing pointer to incomplete type 'struct thread' td->td_proc->p_pid, td->td_name, msg, ^~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= error: too many arguments to function 'log' log(LOG_INFO, "pid %d (%s) %s%s\n", ^~~ cc1: all warnings being treated as errors *** [subr_prf.o] Error code 1 bmake[4]: stopped in /home/rb743/dev/freebsd-riscv/lib/libsbuf 1 error bmake[4]: stopped in /home/rb743/dev/freebsd-riscv/lib/libsbuf *** [lib/libsbuf__L] Error code 2 bmake[3]: stopped in /home/rb743/dev/freebsd-riscv 1 error bmake[3]: stopped in /home/rb743/dev/freebsd-riscv *** [libraries] Error code 2 bmake[2]: stopped in /home/rb743/dev/freebsd-riscv 1 error bmake[2]: stopped in /home/rb743/dev/freebsd-riscv *** [_libraries] Error code 2 bmake[1]: stopped in /home/rb743/dev/freebsd-riscv 1 error bmake[1]: stopped in /home/rb743/dev/freebsd-riscv *** [buildworld] Error code 2 make: stopped in /home/rb743/dev/freebsd-riscv make: stopped in /home/rb743/dev/freebsd-riscv 0 vica:/home/rb743/dev/freebsd-riscv > On Thu, Jul 21, 2016 at 04:34:57PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Thu Jul 21 16:34:56 2016 > New Revision: 303151 > URL: https://svnweb.freebsd.org/changeset/base/303151 >=20 > Log: > Provide counter_warning(9) KPI which allows to issue limited number of > warnings for some kernel events, mostly intended for the use of > obsoleted or otherwise undersired interfaces. > =20 > This is an abstracted and race-expelled code from compat pty driver. > =20 > Requested and reviewed by: jhb > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D7270 >=20 > Modified: > head/sys/dev/pty/pty.c > head/sys/kern/subr_prf.c > head/sys/sys/systm.h >=20 > Modified: head/sys/dev/pty/pty.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/pty/pty.c Thu Jul 21 15:48:41 2016 (r303150) > +++ head/sys/dev/pty/pty.c Thu Jul 21 16:34:56 2016 (r303151) > @@ -52,10 +52,10 @@ __FBSDID("$FreeBSD$"); > * binary emulation. > */ > =20 > -static unsigned int pty_warningcnt =3D 1; > +static unsigned pty_warningcnt =3D 1; > SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW, > - &pty_warningcnt, 0, > - "Warnings that will be triggered upon legacy PTY allocation"); > + &pty_warningcnt, 0, > + "Warnings that will be triggered upon legacy PTY allocation"); > =20 > static int > ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct fi= le *fp) > @@ -77,12 +77,7 @@ ptydev_fdopen(struct cdev *dev, int ffla > } > =20 > /* Raise a warning when a legacy PTY has been allocated. */ > - if (pty_warningcnt > 0) { > - pty_warningcnt--; > - log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n", > - td->td_proc->p_pid, td->td_name, > - pty_warningcnt ? "" : " - not logging anymore"); > - } > + counted_warning(&pty_warningcnt, "is using legacy pty devices"); > =20 > return (0); > } >=20 > Modified: head/sys/kern/subr_prf.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/subr_prf.c Thu Jul 21 15:48:41 2016 (r303150) > +++ head/sys/kern/subr_prf.c Thu Jul 21 16:34:56 2016 (r303151) > @@ -1196,3 +1196,22 @@ sbuf_hexdump(struct sbuf *sb, const void > } > } > =20 > +void > +counted_warning(unsigned *counter, const char *msg) > +{ > + struct thread *td; > + unsigned c; > + > + for (;;) { > + c =3D *counter; > + if (c =3D=3D 0) > + break; > + if (atomic_cmpset_int(counter, c, c - 1)) { > + td =3D curthread; > + log(LOG_INFO, "pid %d (%s) %s%s\n", > + td->td_proc->p_pid, td->td_name, msg, > + c > 1 ? "" : " - not logging anymore"); > + break; > + } > + } > +} >=20 > Modified: head/sys/sys/systm.h > =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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/systm.h Thu Jul 21 15:48:41 2016 (r303150) > +++ head/sys/sys/systm.h Thu Jul 21 16:34:56 2016 (r303151) > @@ -447,4 +447,6 @@ void intr_prof_stack_use(struct thread * > =20 > extern void (*softdep_ast_cleanup)(void); > =20 > +void counted_warning(unsigned *counter, const char *msg); > + > #endif /* !_SYS_SYSTM_H_ */ >=20