Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 2: Process Management and Scheduling


.uts_ns = &init_uts_ns, \
.mnt_ns = NULL, \
INIT_NET_NS(net_ns) \
INIT_IPC_NS(ipc_ns) \
.user_ns = &init_user_ns, \
}

The UTS Namespace


The UTS namespace can be handled with particularly little effort because it only has to manage simple
quantities and does not require a hierarchical organization. All relevant information is collected in an
instance of the following structure:

<utsname.h>
struct uts_namespace {
struct kref kref;
struct new_utsname name;
};

krefis an embedded reference counter that can be used to track from how many places in the kernel
an instance ofstruct uts_namespaceis used (recall that Chapter 1 provides more information about
the generic framework to handle reference counting). The information proper is contained instruct
new_utsname:

<utsname.h>
struct new_utsname {
char sysname[65];
char nodename[65];
char release[65];
char version[65];
char machine[65];
char domainname[65];
};

The individual strings store the name of the system (Linux...), the kernel release, the machine
name, and so on. The current values can be determined using theunametool, but are also visible in
/proc/sys/kernel/:

wolfgang@meitner>cat /proc/sys/kernel/ostype
Linux
wolfgang@meitner>cat /proc/sys/kernel/osrelease
2.6.24

The initial settings are stored ininit_uts_ns:

init/version.c
struct uts_namespace init_uts_ns = {
...
.name = {
.sysname = UTS_SYSNAME,
.nodename = UTS_NODENAME,
.release = UTS_RELEASE,
.version = UTS_VERSION,
Free download pdf