home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeMac OS X for Unix GeeksSearch this book

8.2. Kernel Utilities

Mac OS X includes various utilities that interact with the kernel. With these utilities, you can debug a running kernel, load and unload kernel modules or extensions, or set kernel variables.

8.2.3. sysctl

sysctl is a standard BSD facility for configuring kernel state variables. Use sysctl name to display a variable name, as in sysctl kern.ostype. Use sysctl -a to display all variables. You can set a variable with sysctl -w name=value. You must have superuser privileges to set a variable.

Table 8-6 lists the sysctl variables on Mac OS X. See the sysctl(3) manpage for a description of the sysctl system call and more detailed information on the kernel state variables.

Table 8-6. sysctl's kernel state variables

Name

Type

Writable

Description

hw.busfrequency

int
no

Bus frequency in hertz. Divide by one million to get a megahertz figure.

hw.byteorder

int
no

Variable that returns 4321, showing the ordering of four bytes on the PowerPC platform.

hw.cachelinesize

int
no

The cache line size in bytes.

hw.cpufrequency

int
no

CPU frequency in hertz. Divide by one million to get a megahertz figure.

hw.epoch

int
no

Variable that indicates whether your hardware is in the New World or the Old World. Old World Macintoshes (pre-G3) will have a value of 0.

hw.l1dcachesize

int
no

Level 1 data cache size in bytes.

hw.l1icachesize

int
no

Level 1 instruction cache size in bytes.

hw.l2cachesize

int
no

Level 2 cache size in bytes.

hw.l2settings

int
no

Level 2 cache settings.

hw.l3cachesize

int
no

Level 3 cache size in bytes.

hw.l3settings

int
no

Level 3 cache settings.

hw.machine

string
no

Machine class (Power Macintosh on most systems).

hw.model

string
no

Machine model.

hw.ncpu

int
no

Number of CPUs.

hw.pagesize

int
no

Software page size in bytes.

hw.physmem

int
no

Physical memory in bytes.

hw.usermem

int
no

Non-kernel memory.

hw.vectorunit

int
no

Variable that indicates whether you are running on an AltiVec-enabled CPU.

kern.argmax

int
no

Maximum number of arguments supported by exec( ).

kern.boottime

struct timeval
no

The time when the system was booted.

kern.clockrate

struct clockinfo
no

System clock timings.

kern.dummy

n/a
n/a

Unused.

kern.hostid

int
yes

Host identifier.

kern.hostname

string
yes

Hostname.

kern.job_control

int
no

Variable that indicates whether job control is available.

kern.maxfiles

int
yes

Maximum number of open files.

kern.maxproc

int
yes

Maximum number of simultaneous processes.

kern.maxvnodes

int
yes

Maximum number of vnodes.

kern.ngroups

int
no

Maximum number of supplemental groups.

kern.netboot

int
no

Variable that indicates whether the system booted via NetBoot.

kern.nisdomainname

string
yes

NIS domain name.

kern.osrelease

string
no

Operating system release version.

kern.osrevision

int
no

Operating system revision.

kern.ostype

string
no

Operating system name.

kern.posix1version

int
no

The version of POSIX 1003.1 with which the system attempts to comply.

kern.saved_ids

int
no

This is set to 1 if saved set-group and set-user IDs are available.

kern.securelevel

int
increment only

The system security level.

kern.symfile

string
no

The kernel symbol file.

kern.sysv.shmmax

int
yes

The maximum number of shared memory pages.

kern.sysv.shmmin

int
yes

The maximum number of shared memory segments per process.

kern.sysv.shmmni

int
yes

The maximum number of shared memory segments.

kern.sysv.shmseg

int
yes

The minimum size of a shared memory segment.

kern.sysv.shmall

int
yes

The maximum size of a shared memory segment.

kern.version

string
no

The kernel version string.

net.inet.*

various
n/a

IPv4 settings.

net.key.*

various
n/a

IPSec key management settings.

net.inet6.*

various
n/a

IPv6 settings.

user.bc_base_max

int
no

Maximum ibase/obase available in the bc calculator.

user.bc_dim_max

int
no

Maximum array size available in the bc calculator.

user.bc_scale_max

int
no

Maximum scale value available in the bc calculator.

user.bc_string_max

int
no

Maximum string length available in the bc calculator.

user.coll_weights_max

int
no

Maximum number of weights that can be used with LC_COLLATE in the locale definition file.

user.cs_path

string
no

Value for PATH that can find all the standard utilities.

user.expr_nest_max

int
no

Maximum number of expressions you can nest within parentheses using expr.

user.line_max

int
no

Maximum length in bytes of an input line used with a text-processing utility.

user.posix2_c_bind

int
no

Variable that returns 1 if the C development environment supports the POSIX C Language Bindings Option; otherwise, the result will be 0.

user.posix2_c_dev

int
no

Variable that returns 1 if the C development environment supports the POSIX C Language Development Utilities Option; otherwise, the result will be 0.

user.posix2_char_term

int
no

Variable that returns 1 if the systems supports at least one terminal type specified in POSIX 1003.2; otherwise, the result will be 0.

user.posix2_fort_dev

int
no

Variable that returns 1 if the system supports the POSIX FORTRAN Development Utilities Option; otherwise, the result will be 0.

user.posix2_fort_run

int
no

Variable that returns 1 if the system supports the POSIX FORTRAN Runtime Utilities Option; otherwise, the result will be 0.

user.posix2_localedef

int
no

Variable that returns 1 if the system allows you to create locale; otherwise, the result will be 0.

user.posix2_sw_dev

int
no

Variable that returns 1 if the system supports the POSIX Software Development Utilities Option; otherwise, the result will be 0.

user.posix2_upe

int
no

Variable that returns 1 if the system supports the POSIX User Portable Utilities Option; otherwise, the result will be 0.

user.posix2_version

int
no

Variable that returns the POSIX 1003.2 version with which the system attempts to comply.

user.re_dup_max

int
no

Maximum repeated occurrences of a regular expression when using interval notation.

user.stream_max

int
no

Maximum number of streams a process may have open.

user.tzname_max

int
no

Maximum number of types supported for a time zone name.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.