kern_mib.c (34086d5bda29cc583755fc8948f59c3b61f8ce7d) | kern_mib.c (3da4d19be4131b6b6e45d80e5d83e9b508cb064b) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Mike Karels at Berkeley Software Design, Inc. --- 41 unchanged lines hidden (view full) --- 50#include <sys/limits.h> 51#include <sys/lock.h> 52#include <sys/mutex.h> 53#include <sys/proc.h> 54#include <sys/random.h> 55#include <sys/sbuf.h> 56#include <sys/smp.h> 57#include <sys/sx.h> | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Mike Karels at Berkeley Software Design, Inc. --- 41 unchanged lines hidden (view full) --- 50#include <sys/limits.h> 51#include <sys/lock.h> 52#include <sys/mutex.h> 53#include <sys/proc.h> 54#include <sys/random.h> 55#include <sys/sbuf.h> 56#include <sys/smp.h> 57#include <sys/sx.h> |
58#include <sys/sysent.h> |
|
58#include <sys/vmmeter.h> 59#include <sys/sysctl.h> 60#include <sys/systm.h> 61#include <sys/unistd.h> 62 63SYSCTL_ROOT_NODE(0, sysctl, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 64 "Sysctl internal magic"); 65SYSCTL_ROOT_NODE(CTL_KERN, kern, CTLFLAG_RW | CTLFLAG_CAPRD | CTLFLAG_MPSAFE, 0, --- 181 unchanged lines hidden (view full) --- 247 error = SYSCTL_OUT(req, pagesizes, sizeof(pagesizes)); 248 return (error); 249} 250SYSCTL_PROC(_hw, OID_AUTO, pagesizes, 251 CTLTYPE_ULONG | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, 252 sysctl_hw_pagesizes, "LU", 253 "Supported page sizes"); 254 | 59#include <sys/vmmeter.h> 60#include <sys/sysctl.h> 61#include <sys/systm.h> 62#include <sys/unistd.h> 63 64SYSCTL_ROOT_NODE(0, sysctl, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 65 "Sysctl internal magic"); 66SYSCTL_ROOT_NODE(CTL_KERN, kern, CTLFLAG_RW | CTLFLAG_CAPRD | CTLFLAG_MPSAFE, 0, --- 181 unchanged lines hidden (view full) --- 248 error = SYSCTL_OUT(req, pagesizes, sizeof(pagesizes)); 249 return (error); 250} 251SYSCTL_PROC(_hw, OID_AUTO, pagesizes, 252 CTLTYPE_ULONG | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, 253 sysctl_hw_pagesizes, "LU", 254 "Supported page sizes"); 255 |
255#ifdef SCTL_MASK32 | |
256int adaptive_machine_arch = 1; 257SYSCTL_INT(_debug, OID_AUTO, adaptive_machine_arch, CTLFLAG_RW, 258 &adaptive_machine_arch, 1, 259 "Adapt reported machine architecture to the ABI of the binary"); | 256int adaptive_machine_arch = 1; 257SYSCTL_INT(_debug, OID_AUTO, adaptive_machine_arch, CTLFLAG_RW, 258 &adaptive_machine_arch, 1, 259 "Adapt reported machine architecture to the ABI of the binary"); |
260 261static const char * 262proc_machine_arch(struct proc *p) 263{ 264 265 if (p->p_sysent->sv_machine_arch != NULL) 266 return (p->p_sysent->sv_machine_arch(p)); 267#ifdef COMPAT_FREEBSD32 268 if (SV_PROC_FLAG(p, SV_ILP32)) 269 return (MACHINE_ARCH32); |
|
260#endif | 270#endif |
271 return (MACHINE_ARCH); 272} |
|
261 262static int 263sysctl_hw_machine_arch(SYSCTL_HANDLER_ARGS) 264{ | 273 274static int 275sysctl_hw_machine_arch(SYSCTL_HANDLER_ARGS) 276{ |
265 int error; 266 static const char machine_arch[] = MACHINE_ARCH; 267#ifdef SCTL_MASK32 268 static const char machine_arch32[] = MACHINE_ARCH32; | 277 const char *machine_arch; |
269 | 278 |
270 if ((req->flags & SCTL_MASK32) != 0 && adaptive_machine_arch) 271 error = SYSCTL_OUT(req, machine_arch32, sizeof(machine_arch32)); | 279 if (adaptive_machine_arch) 280 machine_arch = proc_machine_arch(curproc); |
272 else | 281 else |
273#endif 274 error = SYSCTL_OUT(req, machine_arch, sizeof(machine_arch)); 275 return (error); 276 | 282 machine_arch = MACHINE_ARCH; 283 return (SYSCTL_OUT(req, machine_arch, strlen(machine_arch) + 1)); |
277} 278SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD | 279 CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A", 280 "System architecture"); 281 | 284} 285SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD | 286 CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A", 287 "System architecture"); 288 |
282SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, | 289#ifndef MACHINE_ARCHES |
283#ifdef COMPAT_FREEBSD32 | 290#ifdef COMPAT_FREEBSD32 |
284 MACHINE_ARCH " " MACHINE_ARCH32, 0, "Supported architectures for binaries"); | 291#define MACHINE_ARCHES MACHINE_ARCH " " MACHINE_ARCH32 |
285#else | 292#else |
286 MACHINE_ARCH, 0, "Supported architectures for binaries"); | 293#define MACHINE_ARCHES MACHINE_ARCH |
287#endif | 294#endif |
295#endif |
|
288 | 296 |
297SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, 298 MACHINE_ARCHES, 0, "Supported architectures for binaries"); 299 |
|
289static int 290sysctl_hostname(SYSCTL_HANDLER_ARGS) 291{ 292 struct prison *pr, *cpr; 293 size_t pr_offset; 294 char tmpname[MAXHOSTNAMELEN]; 295 int descend, error, len; 296 --- 394 unchanged lines hidden --- | 300static int 301sysctl_hostname(SYSCTL_HANDLER_ARGS) 302{ 303 struct prison *pr, *cpr; 304 size_t pr_offset; 305 char tmpname[MAXHOSTNAMELEN]; 306 int descend, error, len; 307 --- 394 unchanged lines hidden --- |