From owner-svn-src-head@freebsd.org Tue Nov 6 23:41:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E38C1104FD3; Tue, 6 Nov 2018 23:41:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C521D75A4B; Tue, 6 Nov 2018 23:41:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C1815E4C; Tue, 6 Nov 2018 23:41:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA6NfjYL066449; Tue, 6 Nov 2018 23:41:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA6NfjYY066444; Tue, 6 Nov 2018 23:41:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201811062341.wA6NfjYY066444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 6 Nov 2018 23:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340208 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 340208 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C521D75A4B X-Spamd-Result: default: False [-103.10 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.99)[-0.994,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Tue, 06 Nov 2018 23:41:46 -0000 Author: markj Date: Tue Nov 6 23:41:44 2018 New Revision: 340208 URL: https://svnweb.freebsd.org/changeset/base/340208 Log: Avoid fixing the tty_info() buffer size in tty.h. Different compilation units may otherwise get a different view of the layout of struct tty depending on whether they include opt_printf.h. This caused a blowup in the number of types defined in the kernel's CTF file after r339468; thanks to dim@ for bisecting down to that revision. PR: 232675 Reported by: dim Reviewed by: cem (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17877 Modified: head/sys/kern/tty.c head/sys/kern/tty_info.c head/sys/sys/tty.h Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Tue Nov 6 22:50:50 2018 (r340207) +++ head/sys/kern/tty.c Tue Nov 6 23:41:44 2018 (r340208) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" +#include "opt_printf.h" #include #include @@ -106,6 +107,12 @@ SYSCTL_INT(_kern, OID_AUTO, tty_drainwait, CTLFLAG_RWT #define TTYBUF_MAX 65536 +#ifdef PRINTF_BUFR_SIZE +#define TTY_PRBUF_SIZE PRINTF_BUFR_SIZE +#else +#define TTY_PRBUF_SIZE 256 +#endif + /* * Allocate buffer space if necessary, and set low watermarks, based on speed. * Note that the ttyxxxq_setsize() functions may drop and then reacquire the tty @@ -1051,7 +1058,9 @@ tty_alloc_mutex(struct ttydevsw *tsw, void *sc, struct PATCH_FUNC(busy); #undef PATCH_FUNC - tp = malloc(sizeof(struct tty), M_TTY, M_WAITOK|M_ZERO); + tp = malloc(sizeof(struct tty) + TTY_PRBUF_SIZE, M_TTY, + M_WAITOK | M_ZERO); + tp->t_prbufsz = TTY_PRBUF_SIZE; tp->t_devsw = tsw; tp->t_devswsoftc = sc; tp->t_flags = tsw->tsw_flags; Modified: head/sys/kern/tty_info.c ============================================================================== --- head/sys/kern/tty_info.c Tue Nov 6 22:50:50 2018 (r340207) +++ head/sys/kern/tty_info.c Tue Nov 6 23:41:44 2018 (r340208) @@ -271,7 +271,7 @@ tty_info(struct tty *tp) if (tty_checkoutq(tp) == 0) return; - (void)sbuf_new(&sb, tp->t_prbuf, sizeof(tp->t_prbuf), SBUF_FIXEDLEN); + (void)sbuf_new(&sb, tp->t_prbuf, tp->t_prbufsz, SBUF_FIXEDLEN); sbuf_set_drain(&sb, sbuf_tty_drain, tp); /* Print load average. */ Modified: head/sys/sys/tty.h ============================================================================== --- head/sys/sys/tty.h Tue Nov 6 22:50:50 2018 (r340207) +++ head/sys/sys/tty.h Tue Nov 6 23:41:44 2018 (r340208) @@ -133,12 +133,8 @@ struct tty { void *t_hooksoftc; /* (t) Soft config, for hooks. */ struct cdev *t_dev; /* (c) Primary character device. */ -#ifndef PRINTF_BUFR_SIZE -#define TTY_PRINTF_SIZE 256 -#else -#define TTY_PRINTF_SIZE PRINTF_BUFR_SIZE -#endif - char t_prbuf[TTY_PRINTF_SIZE]; /* (t) */ + size_t t_prbufsz; /* (t) SIGINFO buffer size. */ + char t_prbuf[]; /* (t) SIGINFO buffer. */ }; /*