1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Mike Karels at Berkeley Software Design, Inc.
7 *
8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD
--- 22 unchanged lines hidden (view full) ---
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/kern/kern_mib.c 169727 2007-05-19 04:53:14Z kan $");
40
41#include "opt_posix.h"
42#include "opt_config.h"
43
44#include <sys/param.h>
45#include <sys/kernel.h>
46#include <sys/sbuf.h>
47#include <sys/systm.h>
--- 263 unchanged lines hidden (view full) ---
311
312#ifdef INCLUDE_CONFIG_FILE
313/* Actual kernel configuration options. */
314extern char kernconfstring[];
315
316static int
317sysctl_kern_config(SYSCTL_HANDLER_ARGS)
318{
319 struct sbuf *sb;
320 int error;
321 char *p;
322
323 sb = sbuf_new(NULL, NULL, 2048, SBUF_AUTOEXTEND);
324 if (sb == NULL)
325 return (ENOMEM);
326 sbuf_clear(sb);
327 p = kernconfstring;
328 if (p == NULL || *p == '\0') {
329 sbuf_printf(sb, "No kernel configuration\n");
330 } else {
331 sbuf_printf(sb, "%s", p);
332 }
333 sbuf_trim(sb);
334 sbuf_putc(sb, '\n');
335 sbuf_finish(sb);
336 error = sysctl_handle_string(oidp, sbuf_data(sb), sbuf_len(sb), req);
337 if (error)
338 return (error);
339 sbuf_delete(sb);
340 return (error);
341}
342SYSCTL_PROC(_kern, OID_AUTO, conftxt, CTLTYPE_STRING|CTLFLAG_RW,
343 0, 0, sysctl_kern_config, "", "Kernel configuration file");
344#endif
345
346char domainname[MAXHOSTNAMELEN];
347SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW,
348 &domainname, sizeof(domainname), "Name of the current YP/NIS domain");
349
--- 76 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Mike Karels at Berkeley Software Design, Inc.
7 *
8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD
--- 22 unchanged lines hidden (view full) ---
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/kern/kern_mib.c 169727 2007-05-19 04:53:14Z kan $");
40
41#include "opt_posix.h"
42#include "opt_config.h"
43
44#include <sys/param.h>
45#include <sys/kernel.h>
46#include <sys/sbuf.h>
47#include <sys/systm.h>
--- 263 unchanged lines hidden (view full) ---
311
312#ifdef INCLUDE_CONFIG_FILE
313/* Actual kernel configuration options. */
314extern char kernconfstring[];
315
316static int
317sysctl_kern_config(SYSCTL_HANDLER_ARGS)
318{
319 struct sbuf *sb;
320 int error;
321 char *p;
322
323 sb = sbuf_new(NULL, NULL, 2048, SBUF_AUTOEXTEND);
324 if (sb == NULL)
325 return (ENOMEM);
326 sbuf_clear(sb);
327 p = kernconfstring;
328 if (p == NULL || *p == '\0') {
329 sbuf_printf(sb, "No kernel configuration\n");
330 } else {
331 sbuf_printf(sb, "%s", p);
332 }
333 sbuf_trim(sb);
334 sbuf_putc(sb, '\n');
335 sbuf_finish(sb);
336 error = sysctl_handle_string(oidp, sbuf_data(sb), sbuf_len(sb), req);
337 if (error)
338 return (error);
339 sbuf_delete(sb);
340 return (error);
341}
342SYSCTL_PROC(_kern, OID_AUTO, conftxt, CTLTYPE_STRING|CTLFLAG_RW,
343 0, 0, sysctl_kern_config, "", "Kernel configuration file");
344#endif
345
346char domainname[MAXHOSTNAMELEN];
347SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW,
348 &domainname, sizeof(domainname), "Name of the current YP/NIS domain");
349
--- 76 unchanged lines hidden ---