From owner-freebsd-questions@freebsd.org Sun Oct 29 10:11:52 2017 Return-Path: Delivered-To: freebsd-questions@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 E510BE5F7A3 for ; Sun, 29 Oct 2017 10:11:52 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.117.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.infracaninophile.co.uk", Issuer "infracaninophile.co.uk" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 740A474233 for ; Sun, 29 Oct 2017 10:11:52 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from liminal.local (unknown [IPv6:2001:8b0:151:1:9983:5355:d9d6:f6f3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: m.seaman@infracaninophile.co.uk) by smtp.infracaninophile.co.uk (Postfix) with ESMTPSA id 671B01FE3 for ; Sun, 29 Oct 2017 10:11:43 +0000 (UTC) Authentication-Results: smtp.infracaninophile.co.uk; dmarc=none (p=none dis=none) header.from=FreeBSD.org Subject: Re: FreeBSD Kernel Question To: freebsd-questions@freebsd.org References: From: Matthew Seaman Message-ID: <02ca2e5c-c604-2182-3e05-dcda3cdfb4db@FreeBSD.org> Date: Sun, 29 Oct 2017 10:11:35 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1uSg05g7XguwjxLRjfmxFAd4g3M0j55bF" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Oct 2017 10:11:53 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1uSg05g7XguwjxLRjfmxFAd4g3M0j55bF Content-Type: multipart/mixed; boundary="QHHL2GAV7n6AmopF4lPKItO7WUWK260ta"; protected-headers="v1" From: Matthew Seaman To: freebsd-questions@freebsd.org Message-ID: <02ca2e5c-c604-2182-3e05-dcda3cdfb4db@FreeBSD.org> Subject: Re: FreeBSD Kernel Question References: In-Reply-To: --QHHL2GAV7n6AmopF4lPKItO7WUWK260ta Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable On 29/10/2017 09:03, =E9=A2=9C=E5=9F=BA=E5=B1=B9 wrote: > Hello! I would like to know how to provide an API in the kernel space = to > user space.Such As 'printf'. How to do this depends very much on the specifics of what you want to do.= If what you want is to expose some kernel memory structure or data so that it can be queried from userland, then a common mechanism is sysctl(3). There are also mechanisms commonly used for debugging and performance monitoring, such as dtrace(1) and pmcstat(8). You can also log events via syslog or by writing to the kernel message buffer -- see dmesg(8). Otherwise, look at devd(8) and devctl(4) for a mechanism to trigger actions in userland when certain kernel events happen, such as plugging in a new device. The best place to get answers for these sort of questions about kernel development is the freebsd-hackers@freebsd.org mailing list, as that will come to the attention of many of the kernel developers. Cheers, Matthew --QHHL2GAV7n6AmopF4lPKItO7WUWK260ta-- --1uSg05g7XguwjxLRjfmxFAd4g3M0j55bF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQJ8BAEBCgBmBQJZ9alfXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkATxfcQAKR1+C3UzqYJKoKOsntDqgX2 FNxD5opNCI5v6RoBfe+nH9Q6G84brBkBZSx7mWbyB8PtzZOW7oNFQpwWzpJVycTk NKYIwVLFxBn1Wo2zEBgtVYzEW+UwqWq80xq+2l/KTNs9TV5xPXk1+9R62MenyDbq jTXknpAWSFCnhlgd9bBN5E6N5mkSeGLZ1dclDGGtASzFh0o8LFYbATCtzqdl2Fyo UCM9m0I7G+sUYMxFa7mTMDFbDlVTyZcjQyZKvNj9mpyybq5uYZaSjlRRJY8AsR0a H3VdRxhOZu7e/6nGQfI85T0ex9Yt68Y7AhrrCLxcrBu1j6L3KhFw5QPPzj5/Jk5f sc3eqVZ9xudHblfzmc6QVVwtdlHNj1LUHbmeWMRWVzRJahK+Q7y1CF/gGPBreEUZ xIcM5rKDcJjoewsoiyV/l2SXFhXL5RZ7AoeUUN8sYdZu+srhl2iQFh902TdloFFt NXzRT3JUyWhYmCyoxp+YAbJ5umL+9mmFIHgakZYyDOj19TA52xpIHyxkeOdRE3aX obi8E/RSDSOwpIeqpDhpXiqAgc+GD3iVphqlrc9WSaGCS2PXU4Aa4ge+pCI64sWy gB4TzZne79hchn9nlpKxLffIgvnSuYZ3klKURdaJHX82LRE+kk2jjcc+h153mGvb f/Wytj2WVRYTX6EhJ7Ja =oZMA -----END PGP SIGNATURE----- --1uSg05g7XguwjxLRjfmxFAd4g3M0j55bF--