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
--- 23 unchanged lines hidden (view full) ---
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
40 * $FreeBSD: head/sys/kern/kern_mib.c 52128 1999-10-11 15:19:12Z peter $
41 */
42
43#include <sys/param.h>
44#include <sys/kernel.h>
45#include <sys/systm.h>
46#include <sys/sysctl.h>
47#include <sys/proc.h>
48#include <sys/jail.h>
--- 91 unchanged lines hidden (view full) ---
140
141SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
142 0, PAGE_SIZE, "System memory page size");
143
144static char machine_arch[] = MACHINE_ARCH;
145SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
146 machine_arch, 0, "System architecture");
147
148char hostname[MAXHOSTNAMELEN];
149
150static int
151sysctl_hostname SYSCTL_HANDLER_ARGS
152{
153 int error;
154
155 if (req->p->p_prison)
156 error = sysctl_handle_string(oidp,
157 req->p->p_prison->pr_host,
158 sizeof req->p->p_prison->pr_host, req);
159 else
160 error = sysctl_handle_string(oidp,
161 hostname, sizeof hostname, req);
162 return (error);
163}
164
165SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
166 CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON,
167 0, 0, sysctl_hostname, "A", "Hostname");
--- 85 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
--- 23 unchanged lines hidden (view full) ---
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
40 * $FreeBSD: head/sys/kern/kern_mib.c 52128 1999-10-11 15:19:12Z peter $
41 */
42
43#include <sys/param.h>
44#include <sys/kernel.h>
45#include <sys/systm.h>
46#include <sys/sysctl.h>
47#include <sys/proc.h>
48#include <sys/jail.h>
--- 91 unchanged lines hidden (view full) ---
140
141SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
142 0, PAGE_SIZE, "System memory page size");
143
144static char machine_arch[] = MACHINE_ARCH;
145SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
146 machine_arch, 0, "System architecture");
147
148char hostname[MAXHOSTNAMELEN];
149
150static int
151sysctl_hostname SYSCTL_HANDLER_ARGS
152{
153 int error;
154
155 if (req->p->p_prison)
156 error = sysctl_handle_string(oidp,
157 req->p->p_prison->pr_host,
158 sizeof req->p->p_prison->pr_host, req);
159 else
160 error = sysctl_handle_string(oidp,
161 hostname, sizeof hostname, req);
162 return (error);
163}
164
165SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
166 CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON,
167 0, 0, sysctl_hostname, "A", "Hostname");
--- 85 unchanged lines hidden ---