Bug 204140

Summary: ZFS's dsl_pool.c and spa_misc.c leak FreeBSD-specific kernel routines into userland libraries
Product: Base System Reporter: Enji Cooper <ngie>
Component: binAssignee: freebsd-fs (Nobody) <fs>
Status: Closed FIXED    
Severity: Affects Some People CC: avg, delphij, emaste, smh, will
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Enji Cooper freebsd_committer freebsd_triage 2015-10-30 07:17:40 UTC
/scratch/tmp/ngie/svn/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c: In function 'sysctl_zfs_dirty_data_max_percent':
/scratch/tmp/ngie/svn/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c:179: warning: implicit declaration of function 'sysctl_handle_int'
/scratch/tmp/ngie/svn/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c: In function 'sysctl_vfs_zfs_debug_flags':
/scratch/tmp/ngie/svn/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c:267: warning: implicit declaration of function 'sysctl_handle_int'

Spotted this while running make tinderbox on ref11-amd64.freebsd.org. The functions probably should only be exposed on FreeBSD and only when !_KERNEL.
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2015-10-30 07:18:52 UTC
(In reply to NGie Cooper from comment #0)

Also, there's the obvious "missing #include <sys/sysctl.h>" in the source files.
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-04-11 13:17:43 UTC
A commit references this bug:

Author: smh
Date: Mon Apr 11 13:17:12 UTC 2016
New revision: 297819
URL: https://svnweb.freebsd.org/changeset/base/297819

Log:
  Only include sysctl in kernel build

  Only include sysctl in kernel builds fixing warning about implicit
  declaration of function 'sysctl_handle_int'.

  PR:		204140
  MFC after:	1 week
  X-MFC-With:	r297813
  Sponsored by:	Multiplay

Changes:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-01-13 07:18:42 UTC
A commit references this bug:

Author: cy
Date: Sat Jan 13 07:18:02 UTC 2018
New revision: 458892
URL: https://svnweb.freebsd.org/changeset/ports/458892

Log:
  Fix build with OPENLDAP and gdbm-compatibility.

  PR:		204140, 207687
  Submitted by:	Lawrence Chen <beastie@tardisi.com>

Changes:
  head/sysutils/am-utils/Makefile
  head/sysutils/am-utils/files/patch-configure.ac
  head/sysutils/am-utils/pkg-plist