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 57111 2000-02-10 05:32:03Z rwatson $ |
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 |
148static int jailcansethostname=1; 149SYSCTL_INT(_kern, KERN_JAILCANSETHOSTNAME, jailcansethostname, 150 CTLFLAG_RW, &jailcansethostname, 0, 151 "Jail can set its hostname"); 152 |
153char hostname[MAXHOSTNAMELEN]; 154 155static int 156sysctl_hostname SYSCTL_HANDLER_ARGS 157{ 158 int error; 159 |
160 if (req->p->p_prison) { 161 if (!jailcansethostname) 162 return(EPERM); |
163 error = sysctl_handle_string(oidp, 164 req->p->p_prison->pr_host, 165 sizeof req->p->p_prison->pr_host, req); |
166 } else |
167 error = sysctl_handle_string(oidp, 168 hostname, sizeof hostname, req); 169 return (error); 170} 171 172SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname, 173 CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON, 174 0, 0, sysctl_hostname, "A", "Hostname"); --- 85 unchanged lines hidden --- |