From nobody Thu Mar 21 15:25:30 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V0q626F2mz5DsNH; Thu, 21 Mar 2024 15:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V0q625FqSz4k4l; Thu, 21 Mar 2024 15:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711034730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k0/TWuEQwpBpHTesVnMRSGKIGEC25eIlrLTTGZ5O0aI=; b=nzfjBHHHnP/ke5D8VYM4IbLbjAiQamX40YqQe70W6ZGipzenuSu+Eqp0TNnbnGechP7gmU ItM+bA3UhxdnBCdnIOZ9X5iXIRSm0Famx58zFQQfmV1mpiPw5KXWVHZuFyg56+ggPp8wkq SeqoBd61snP+QgJdya2iohIZ5kA1XqW7NMJw3AUtkNQlc7uXqQGR+omKS4EqkXhOLmVvaS RrbHYDNJuG2rIHVGaX6WAAZXv+eTLYTC5c1BtjskRK6J7ZHEmPqnDOMQ4xkOW8kjlRklc/ 61QghtYjPT4wfXyzRQlT97ZEunE3m2jxtwF/BsQGTVpbqVeD3tYSmqXkJwF6WQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711034730; a=rsa-sha256; cv=none; b=bfyXTCoarPq0/02p8DDyEy85OR0zsj+4/t1FylX/ewduMga+vAZpDy1oeOODphMMAYYK0W B8VaS67GRbSf8abufOQ9lRz0+ALfigDeW9Gak5WRANsNlUCTHSHNIJV3EwjbY0+aO2FcOi Ytcfj1CyAFMTZa3hTc3gac/JzqNcyYHmWNoU6L1U6Ws4o066MyZAcASycWIF3hlK4gvVYj AutC56sqsf1i71FOrHGQU6/lFYd/IHPlq6isf3cbcV1wtcg1AgKSPU7kfItpgx/ufXfB6g hd91z+zcWXZ5JMMrAHmLhHsI5faX1Y2coHIq/UHoeE8R0btFgSwFc3tIm10y+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711034730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k0/TWuEQwpBpHTesVnMRSGKIGEC25eIlrLTTGZ5O0aI=; b=lbpDtH0u3aksQAjU2TYJP4ZhHsxNyhWJ/+1cGdkrbimZeoT7ABzrLJWZGUU0malilIiw8v Z6dZkpgiWpGXKSpaeIynUqv1GPBCUrKfQ6lkpNIEYLbKnyk1MorbkxRnWOZ9OWTvxB7KgM HgoNxLw4BnzIhLaVlfVYbLxqkrWoMGhSvJKxtazKN34FRawbsbOQo7AtOYXIfQy7E388Tb yPPJkGCuS+U4gryikfCczGKFE488L9w7HDmpoUykNM69pa0qXirvPc/+6+i3aT4+pOloW3 ZkV/t5YJ3z9kFGkcZEYCUn6FFydcQoAX0rrKOFnN1HmmsnKuYbhEw4sy0eOn7w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V0q624kYQzghD; Thu, 21 Mar 2024 15:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42LFPUXZ056084; Thu, 21 Mar 2024 15:25:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42LFPU3A056081; Thu, 21 Mar 2024 15:25:30 GMT (envelope-from git) Date: Thu, 21 Mar 2024 15:25:30 GMT Message-Id: <202403211525.42LFPU3A056081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 36de8bb22667 - main - kassert.h: update MPASS definition commentary List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36de8bb226671ef9fe373d8d95f77cdb76157738 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=36de8bb226671ef9fe373d8d95f77cdb76157738 commit 36de8bb226671ef9fe373d8d95f77cdb76157738 Author: Mitchell Horne AuthorDate: 2024-03-21 15:21:41 +0000 Commit: Mitchell Horne CommitDate: 2024-03-21 15:24:47 +0000 kassert.h: update MPASS definition commentary We now have a detailed man page describing both MPASS and KASSERT. Give a warning that careless use of MPASS can result in inadequate assertion messages, and point to the MPASS(9) page which describes this. While here add a comment above the KASSERT definitions pointing to the man page. Suggested by: bz Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44438 --- sys/sys/kassert.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h index 25e2b025a11a..ab2313bcbd8b 100644 --- a/sys/sys/kassert.h +++ b/sys/sys/kassert.h @@ -142,6 +142,9 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); # endif /* defined(WITNESS) || defined(INVARIANT_SUPPORT) */ #endif /* _STANDALONE */ +/* + * Kernel assertion; see KASSERT(9) for details. + */ #if (defined(_KERNEL) && defined(INVARIANTS)) || defined(_STANDALONE) #define KASSERT(exp,msg) do { \ if (__predict_false(!(exp))) \ @@ -154,8 +157,11 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); #ifdef _KERNEL /* - * Helpful macros for quickly coming up with assertions with informative - * panic messages. + * Macros for generating panic messages based on the exact condition text. + * + * NOTE: Use these with care, as the resulting message might omit key + * information required to understand the assertion failure. Consult the + * MPASS(9) man page for guidance. */ #define MPASS(ex) MPASS4(ex, #ex, __FILE__, __LINE__) #define MPASS2(ex, what) MPASS4(ex, what, __FILE__, __LINE__)