13040Swollman/*
23040Swollman * Copyright (c) 1989, 1993
33040Swollman *	The Regents of the University of California.  All rights reserved.
43040Swollman *
53040Swollman * Redistribution and use in source and binary forms, with or without
63040Swollman * modification, are permitted provided that the following conditions
73040Swollman * are met:
83040Swollman * 1. Redistributions of source code must retain the above copyright
93040Swollman *    notice, this list of conditions and the following disclaimer.
103040Swollman * 2. Redistributions in binary form must reproduce the above copyright
113040Swollman *    notice, this list of conditions and the following disclaimer in the
123040Swollman *    documentation and/or other materials provided with the distribution.
133040Swollman * 4. Neither the name of the University nor the names of its contributors
143040Swollman *    may be used to endorse or promote products derived from this software
153040Swollman *    without specific prior written permission.
163040Swollman *
173040Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
183040Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
193040Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
203040Swollman * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
213040Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
223040Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
233040Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
243040Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
253040Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
263040Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
273040Swollman * SUCH DAMAGE.
283040Swollman */
293040Swollman
303040Swollman#if defined(LIBC_SCCS) && !defined(lint)
3190039Sobrienstatic char sccsid[] = "From: @(#)gethostname.c	8.1 (Berkeley) 6/4/93";
323040Swollman#endif /* LIBC_SCCS and not lint */
3390039Sobrien#include <sys/cdefs.h>
3490039Sobrien__FBSDID("$FreeBSD$");
353040Swollman
363040Swollman#include <sys/param.h>
373040Swollman#include <sys/sysctl.h>
383040Swollman
39145829Sdelphij#include <paths.h>
40145829Sdelphij
413040Swollmanconst char *
423040Swollmangetbootfile(void)
433040Swollman{
443040Swollman	static char name[MAXPATHLEN];
453040Swollman	size_t size = sizeof name;
463040Swollman	int mib[2];
473040Swollman
483040Swollman	mib[0] = CTL_KERN;
493040Swollman	mib[1] = KERN_BOOTFILE;
503040Swollman	if (sysctl(mib, 2, name, &size, NULL, 0) == -1)
51113362Stjr		return ("/boot/kernel/kernel");
523040Swollman	return (name);
533040Swollman}
54