Bug 221853 - sysctl_(add|register)_oid(): Prefix log messages with the function name
Summary: sysctl_(add|register)_oid(): Prefix log messages with the function name
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Conrad Meyer
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-08-27 10:33 UTC by Fabian Keil
Modified: 2025-01-28 15:28 UTC (History)
0 users

See Also:
cem: mfc-stable11-


Attachments
sysctl_(add|register)_oid(): Prefix log message with the function name (1.55 KB, patch)
2017-08-27 10:33 UTC, Fabian Keil
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Keil 2017-08-27 10:33:26 UTC
Created attachment 185809 [details]
sysctl_(add|register)_oid(): Prefix log message with the function name

The attached patch prefixes the "can't re-use a leaf ..." messages
emitted by sysctl_add_oid() and sysctl_register_oid() with the
name of the function.

This makes it more obvious that the messages are sysctl related
and which of the two functions emitted them.

Without the patch the messages look like:

kernel: can't re-use a leaf (delete_max)!
kernel: can't re-use a leaf (minimum_cmd_size)!
kernel: can't re-use a leaf (zone_mode)!
kernel: can't re-use a leaf (zone_support)!
kernel: can't re-use a leaf (optimal_seq_zones)!

Obtained from: ElectroBSD
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-08-27 17:13:23 UTC
A commit references this bug:

Author: cem
Date: Sun Aug 27 17:12:31 UTC 2017
New revision: 322954
URL: https://svnweb.freebsd.org/changeset/base/322954

Log:
  Enhance debugibility of sysctl leaf re-use warnings

  Print the full conflicting oid path, and include the function name in the
  warning so it is clear that the warnings are sysctl-related.

  PR:		221853
  Submitted by:	Fabian Keil <fk AT fabiankeil.de> (earlier version)
  Sponsored by:	Dell EMC Isilon

Changes:
  head/sys/kern/kern_sysctl.c
Comment 2 Fabian Keil 2017-08-29 15:08:21 UTC
Thanks for adding the whole oid path.
Comment 3 Conrad Meyer freebsd_committer freebsd_triage 2017-08-29 15:35:10 UTC
No problem!  It's always something I've wanted to have when I see those error messages.
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-01-25 18:01:07 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=faa845aab6113190ba8c75a171b2cca8673a6214

commit faa845aab6113190ba8c75a171b2cca8673a6214
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-01-25 17:59:33 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-01-25 17:59:33 +0000

    kern_sysctl: Fix printing function name in the re-use sysctl leaf warning

    The helper function sysctl_warn_reuse() is intended to print the name of
    the caller rather than that of itself.

    PR:     221853
    Fixes:  4ae2ade11426 Enhance debugibility of sysctl leaf re-use warnings
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D48645

 sys/kern/kern_sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-01-28 15:24:15 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=719fb5a37731f6e69f2ba2b67fb3e19f2f007100

commit 719fb5a37731f6e69f2ba2b67fb3e19f2f007100
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-01-25 17:59:33 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-01-28 15:22:15 +0000

    kern_sysctl: Fix printing function name in the re-use sysctl leaf warning

    The helper function sysctl_warn_reuse() is intended to print the name of
    the caller rather than that of itself.

    PR:     221853
    Fixes:  4ae2ade11426 Enhance debugibility of sysctl leaf re-use warnings
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D48645

    (cherry picked from commit faa845aab6113190ba8c75a171b2cca8673a6214)

 sys/kern/kern_sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-01-28 15:28:17 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=477403117f06ce5b1de006925fc35d1fbec8dc76

commit 477403117f06ce5b1de006925fc35d1fbec8dc76
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-01-25 17:59:33 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-01-28 15:26:49 +0000

    kern_sysctl: Fix printing function name in the re-use sysctl leaf warning

    The helper function sysctl_warn_reuse() is intended to print the name of
    the caller rather than that of itself.

    PR:     221853
    Fixes:  4ae2ade11426 Enhance debugibility of sysctl leaf re-use warnings
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D48645

    (cherry picked from commit faa845aab6113190ba8c75a171b2cca8673a6214)
    (cherry picked from commit 719fb5a37731f6e69f2ba2b67fb3e19f2f007100)

 sys/kern/kern_sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)