<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Xemul</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Xemul"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Xemul"/>
	<updated>2026-05-20T15:37:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Xemul&amp;diff=17532</id>
		<title>User:Xemul</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Xemul&amp;diff=17532"/>
		<updated>2015-09-03T13:07:59Z</updated>

		<summary type="html">&lt;p&gt;Xemul: add photo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Биография: Архитектор в команде Odin Server Virtualization, идейный вдохновитель проекта CRIU. В компании Parallels с 2004 года, начинал в группе разработки ядра Linux, которую затем возглавил. Сейчас занимается архитектурными вопросами в команде серверной виртуализации.&lt;br /&gt;
&lt;br /&gt;
Bio: Architect in Odin Server Virtualization team, creator and maintainer of the CRIU project. Joined Parallels in 2004 as junior Linux kernel developer, later became kernel team leader. Now works on architecture of the Odin Server products.&lt;br /&gt;
&lt;br /&gt;
[[Image:Xemul.jpg|left|80px]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=File:Xemul.jpg&amp;diff=17531</id>
		<title>File:Xemul.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=File:Xemul.jpg&amp;diff=17531"/>
		<updated>2015-09-03T13:07:45Z</updated>

		<summary type="html">&lt;p&gt;Xemul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Xemul&amp;diff=17530</id>
		<title>User:Xemul</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Xemul&amp;diff=17530"/>
		<updated>2015-09-03T13:06:53Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Created page with &amp;quot;Биография: Архитектор в команде Odin Server Virtualization, идейный вдохновитель проекта CRIU. В компании Paralle...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Биография: Архитектор в команде Odin Server Virtualization, идейный вдохновитель проекта CRIU. В компании Parallels с 2004 года, начинал в группе разработки ядра Linux, которую затем возглавил. Сейчас занимается архитектурными вопросами в команде серверной виртуализации.&lt;br /&gt;
&lt;br /&gt;
Bio: Architect in Odin Server Virtualization team, creator and maintainer of the CRIU project. Joined Parallels in 2004 as junior Linux kernel developer, later became kernel team leader. Now works on architecture of the Odin Server products.&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=LibCT&amp;diff=15292</id>
		<title>LibCT</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=LibCT&amp;diff=15292"/>
		<updated>2014-05-14T21:18:21Z</updated>

		<summary type="html">&lt;p&gt;Xemul: + two more backends&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Requirements ==&lt;br /&gt;
* C/C++ bindings (for Parallels SDK)&lt;br /&gt;
* Python bindings (for OpenStack)&lt;br /&gt;
** Might make sence to write Python code that just goes via RPC&lt;br /&gt;
* Fine grained support for namespaces and cgroups&lt;br /&gt;
* Extendable support for different private FS&lt;br /&gt;
* Extendable support for different NICs&lt;br /&gt;
* Support for external bind mounts&lt;br /&gt;
* Ability to enter a CT&lt;br /&gt;
* Ability to configure running CT&lt;br /&gt;
* Integration with CRIU for checkpointing&lt;br /&gt;
* Integration with CRIU for migration&lt;br /&gt;
* Ability to operate on remote host&lt;br /&gt;
* Ability to be used by non-root App&lt;br /&gt;
* Ability to resurrect after sudden App crash&lt;br /&gt;
* Ability to work on OpenVZ kernel (backend)&lt;br /&gt;
* Ability to run libct supporting tools on older (OpenVZ) kernels (depends on above)&lt;br /&gt;
* Integration with Docker libcontainer to give any container system implementing the ability to deploy docker packages&lt;br /&gt;
* Backend for Solaris Zones and probably Virtuozzo Windows Containers&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=LibCT&amp;diff=15291</id>
		<title>LibCT</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=LibCT&amp;diff=15291"/>
		<updated>2014-05-14T21:08:09Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Idea how to do python&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Requirements ==&lt;br /&gt;
* C/C++ bindings (for Parallels SDK)&lt;br /&gt;
* Python bindings (for OpenStack)&lt;br /&gt;
** Might make sence to write Python code that just goes via RPC&lt;br /&gt;
* Fine grained support for namespaces and cgroups&lt;br /&gt;
* Extendable support for different private FS&lt;br /&gt;
* Extendable support for different NICs&lt;br /&gt;
* Support for external bind mounts&lt;br /&gt;
* Ability to enter a CT&lt;br /&gt;
* Ability to configure running CT&lt;br /&gt;
* Integration with CRIU for checkpointing&lt;br /&gt;
* Integration with CRIU for migration&lt;br /&gt;
* Ability to operate on remote host&lt;br /&gt;
* Ability to be used by non-root App&lt;br /&gt;
* Ability to resurrect after sudden App crash&lt;br /&gt;
* Ability to work on OpenVZ kernel (backend)&lt;br /&gt;
* Ability to run libct supporting tools on older (OpenVZ) kernels (depends on above)&lt;br /&gt;
* Integration with Docker libcontainer to give any container system implementing the ability to deploy docker packages&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=LibCT&amp;diff=15290</id>
		<title>LibCT</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=LibCT&amp;diff=15290"/>
		<updated>2014-05-14T21:07:42Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Created and filled Parallels reqs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Requirements ==&lt;br /&gt;
* C/C++ bindings (for Parallels SDK)&lt;br /&gt;
* Python bindings (for OpenStack)&lt;br /&gt;
* Fine grained support for namespaces and cgroups&lt;br /&gt;
* Extendable support for different private FS&lt;br /&gt;
* Extendable support for different NICs&lt;br /&gt;
* Support for external bind mounts&lt;br /&gt;
* Ability to enter a CT&lt;br /&gt;
* Ability to configure running CT&lt;br /&gt;
* Integration with CRIU for checkpointing&lt;br /&gt;
* Integration with CRIU for migration&lt;br /&gt;
* Ability to operate on remote host&lt;br /&gt;
* Ability to be used by non-root App&lt;br /&gt;
* Ability to resurrect after sudden App crash&lt;br /&gt;
* Ability to work on OpenVZ kernel (backend)&lt;br /&gt;
* Ability to run libct supporting tools on older (OpenVZ) kernels (depends on above)&lt;br /&gt;
* Integration with Docker libcontainer to give any container system implementing the ability to deploy docker packages&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8188</id>
		<title>Ubstat system call</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8188"/>
		<updated>2010-02-08T09:08:53Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Fixed contents structure... again :\&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes an interesting system call which was designed to pick beancounters statistics.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
The system call appeared in the very first version of the OpenVZ. Its API is rather sloppy, but this is something we have to live with due to backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
The main intention of this system call is to allow a user space process get the beancounters statistics ''periodically''. This statistics includes the fields observed in the &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file and one more field - the so called &amp;lt;code&amp;gt;minheld&amp;lt;/code&amp;gt; value which is opposite to the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; one. As long as exporting the statistics the system call also notifies the task about the desired period has elapsed. The notification is performed by sending a signal to a process and this notification is one-shot.&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
The typical usage of this call is in performing the following steps.&lt;br /&gt;
# Request the amount of resources&lt;br /&gt;
# Get the IDs of all the living beancounters&lt;br /&gt;
# Setup a handler for some signal (e.g. USR1)&lt;br /&gt;
# Perform a system call to setup the notification&lt;br /&gt;
# Go do something (or sleep for ever)&lt;br /&gt;
&lt;br /&gt;
In a signal handler one should just perform a respective system call to get the stats and schedule the next notification (yes, they are performed in one go; see below for more details).&lt;br /&gt;
&lt;br /&gt;
== API ==&lt;br /&gt;
The system call description is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
long ubstat(int func, unsigned long luid, void *notif, void *buf, int size);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The macros and data typed used are declared in &amp;lt;code&amp;gt;include/ub/ub_stat.h&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
=== Arguments description ===&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;''' is like &amp;lt;code&amp;gt;cmd&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; system call. It can be one of&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; to read basic stats for one resource. The desired resource itself should be &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;-ed with the &amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt; to read basic stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt; to read extended stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBLIST&amp;lt;/code&amp;gt; to get the ids of the beancounters&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code&amp;gt; to get the number of resources used by the kernel&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_GETTIME&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See below for what ''basic'' and ''extended'' stats mean.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;luid&amp;lt;/code&amp;gt;''' is the desired beancounter ID. Only one beancounter can be checked at one call.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt;''' is the pointer to a &amp;lt;code&amp;gt;ubnotifrq_t&amp;lt;/code&amp;gt; structure which describes the notification details (see below).&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;''' is the pointer to a chunk of memory, which will contain the data requested.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;''' is the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; memory size.&lt;br /&gt;
&lt;br /&gt;
=== The statistics format ===&lt;br /&gt;
The format of data returned into the buffer depends on the function requested.&lt;br /&gt;
&lt;br /&gt;
'''1. &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[1];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the time period for which the stats are returned and the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; for the resource.&lt;br /&gt;
&lt;br /&gt;
'''2. &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the same info as the &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; does, but for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''3. &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   barrier;&lt;br /&gt;
                unsigned long   limit;&lt;br /&gt;
                unsigned long   held;&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   minheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
                unsigned long __unused1;&lt;br /&gt;
                unsigned long __unused2;&lt;br /&gt;
       } ubstatparmf_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the extended info for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''4. UBSTAT_UBLIST''' treats the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; to point to the &amp;lt;code&amp;gt;unsigned long&amp;lt;/code&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
'''5. UBSTAT_UBPARMNUM''' ignores the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''6. UBSTAT_GETTIME''' format is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstattime_t    cur_time;&lt;br /&gt;
        };&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It returns the time interval within which the stats are collected and the current time.&lt;br /&gt;
&lt;br /&gt;
All the times used are in seconds.&lt;br /&gt;
&lt;br /&gt;
=== Notification ===&lt;br /&gt;
The notification info is passed via the &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; argument and is being set up for all the functions except the &amp;lt;code&amp;gt;UBLIST&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;UBPARNUM&amp;lt;/code&amp;gt;. The notification is one-shot, but note that once you requested the statistics the next shot is scheduled at the same time.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; should point to&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                long            maxinterval;&lt;br /&gt;
                int             signum;&lt;br /&gt;
        } ubnotifrq_t;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;maxinterval&amp;lt;/code&amp;gt; is the time after which the notification will be delivered. It should be more than 1 (second).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;signum&amp;lt;/code&amp;gt; is the signal that will be sent to notify.&lt;br /&gt;
&lt;br /&gt;
=== Return value ===&lt;br /&gt;
The system call returns -1 in case error has occurred. In case of &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code&amp;gt; it returns &amp;lt;code&amp;gt;UB_RESOURCES&amp;lt;/code&amp;gt; and in all other cases it returns the amount of bytes written to the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
The following program demonstrates how you can (but not should) use the described API. This example is deliberately made very stupid and simple to demonstrate the main idea and will only work on x86_64.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ub_stat.h&amp;gt;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define UBSTAT_BUFSIZE	4096&lt;br /&gt;
#define UBSTAT_NOTIFSIG	SIGUSR1&lt;br /&gt;
#define UB_RESOURCES	24&lt;br /&gt;
&lt;br /&gt;
static char ubstat_buf[UBSTAT_BUFSIZE];&lt;br /&gt;
static int luid, func;&lt;br /&gt;
static ubnotifrq_t notif;&lt;br /&gt;
static void (*print_stat)(void *buf);&lt;br /&gt;
&lt;br /&gt;
#define sys_ubstat(args...)	syscall(503, ## args)&lt;br /&gt;
&lt;br /&gt;
static void usage(void)&lt;br /&gt;
{&lt;br /&gt;
	printf(&amp;quot;ubstat &amp;lt;id&amp;gt; &amp;lt;period&amp;gt; &amp;lt;resource&amp;gt;\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;resource can be either num or:\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-1 for all maxheld and failcnt\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-2 for all at all\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_one(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[1];&lt;br /&gt;
	} *data;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[0].maxheld);&lt;br /&gt;
	printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[0].failcnt);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_all(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;\tmaxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;\tfailcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_full(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;minheld: %lu\n&amp;quot;, data-&amp;gt;param[res].minheld);&lt;br /&gt;
		printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static inline int res2func(int resource)&lt;br /&gt;
{&lt;br /&gt;
	if (resource &amp;gt;= 0) {&lt;br /&gt;
		print_stat = print_stat_one;&lt;br /&gt;
		return UBSTAT_READ_ONE | resource;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -1) {&lt;br /&gt;
		print_stat = print_stat_all;&lt;br /&gt;
		return UBSTAT_READ_ALL;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -2) {&lt;br /&gt;
		print_stat = print_stat_full;&lt;br /&gt;
		return UBSTAT_READ_FULL;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Bad resource %d\n&amp;quot;, resource);&lt;br /&gt;
	exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void do_notify(int x)&lt;br /&gt;
{&lt;br /&gt;
	int err;&lt;br /&gt;
&lt;br /&gt;
	err = sys_ubstat(func, luid, (unsigned long)&amp;amp;notif,&lt;br /&gt;
			ubstat_buf, UBSTAT_BUFSIZE);&lt;br /&gt;
	if (err &amp;lt; 0) {&lt;br /&gt;
		perror(&amp;quot;Can't set stat&amp;quot;);&lt;br /&gt;
		exit(0);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	print_stat(ubstat_buf);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int do_ubstat(int id, int period, int resource)&lt;br /&gt;
{&lt;br /&gt;
	luid = id;&lt;br /&gt;
	func = res2func(resource);&lt;br /&gt;
	notif.maxinterval = period;&lt;br /&gt;
	notif.signum = UBSTAT_NOTIFSIG;&lt;br /&gt;
	signal(UBSTAT_NOTIFSIG, do_notify);&lt;br /&gt;
	do_notify(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
	int id, period, res;&lt;br /&gt;
&lt;br /&gt;
	if (argc == 1) {&lt;br /&gt;
		usage();&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	id = atoi(argv[1]);&lt;br /&gt;
	period = atoi(argv[2]);&lt;br /&gt;
	res = atoi(argv[3]);&lt;br /&gt;
&lt;br /&gt;
	do_ubstat(id, period, res);&lt;br /&gt;
&lt;br /&gt;
	while (1)&lt;br /&gt;
		sleep(10);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation constraints ==&lt;br /&gt;
Unfortunately the API is not architecture independent and thus 32-bit application will simply not work on x86_64.&lt;br /&gt;
&lt;br /&gt;
[[Category:UBC]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8176</id>
		<title>Ubstat system call</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8176"/>
		<updated>2010-02-05T14:20:48Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added the &amp;quot;return value&amp;quot; section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes an interesting system call which was designed to pick beancounters statistics.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
The system call appeared in the very first version of the OpenVZ. Its API is rather sloppy, but this is something we have to live with due to backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
The main intention of this system call is to allow a user space process get the beancounters statistics ''periodically''. This statistics includes the fields observed in the &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file and one more field - the so called &amp;lt;code&amp;gt;minheld&amp;lt;/code&amp;gt; value which is opposite to the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; one. As long as exporting the statistics the system call also notifies the task about the desired period has elapsed. The notification is performed by sending a signal to a process and this notification is one-shot.&lt;br /&gt;
&lt;br /&gt;
= How it works =&lt;br /&gt;
The typical usage of this call is in performing the following steps.&lt;br /&gt;
# Request the amount of resources&lt;br /&gt;
# Get the IDs of all the living beancounters&lt;br /&gt;
# Setup a handler for some signal (e.g. USR1)&lt;br /&gt;
# Perform a system call to setup the notification&lt;br /&gt;
# Go do something (or sleep for ever)&lt;br /&gt;
&lt;br /&gt;
In a signal handler one should just perform a respective system call to get the stats and schedule the next notification (yes, they are performed in one go; see below for more details).&lt;br /&gt;
&lt;br /&gt;
= API =&lt;br /&gt;
The system call description is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long ubstat(int func, unsigned long luid, void *notif, void *buf, int size);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The macros and data typed used are declared in &amp;lt;code&amp;gt;include/ub/ub_stat.h&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
== Arguments description ==&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;''' is like &amp;lt;code&amp;gt;cmd&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; system call. It can be one of&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; to read basic stats for one resource. The desired resource itself should be &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;-ed with the &amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt; to read basic stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt; to read extended stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBLIST&amp;lt;/code&amp;gt; to get the ids of the beancounters&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code&amp;gt; to get the number of resources used by the kernel&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_GETTIME&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See below for what ''basic'' and ''extended'' stats mean.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;luid&amp;lt;/code&amp;gt;''' is the desired beancounter ID. Only one beancounter can be checked at one call.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt;''' is the pointer to a &amp;lt;code&amp;gt;ubnotifrq_t&amp;lt;/code&amp;gt; structure which describes the notification details (see below).&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;''' is the pointer to a chunk of memory, which will contain the data requested.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;''' is the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; memory size.&lt;br /&gt;
&lt;br /&gt;
== The statistics format ==&lt;br /&gt;
The format of data rerurned into the buffer depends on the function requested.&lt;br /&gt;
&lt;br /&gt;
'''1. &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[1];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the time period for which the stats are returned and the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; for the resource.&lt;br /&gt;
&lt;br /&gt;
'''2. &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the same info as the &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; does, but for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''3. &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   barrier;&lt;br /&gt;
                unsigned long   limit;&lt;br /&gt;
                unsigned long   held;&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   minheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
                unsigned long __unused1;&lt;br /&gt;
                unsigned long __unused2;&lt;br /&gt;
       } ubstatparmf_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the extended info for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''4. UBSTAT_UBLIST''' treats the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; to point to the &amp;lt;code&amp;gt;unsigned long&amp;lt;/code&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
'''5. UBSTAT_UBPARMNUM''' ignores the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''6. UBSTAT_GETTIME''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstattime_t    cur_time;&lt;br /&gt;
        };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It returns the time interval within which the stats are collected and the current time.&lt;br /&gt;
&lt;br /&gt;
All the times used are in seconds.&lt;br /&gt;
&lt;br /&gt;
== Notification ==&lt;br /&gt;
The notification info is passed via the &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; argument and is being set up for all the functions except the &amp;lt;code&amp;gt;UBLIST&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;UBPARNUM&amp;lt;/code&amp;gt;. The notification is one-shot, but note that once you requested the statistics the next shot is scheduled at the same time.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; should point to&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                long            maxinterval;&lt;br /&gt;
                int             signum;&lt;br /&gt;
        } ubnotifrq_t;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;maxinterval&amp;lt;/code&amp;gt; is the time after which the notification will be delivered. It should be more than 1 (second).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;signum&amp;lt;/code&amp;gt; is the signal that will be sent to notify.&lt;br /&gt;
&lt;br /&gt;
== Return value ==&lt;br /&gt;
The system call returns -1 in case error has occurred. In case of &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code it returns &amp;lt;code&amp;gt;UB_RESOURCES&amp;lt;/code&amp;gt; and in all other cases it returns the amount of bytes written to the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Demo =&lt;br /&gt;
The following program demonstrates how you can (but not should) use the described API. This example is deliberately made very stupid and simple to demonstrate the main idea and will only work on x86_64.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ub_stat.h&amp;gt;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define UBSTAT_BUFSIZE	4096&lt;br /&gt;
#define UBSTAT_NOTIFSIG	SIGUSR1&lt;br /&gt;
#define UB_RESOURCES	24&lt;br /&gt;
&lt;br /&gt;
static char ubstat_buf[UBSTAT_BUFSIZE];&lt;br /&gt;
static int luid, func;&lt;br /&gt;
static ubnotifrq_t notif;&lt;br /&gt;
static void (*print_stat)(void *buf);&lt;br /&gt;
&lt;br /&gt;
#define sys_ubstat(args...)	syscall(503, ## args)&lt;br /&gt;
&lt;br /&gt;
static void usage(void)&lt;br /&gt;
{&lt;br /&gt;
	printf(&amp;quot;ubstat &amp;lt;id&amp;gt; &amp;lt;period&amp;gt; &amp;lt;resource&amp;gt;\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;resource can be either num or:\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-1 for all maxheld and failcnt\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-2 for all at all\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_one(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[1];&lt;br /&gt;
	} *data;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[0].maxheld);&lt;br /&gt;
	printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[0].failcnt);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_all(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;\tmaxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;\tfailcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_full(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;minheld: %lu\n&amp;quot;, data-&amp;gt;param[res].minheld);&lt;br /&gt;
		printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static inline int res2func(int resource)&lt;br /&gt;
{&lt;br /&gt;
	if (resource &amp;gt;= 0) {&lt;br /&gt;
		print_stat = print_stat_one;&lt;br /&gt;
		return UBSTAT_READ_ONE | resource;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -1) {&lt;br /&gt;
		print_stat = print_stat_all;&lt;br /&gt;
		return UBSTAT_READ_ALL;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -2) {&lt;br /&gt;
		print_stat = print_stat_full;&lt;br /&gt;
		return UBSTAT_READ_FULL;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Bad resource %d\n&amp;quot;, resource);&lt;br /&gt;
	exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void do_notify(int x)&lt;br /&gt;
{&lt;br /&gt;
	int err;&lt;br /&gt;
&lt;br /&gt;
	err = sys_ubstat(func, luid, (unsigned long)&amp;amp;notif,&lt;br /&gt;
			ubstat_buf, UBSTAT_BUFSIZE);&lt;br /&gt;
	if (err &amp;lt; 0) {&lt;br /&gt;
		perror(&amp;quot;Can't set stat&amp;quot;);&lt;br /&gt;
		exit(0);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	print_stat(ubstat_buf);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int do_ubstat(int id, int period, int resource)&lt;br /&gt;
{&lt;br /&gt;
	luid = id;&lt;br /&gt;
	func = res2func(resource);&lt;br /&gt;
	notif.maxinterval = period;&lt;br /&gt;
	notif.signum = UBSTAT_NOTIFSIG;&lt;br /&gt;
	signal(UBSTAT_NOTIFSIG, do_notify);&lt;br /&gt;
	do_notify(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
	int id, period, res;&lt;br /&gt;
&lt;br /&gt;
	if (argc == 1) {&lt;br /&gt;
		usage();&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	id = atoi(argv[1]);&lt;br /&gt;
	period = atoi(argv[2]);&lt;br /&gt;
	res = atoi(argv[3]);&lt;br /&gt;
&lt;br /&gt;
	do_ubstat(id, period, res);&lt;br /&gt;
&lt;br /&gt;
	while (1)&lt;br /&gt;
		sleep(10);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implementation constraints =&lt;br /&gt;
Unfortunately the API is not architecture independent and thus 32-bit application will simply not work on x86_64.&lt;br /&gt;
&lt;br /&gt;
[[Category:UBC]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8175</id>
		<title>Ubstat system call</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8175"/>
		<updated>2010-02-05T14:16:25Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added more information about arch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes an interesting system call which was designed to pick beancounters statistics.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
The system call appeared in the very first version of the OpenVZ. Its API is rather sloppy, but this is something we have to live with due to backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
The main intention of this system call is to allow a user space process get the beancounters statistics ''periodically''. This statistics includes the fields observed in the &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file and one more field - the so called &amp;lt;code&amp;gt;minheld&amp;lt;/code&amp;gt; value which is opposite to the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; one. As long as exporting the statistics the system call also notifies the task about the desired period has elapsed. The notification is performed by sending a signal to a process and this notification is one-shot.&lt;br /&gt;
&lt;br /&gt;
= How it works =&lt;br /&gt;
The typical usage of this call is in performing the following steps.&lt;br /&gt;
# Request the amount of resources&lt;br /&gt;
# Get the IDs of all the living beancounters&lt;br /&gt;
# Setup a handler for some signal (e.g. USR1)&lt;br /&gt;
# Perform a system call to setup the notification&lt;br /&gt;
# Go do something (or sleep for ever)&lt;br /&gt;
&lt;br /&gt;
In a signal handler one should just perform a respective system call to get the stats and schedule the next notification (yes, they are performed in one go; see below for more details).&lt;br /&gt;
&lt;br /&gt;
= API =&lt;br /&gt;
The system call description is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long ubstat(int func, unsigned long luid, void *notif, void *buf, int size);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The macros and data typed used are declared in &amp;lt;code&amp;gt;include/ub/ub_stat.h&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
== Arguments description ==&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;''' is like &amp;lt;code&amp;gt;cmd&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; system call. It can be one of&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; to read basic stats for one resource. The desired resource itself should be &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;-ed with the &amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt; to read basic stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt; to read extended stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBLIST&amp;lt;/code&amp;gt; to get the ids of the beancounters&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code&amp;gt; to get the number of resources used by the kernel&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_GETTIME&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See below for what ''basic'' and ''extended'' stats mean.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;luid&amp;lt;/code&amp;gt;''' is the desired beancounter ID. Only one beancounter can be checked at one call.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt;''' is the pointer to a &amp;lt;code&amp;gt;ubnotifrq_t&amp;lt;/code&amp;gt; structure which describes the notification details (see below).&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;''' is the pointer to a chunk of memory, which will contain the data requested.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;''' is the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; memory size.&lt;br /&gt;
&lt;br /&gt;
== The statistics format ==&lt;br /&gt;
The format of data rerurned into the buffer depends on the function requested.&lt;br /&gt;
&lt;br /&gt;
'''1. &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[1];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the time period for which the stats are returned and the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; for the resource.&lt;br /&gt;
&lt;br /&gt;
'''2. &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the same info as the &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; does, but for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''3. &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   barrier;&lt;br /&gt;
                unsigned long   limit;&lt;br /&gt;
                unsigned long   held;&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   minheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
                unsigned long __unused1;&lt;br /&gt;
                unsigned long __unused2;&lt;br /&gt;
       } ubstatparmf_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the extended info for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''4. UBSTAT_UBLIST''' treats the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; to point to the &amp;lt;code&amp;gt;unsigned long&amp;lt;/code&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
'''5. UBSTAT_UBPARMNUM''' ignores the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''6. UBSTAT_GETTIME''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstattime_t    cur_time;&lt;br /&gt;
        };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It returns the time interval within which the stats are collected and the current time.&lt;br /&gt;
&lt;br /&gt;
All the times used are in seconds.&lt;br /&gt;
&lt;br /&gt;
== Notification ==&lt;br /&gt;
The notification info is passed via the &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; argument and is being set up for all the functions except the &amp;lt;code&amp;gt;UBLIST&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;UBPARNUM&amp;lt;/code&amp;gt;. The notification is one-shot, but note that once you requested the statistics the next shot is scheduled at the same time.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; should point to&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                long            maxinterval;&lt;br /&gt;
                int             signum;&lt;br /&gt;
        } ubnotifrq_t;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;maxinterval&amp;lt;/code&amp;gt; is the time after which the notification will be delivered. It should be more than 1 (second).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;signum&amp;lt;/code&amp;gt; is the signal that will be sent to notify.&lt;br /&gt;
&lt;br /&gt;
= Demo =&lt;br /&gt;
The following program demonstrates how you can (but not should) use the described API. This example is deliberately made very stupid and simple to demonstrate the main idea and will only work on x86_64.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ub_stat.h&amp;gt;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define UBSTAT_BUFSIZE	4096&lt;br /&gt;
#define UBSTAT_NOTIFSIG	SIGUSR1&lt;br /&gt;
#define UB_RESOURCES	24&lt;br /&gt;
&lt;br /&gt;
static char ubstat_buf[UBSTAT_BUFSIZE];&lt;br /&gt;
static int luid, func;&lt;br /&gt;
static ubnotifrq_t notif;&lt;br /&gt;
static void (*print_stat)(void *buf);&lt;br /&gt;
&lt;br /&gt;
#define sys_ubstat(args...)	syscall(503, ## args)&lt;br /&gt;
&lt;br /&gt;
static void usage(void)&lt;br /&gt;
{&lt;br /&gt;
	printf(&amp;quot;ubstat &amp;lt;id&amp;gt; &amp;lt;period&amp;gt; &amp;lt;resource&amp;gt;\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;resource can be either num or:\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-1 for all maxheld and failcnt\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-2 for all at all\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_one(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[1];&lt;br /&gt;
	} *data;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[0].maxheld);&lt;br /&gt;
	printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[0].failcnt);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_all(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;\tmaxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;\tfailcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_full(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;minheld: %lu\n&amp;quot;, data-&amp;gt;param[res].minheld);&lt;br /&gt;
		printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static inline int res2func(int resource)&lt;br /&gt;
{&lt;br /&gt;
	if (resource &amp;gt;= 0) {&lt;br /&gt;
		print_stat = print_stat_one;&lt;br /&gt;
		return UBSTAT_READ_ONE | resource;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -1) {&lt;br /&gt;
		print_stat = print_stat_all;&lt;br /&gt;
		return UBSTAT_READ_ALL;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -2) {&lt;br /&gt;
		print_stat = print_stat_full;&lt;br /&gt;
		return UBSTAT_READ_FULL;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Bad resource %d\n&amp;quot;, resource);&lt;br /&gt;
	exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void do_notify(int x)&lt;br /&gt;
{&lt;br /&gt;
	int err;&lt;br /&gt;
&lt;br /&gt;
	err = sys_ubstat(func, luid, (unsigned long)&amp;amp;notif,&lt;br /&gt;
			ubstat_buf, UBSTAT_BUFSIZE);&lt;br /&gt;
	if (err &amp;lt; 0) {&lt;br /&gt;
		perror(&amp;quot;Can't set stat&amp;quot;);&lt;br /&gt;
		exit(0);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	print_stat(ubstat_buf);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int do_ubstat(int id, int period, int resource)&lt;br /&gt;
{&lt;br /&gt;
	luid = id;&lt;br /&gt;
	func = res2func(resource);&lt;br /&gt;
	notif.maxinterval = period;&lt;br /&gt;
	notif.signum = UBSTAT_NOTIFSIG;&lt;br /&gt;
	signal(UBSTAT_NOTIFSIG, do_notify);&lt;br /&gt;
	do_notify(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
	int id, period, res;&lt;br /&gt;
&lt;br /&gt;
	if (argc == 1) {&lt;br /&gt;
		usage();&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	id = atoi(argv[1]);&lt;br /&gt;
	period = atoi(argv[2]);&lt;br /&gt;
	res = atoi(argv[3]);&lt;br /&gt;
&lt;br /&gt;
	do_ubstat(id, period, res);&lt;br /&gt;
&lt;br /&gt;
	while (1)&lt;br /&gt;
		sleep(10);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implementation constraints =&lt;br /&gt;
Unfortunately the API is not architecture independent and thus 32-bit application will simply not work on x86_64.&lt;br /&gt;
&lt;br /&gt;
[[Category:UBC]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8174</id>
		<title>Ubstat system call</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8174"/>
		<updated>2010-02-05T14:15:03Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Fixed Demo arch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes an interesting system call which was designed to pick beancounters statistics.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
The system call appeared in the very first version of the OpenVZ. Its API is rather sloppy, but this is something we have to live with due to backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
The main intention of this system call is to allow a user space process get the beancounters statistics ''periodically''. This statistics includes the fields observed in the &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file and one more field - the so called &amp;lt;code&amp;gt;minheld&amp;lt;/code&amp;gt; value which is opposite to the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; one. As long as exporting the statistics the system call also notifies the task about the desired period has elapsed. The notification is performed by sending a signal to a process and this notification is one-shot.&lt;br /&gt;
&lt;br /&gt;
= How it works =&lt;br /&gt;
The typical usage of this call is in performing the following steps.&lt;br /&gt;
# Request the amount of resources&lt;br /&gt;
# Get the IDs of all the living beancounters&lt;br /&gt;
# Setup a handler for some signal (e.g. USR1)&lt;br /&gt;
# Perform a system call to setup the notification&lt;br /&gt;
# Go do something (or sleep for ever)&lt;br /&gt;
&lt;br /&gt;
In a signal handler one should just perform a respective system call to get the stats and schedule the next notification (yes, they are performed in one go; see below for more details).&lt;br /&gt;
&lt;br /&gt;
= API =&lt;br /&gt;
The system call description is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long ubstat(int func, unsigned long luid, void *notif, void *buf, int size);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The macros and data typed used are declared in &amp;lt;code&amp;gt;include/ub/ub_stat.h&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
== Arguments description ==&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;''' is like &amp;lt;code&amp;gt;cmd&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; system call. It can be one of&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; to read basic stats for one resource. The desired resource itself should be &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;-ed with the &amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt; to read basic stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt; to read extended stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBLIST&amp;lt;/code&amp;gt; to get the ids of the beancounters&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code&amp;gt; to get the number of resources used by the kernel&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_GETTIME&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See below for what ''basic'' and ''extended'' stats mean.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;luid&amp;lt;/code&amp;gt;''' is the desired beancounter ID. Only one beancounter can be checked at one call.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt;''' is the pointer to a &amp;lt;code&amp;gt;ubnotifrq_t&amp;lt;/code&amp;gt; structure which describes the notification details (see below).&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;''' is the pointer to a chunk of memory, which will contain the data requested.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;''' is the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; memory size.&lt;br /&gt;
&lt;br /&gt;
== The statistics format ==&lt;br /&gt;
The format of data rerurned into the buffer depends on the function requested.&lt;br /&gt;
&lt;br /&gt;
'''1. &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[1];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the time period for which the stats are returned and the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; for the resource.&lt;br /&gt;
&lt;br /&gt;
'''2. &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the same info as the &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; does, but for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''3. &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   barrier;&lt;br /&gt;
                unsigned long   limit;&lt;br /&gt;
                unsigned long   held;&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   minheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
                unsigned long __unused1;&lt;br /&gt;
                unsigned long __unused2;&lt;br /&gt;
       } ubstatparmf_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the extended info for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''4. UBSTAT_UBLIST''' treats the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; to point to the &amp;lt;code&amp;gt;unsigned long&amp;lt;/code&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
'''5. UBSTAT_UBPARMNUM''' ignores the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''6. UBSTAT_GETTIME''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstattime_t    cur_time;&lt;br /&gt;
        };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It returns the time interval within which the stats are collected and the current time.&lt;br /&gt;
&lt;br /&gt;
All the times used are in seconds.&lt;br /&gt;
&lt;br /&gt;
== Notification ==&lt;br /&gt;
The notification info is passed via the &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; argument and is being set up for all the functions except the &amp;lt;code&amp;gt;UBLIST&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;UBPARNUM&amp;lt;/code&amp;gt;. The notification is one-shot, but note that once you requested the statistics the next shot is scheduled at the same time.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; should point to&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                long            maxinterval;&lt;br /&gt;
                int             signum;&lt;br /&gt;
        } ubnotifrq_t;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;maxinterval&amp;lt;/code&amp;gt; is the time after which the notification will be delivered. It should be more than 1 (second).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;signum&amp;lt;/code&amp;gt; is the signal that will be sent to notify.&lt;br /&gt;
&lt;br /&gt;
= Demo =&lt;br /&gt;
The following program demonstrates how you can (but not should) use the described API. This example is deliberately made very stupid and simple to demonstrate the main idea and will only work on x86_64.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ub_stat.h&amp;gt;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define UBSTAT_BUFSIZE	4096&lt;br /&gt;
#define UBSTAT_NOTIFSIG	SIGUSR1&lt;br /&gt;
#define UB_RESOURCES	24&lt;br /&gt;
&lt;br /&gt;
static char ubstat_buf[UBSTAT_BUFSIZE];&lt;br /&gt;
static int luid, func;&lt;br /&gt;
static ubnotifrq_t notif;&lt;br /&gt;
static void (*print_stat)(void *buf);&lt;br /&gt;
&lt;br /&gt;
#define sys_ubstat(args...)	syscall(503, ## args)&lt;br /&gt;
&lt;br /&gt;
static void usage(void)&lt;br /&gt;
{&lt;br /&gt;
	printf(&amp;quot;ubstat &amp;lt;id&amp;gt; &amp;lt;period&amp;gt; &amp;lt;resource&amp;gt;\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;resource can be either num or:\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-1 for all maxheld and failcnt\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-2 for all at all\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_one(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[1];&lt;br /&gt;
	} *data;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[0].maxheld);&lt;br /&gt;
	printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[0].failcnt);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_all(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;\tmaxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;\tfailcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_full(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;minheld: %lu\n&amp;quot;, data-&amp;gt;param[res].minheld);&lt;br /&gt;
		printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static inline int res2func(int resource)&lt;br /&gt;
{&lt;br /&gt;
	if (resource &amp;gt;= 0) {&lt;br /&gt;
		print_stat = print_stat_one;&lt;br /&gt;
		return UBSTAT_READ_ONE | resource;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -1) {&lt;br /&gt;
		print_stat = print_stat_all;&lt;br /&gt;
		return UBSTAT_READ_ALL;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -2) {&lt;br /&gt;
		print_stat = print_stat_full;&lt;br /&gt;
		return UBSTAT_READ_FULL;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Bad resource %d\n&amp;quot;, resource);&lt;br /&gt;
	exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void do_notify(int x)&lt;br /&gt;
{&lt;br /&gt;
	int err;&lt;br /&gt;
&lt;br /&gt;
	err = sys_ubstat(func, luid, (unsigned long)&amp;amp;notif,&lt;br /&gt;
			ubstat_buf, UBSTAT_BUFSIZE);&lt;br /&gt;
	if (err &amp;lt; 0) {&lt;br /&gt;
		perror(&amp;quot;Can't set stat&amp;quot;);&lt;br /&gt;
		exit(0);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	print_stat(ubstat_buf);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int do_ubstat(int id, int period, int resource)&lt;br /&gt;
{&lt;br /&gt;
	luid = id;&lt;br /&gt;
	func = res2func(resource);&lt;br /&gt;
	notif.maxinterval = period;&lt;br /&gt;
	notif.signum = UBSTAT_NOTIFSIG;&lt;br /&gt;
	signal(UBSTAT_NOTIFSIG, do_notify);&lt;br /&gt;
	do_notify(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
	int id, period, res;&lt;br /&gt;
&lt;br /&gt;
	if (argc == 1) {&lt;br /&gt;
		usage();&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	id = atoi(argv[1]);&lt;br /&gt;
	period = atoi(argv[2]);&lt;br /&gt;
	res = atoi(argv[3]);&lt;br /&gt;
&lt;br /&gt;
	do_ubstat(id, period, res);&lt;br /&gt;
&lt;br /&gt;
	while (1)&lt;br /&gt;
		sleep(10);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:UBC]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8173</id>
		<title>Ubstat system call</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8173"/>
		<updated>2010-02-05T14:13:09Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Gategorized&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes an interesting system call which was designed to pick beancounters statistics.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
The system call appeared in the very first version of the OpenVZ. Its API is rather sloppy, but this is something we have to live with due to backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
The main intention of this system call is to allow a user space process get the beancounters statistics ''periodically''. This statistics includes the fields observed in the &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file and one more field - the so called &amp;lt;code&amp;gt;minheld&amp;lt;/code&amp;gt; value which is opposite to the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; one. As long as exporting the statistics the system call also notifies the task about the desired period has elapsed. The notification is performed by sending a signal to a process and this notification is one-shot.&lt;br /&gt;
&lt;br /&gt;
= How it works =&lt;br /&gt;
The typical usage of this call is in performing the following steps.&lt;br /&gt;
# Request the amount of resources&lt;br /&gt;
# Get the IDs of all the living beancounters&lt;br /&gt;
# Setup a handler for some signal (e.g. USR1)&lt;br /&gt;
# Perform a system call to setup the notification&lt;br /&gt;
# Go do something (or sleep for ever)&lt;br /&gt;
&lt;br /&gt;
In a signal handler one should just perform a respective system call to get the stats and schedule the next notification (yes, they are performed in one go; see below for more details).&lt;br /&gt;
&lt;br /&gt;
= API =&lt;br /&gt;
The system call description is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long ubstat(int func, unsigned long luid, void *notif, void *buf, int size);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The macros and data typed used are declared in &amp;lt;code&amp;gt;include/ub/ub_stat.h&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
== Arguments description ==&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;''' is like &amp;lt;code&amp;gt;cmd&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; system call. It can be one of&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; to read basic stats for one resource. The desired resource itself should be &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;-ed with the &amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt; to read basic stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt; to read extended stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBLIST&amp;lt;/code&amp;gt; to get the ids of the beancounters&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code&amp;gt; to get the number of resources used by the kernel&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_GETTIME&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See below for what ''basic'' and ''extended'' stats mean.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;luid&amp;lt;/code&amp;gt;''' is the desired beancounter ID. Only one beancounter can be checked at one call.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt;''' is the pointer to a &amp;lt;code&amp;gt;ubnotifrq_t&amp;lt;/code&amp;gt; structure which describes the notification details (see below).&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;''' is the pointer to a chunk of memory, which will contain the data requested.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;''' is the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; memory size.&lt;br /&gt;
&lt;br /&gt;
== The statistics format ==&lt;br /&gt;
The format of data rerurned into the buffer depends on the function requested.&lt;br /&gt;
&lt;br /&gt;
'''1. &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[1];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the time period for which the stats are returned and the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; for the resource.&lt;br /&gt;
&lt;br /&gt;
'''2. &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the same info as the &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; does, but for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''3. &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   barrier;&lt;br /&gt;
                unsigned long   limit;&lt;br /&gt;
                unsigned long   held;&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   minheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
                unsigned long __unused1;&lt;br /&gt;
                unsigned long __unused2;&lt;br /&gt;
       } ubstatparmf_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the extended info for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''4. UBSTAT_UBLIST''' treats the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; to point to the &amp;lt;code&amp;gt;unsigned long&amp;lt;/code&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
'''5. UBSTAT_UBPARMNUM''' ignores the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''6. UBSTAT_GETTIME''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstattime_t    cur_time;&lt;br /&gt;
        };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It returns the time interval within which the stats are collected and the current time.&lt;br /&gt;
&lt;br /&gt;
All the times used are in seconds.&lt;br /&gt;
&lt;br /&gt;
== Notification ==&lt;br /&gt;
The notification info is passed via the &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; argument and is being set up for all the functions except the &amp;lt;code&amp;gt;UBLIST&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;UBPARNUM&amp;lt;/code&amp;gt;. The notification is one-shot, but note that once you requested the statistics the next shot is scheduled at the same time.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; should point to&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                long            maxinterval;&lt;br /&gt;
                int             signum;&lt;br /&gt;
        } ubnotifrq_t;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;maxinterval&amp;lt;/code&amp;gt; is the time after which the notification will be delivered. It should be more than 1 (second).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;signum&amp;lt;/code&amp;gt; is the signal that will be sent to notify.&lt;br /&gt;
&lt;br /&gt;
= Demo =&lt;br /&gt;
The following program demonstrates how you can (but not should) use the described API. This example is deliberately made very stupid and simple to demonstrate the main idea.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ub_stat.h&amp;gt;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define UBSTAT_BUFSIZE	4096&lt;br /&gt;
#define UBSTAT_NOTIFSIG	SIGUSR1&lt;br /&gt;
#define UB_RESOURCES	24&lt;br /&gt;
&lt;br /&gt;
static char ubstat_buf[UBSTAT_BUFSIZE];&lt;br /&gt;
static int luid, func;&lt;br /&gt;
static ubnotifrq_t notif;&lt;br /&gt;
static void (*print_stat)(void *buf);&lt;br /&gt;
&lt;br /&gt;
#define sys_ubstat(args...)	syscall(503, ## args)&lt;br /&gt;
&lt;br /&gt;
static void usage(void)&lt;br /&gt;
{&lt;br /&gt;
	printf(&amp;quot;ubstat &amp;lt;id&amp;gt; &amp;lt;period&amp;gt; &amp;lt;resource&amp;gt;\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;resource can be either num or:\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-1 for all maxheld and failcnt\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-2 for all at all\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_one(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[1];&lt;br /&gt;
	} *data;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[0].maxheld);&lt;br /&gt;
	printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[0].failcnt);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_all(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;\tmaxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;\tfailcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_full(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;minheld: %lu\n&amp;quot;, data-&amp;gt;param[res].minheld);&lt;br /&gt;
		printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static inline int res2func(int resource)&lt;br /&gt;
{&lt;br /&gt;
	if (resource &amp;gt;= 0) {&lt;br /&gt;
		print_stat = print_stat_one;&lt;br /&gt;
		return UBSTAT_READ_ONE | resource;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -1) {&lt;br /&gt;
		print_stat = print_stat_all;&lt;br /&gt;
		return UBSTAT_READ_ALL;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -2) {&lt;br /&gt;
		print_stat = print_stat_full;&lt;br /&gt;
		return UBSTAT_READ_FULL;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Bad resource %d\n&amp;quot;, resource);&lt;br /&gt;
	exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void do_notify(int x)&lt;br /&gt;
{&lt;br /&gt;
	int err;&lt;br /&gt;
&lt;br /&gt;
	err = sys_ubstat(func, luid, (unsigned long)&amp;amp;notif,&lt;br /&gt;
			ubstat_buf, UBSTAT_BUFSIZE);&lt;br /&gt;
	if (err &amp;lt; 0) {&lt;br /&gt;
		perror(&amp;quot;Can't set stat&amp;quot;);&lt;br /&gt;
		exit(0);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	print_stat(ubstat_buf);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int do_ubstat(int id, int period, int resource)&lt;br /&gt;
{&lt;br /&gt;
	luid = id;&lt;br /&gt;
	func = res2func(resource);&lt;br /&gt;
	notif.maxinterval = period;&lt;br /&gt;
	notif.signum = UBSTAT_NOTIFSIG;&lt;br /&gt;
	signal(UBSTAT_NOTIFSIG, do_notify);&lt;br /&gt;
	do_notify(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
	int id, period, res;&lt;br /&gt;
&lt;br /&gt;
	if (argc == 1) {&lt;br /&gt;
		usage();&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	id = atoi(argv[1]);&lt;br /&gt;
	period = atoi(argv[2]);&lt;br /&gt;
	res = atoi(argv[3]);&lt;br /&gt;
&lt;br /&gt;
	do_ubstat(id, period, res);&lt;br /&gt;
&lt;br /&gt;
	while (1)&lt;br /&gt;
		sleep(10);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:UBC]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8172</id>
		<title>Ubstat system call</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubstat_system_call&amp;diff=8172"/>
		<updated>2010-02-05T14:12:47Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Initial page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes an interesting system call which was designed to pick beancounters statistics.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
The system call appeared in the very first version of the OpenVZ. Its API is rather sloppy, but this is something we have to live with due to backward compatibility reasons.&lt;br /&gt;
&lt;br /&gt;
The main intention of this system call is to allow a user space process get the beancounters statistics ''periodically''. This statistics includes the fields observed in the &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file and one more field - the so called &amp;lt;code&amp;gt;minheld&amp;lt;/code&amp;gt; value which is opposite to the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; one. As long as exporting the statistics the system call also notifies the task about the desired period has elapsed. The notification is performed by sending a signal to a process and this notification is one-shot.&lt;br /&gt;
&lt;br /&gt;
= How it works =&lt;br /&gt;
The typical usage of this call is in performing the following steps.&lt;br /&gt;
# Request the amount of resources&lt;br /&gt;
# Get the IDs of all the living beancounters&lt;br /&gt;
# Setup a handler for some signal (e.g. USR1)&lt;br /&gt;
# Perform a system call to setup the notification&lt;br /&gt;
# Go do something (or sleep for ever)&lt;br /&gt;
&lt;br /&gt;
In a signal handler one should just perform a respective system call to get the stats and schedule the next notification (yes, they are performed in one go; see below for more details).&lt;br /&gt;
&lt;br /&gt;
= API =&lt;br /&gt;
The system call description is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
long ubstat(int func, unsigned long luid, void *notif, void *buf, int size);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The macros and data typed used are declared in &amp;lt;code&amp;gt;include/ub/ub_stat.h&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
== Arguments description ==&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;''' is like &amp;lt;code&amp;gt;cmd&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; system call. It can be one of&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; to read basic stats for one resource. The desired resource itself should be &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;-ed with the &amp;lt;code&amp;gt;func&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt; to read basic stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt; to read extended stats about all the resources&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBLIST&amp;lt;/code&amp;gt; to get the ids of the beancounters&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_UBPARMNUM&amp;lt;/code&amp;gt; to get the number of resources used by the kernel&lt;br /&gt;
* &amp;lt;code&amp;gt;UBSTAT_GETTIME&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See below for what ''basic'' and ''extended'' stats mean.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;luid&amp;lt;/code&amp;gt;''' is the desired beancounter ID. Only one beancounter can be checked at one call.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt;''' is the pointer to a &amp;lt;code&amp;gt;ubnotifrq_t&amp;lt;/code&amp;gt; structure which describes the notification details (see below).&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;''' is the pointer to a chunk of memory, which will contain the data requested.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;''' is the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; memory size.&lt;br /&gt;
&lt;br /&gt;
== The statistics format ==&lt;br /&gt;
The format of data rerurned into the buffer depends on the function requested.&lt;br /&gt;
&lt;br /&gt;
'''1. &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[1];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the time period for which the stats are returned and the &amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; for the resource.&lt;br /&gt;
&lt;br /&gt;
'''2. &amp;lt;code&amp;gt;UBSTAT_READ_ALL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
        } ubstatparm_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the same info as the &amp;lt;code&amp;gt;UBSTAT_READ_ONE&amp;lt;/code&amp;gt; does, but for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''3. &amp;lt;code&amp;gt;UBSTAT_READ_FULL&amp;lt;/code&amp;gt;''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                unsigned long   barrier;&lt;br /&gt;
                unsigned long   limit;&lt;br /&gt;
                unsigned long   held;&lt;br /&gt;
                unsigned long   maxheld;&lt;br /&gt;
                unsigned long   minheld;&lt;br /&gt;
                unsigned long   failcnt;&lt;br /&gt;
                unsigned long __unused1;&lt;br /&gt;
                unsigned long __unused2;&lt;br /&gt;
       } ubstatparmf_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It contains the extended info for all the resources.&lt;br /&gt;
&lt;br /&gt;
'''4. UBSTAT_UBLIST''' treats the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt; to point to the &amp;lt;code&amp;gt;unsigned long&amp;lt;/code&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
'''5. UBSTAT_UBPARMNUM''' ignores the &amp;lt;code&amp;gt;buf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''6. UBSTAT_GETTIME''' format is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef unsigned long ubstattime_t;&lt;br /&gt;
&lt;br /&gt;
        struct {&lt;br /&gt;
                ubstattime_t    start_time;&lt;br /&gt;
                ubstattime_t    end_time;&lt;br /&gt;
                ubstattime_t    cur_time;&lt;br /&gt;
        };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It returns the time interval within which the stats are collected and the current time.&lt;br /&gt;
&lt;br /&gt;
All the times used are in seconds.&lt;br /&gt;
&lt;br /&gt;
== Notification ==&lt;br /&gt;
The notification info is passed via the &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; argument and is being set up for all the functions except the &amp;lt;code&amp;gt;UBLIST&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;UBPARNUM&amp;lt;/code&amp;gt;. The notification is one-shot, but note that once you requested the statistics the next shot is scheduled at the same time.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;notif&amp;lt;/code&amp;gt; should point to&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        typedef struct {&lt;br /&gt;
                long            maxinterval;&lt;br /&gt;
                int             signum;&lt;br /&gt;
        } ubnotifrq_t;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;maxinterval&amp;lt;/code&amp;gt; is the time after which the notification will be delivered. It should be more than 1 (second).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;signum&amp;lt;/code&amp;gt; is the signal that will be sent to notify.&lt;br /&gt;
&lt;br /&gt;
= Demo =&lt;br /&gt;
The following program demonstrates how you can (but not should) use the described API. This example is deliberately made very stupid and simple to demonstrate the main idea.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ub_stat.h&amp;gt;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define UBSTAT_BUFSIZE	4096&lt;br /&gt;
#define UBSTAT_NOTIFSIG	SIGUSR1&lt;br /&gt;
#define UB_RESOURCES	24&lt;br /&gt;
&lt;br /&gt;
static char ubstat_buf[UBSTAT_BUFSIZE];&lt;br /&gt;
static int luid, func;&lt;br /&gt;
static ubnotifrq_t notif;&lt;br /&gt;
static void (*print_stat)(void *buf);&lt;br /&gt;
&lt;br /&gt;
#define sys_ubstat(args...)	syscall(503, ## args)&lt;br /&gt;
&lt;br /&gt;
static void usage(void)&lt;br /&gt;
{&lt;br /&gt;
	printf(&amp;quot;ubstat &amp;lt;id&amp;gt; &amp;lt;period&amp;gt; &amp;lt;resource&amp;gt;\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;resource can be either num or:\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-1 for all maxheld and failcnt\n&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;-2 for all at all\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_one(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[1];&lt;br /&gt;
	} *data;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[0].maxheld);&lt;br /&gt;
	printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[0].failcnt);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_all(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparm_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;\tmaxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;\tfailcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void print_stat_full(void *buf)&lt;br /&gt;
{&lt;br /&gt;
	struct {&lt;br /&gt;
		ubstattime_t    start_time;&lt;br /&gt;
		ubstattime_t    end_time;&lt;br /&gt;
		ubstatparmf_t    param[UB_RESOURCES];&lt;br /&gt;
	} *data;&lt;br /&gt;
	int res;&lt;br /&gt;
&lt;br /&gt;
	data = buf;&lt;br /&gt;
	for (res = 0; res &amp;lt; UB_RESOURCES; res++) {&lt;br /&gt;
		printf(&amp;quot;res %d\n&amp;quot;, res);&lt;br /&gt;
		printf(&amp;quot;minheld: %lu\n&amp;quot;, data-&amp;gt;param[res].minheld);&lt;br /&gt;
		printf(&amp;quot;maxheld: %lu\n&amp;quot;, data-&amp;gt;param[res].maxheld);&lt;br /&gt;
		printf(&amp;quot;failcnt: %lu\n&amp;quot;, data-&amp;gt;param[res].failcnt);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static inline int res2func(int resource)&lt;br /&gt;
{&lt;br /&gt;
	if (resource &amp;gt;= 0) {&lt;br /&gt;
		print_stat = print_stat_one;&lt;br /&gt;
		return UBSTAT_READ_ONE | resource;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -1) {&lt;br /&gt;
		print_stat = print_stat_all;&lt;br /&gt;
		return UBSTAT_READ_ALL;&lt;br /&gt;
	}&lt;br /&gt;
	if (resource == -2) {&lt;br /&gt;
		print_stat = print_stat_full;&lt;br /&gt;
		return UBSTAT_READ_FULL;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	printf(&amp;quot;Bad resource %d\n&amp;quot;, resource);&lt;br /&gt;
	exit(1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void do_notify(int x)&lt;br /&gt;
{&lt;br /&gt;
	int err;&lt;br /&gt;
&lt;br /&gt;
	err = sys_ubstat(func, luid, (unsigned long)&amp;amp;notif,&lt;br /&gt;
			ubstat_buf, UBSTAT_BUFSIZE);&lt;br /&gt;
	if (err &amp;lt; 0) {&lt;br /&gt;
		perror(&amp;quot;Can't set stat&amp;quot;);&lt;br /&gt;
		exit(0);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	print_stat(ubstat_buf);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static int do_ubstat(int id, int period, int resource)&lt;br /&gt;
{&lt;br /&gt;
	luid = id;&lt;br /&gt;
	func = res2func(resource);&lt;br /&gt;
	notif.maxinterval = period;&lt;br /&gt;
	notif.signum = UBSTAT_NOTIFSIG;&lt;br /&gt;
	signal(UBSTAT_NOTIFSIG, do_notify);&lt;br /&gt;
	do_notify(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
	int id, period, res;&lt;br /&gt;
&lt;br /&gt;
	if (argc == 1) {&lt;br /&gt;
		usage();&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	id = atoi(argv[1]);&lt;br /&gt;
	period = atoi(argv[2]);&lt;br /&gt;
	res = atoi(argv[3]);&lt;br /&gt;
&lt;br /&gt;
	do_ubstat(id, period, res);&lt;br /&gt;
&lt;br /&gt;
	while (1)&lt;br /&gt;
		sleep(10);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_auxiliary_parameters&amp;diff=6491</id>
		<title>UBC auxiliary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_auxiliary_parameters&amp;diff=6491"/>
		<updated>2008-10-01T16:39:42Z</updated>

		<summary type="html">&lt;p&gt;Xemul: added comment about numfile barrier&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
Configuration of primary and secondary resource control parameters is&lt;br /&gt;
important for security and stability of the whole system. Auxiliary&lt;br /&gt;
parameters differ much from primary and secondary parameters in this respect.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The primary functions of auxiliary parameters are the following.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;These parameters improve application's handling of errors and resource&lt;br /&gt;
consumption limitations.&lt;br /&gt;
&lt;br /&gt;
Without these auxiliary parameters, possible bugs in applications (such&lt;br /&gt;
as forgetting to unlock locked files or forgetting to collect signals) will&lt;br /&gt;
cause slowdown and, after some time, killing of the applications because&lt;br /&gt;
of memory exhaustion. In presence of these parameters, applications&lt;br /&gt;
will notice the problem (because, for example, attempts to create new&lt;br /&gt;
file locks start to fail) and show an appropriate message helping to&lt;br /&gt;
debug the problem.&lt;br /&gt;
&lt;br /&gt;
Another example. Each object such as opened file or established network&lt;br /&gt;
connection consume certain resources. When the container&lt;br /&gt;
is close to exhaustion of the resources allowed to him, it is&lt;br /&gt;
usually better to refuse creation of new object than to allow it but deny&lt;br /&gt;
memory allocation or terminate (in case of complete exhaustion of the&lt;br /&gt;
resources) an already running application.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
These parameters improve fault isolation between applications in the&lt;br /&gt;
same container. Failures or misbehavior of one application&lt;br /&gt;
inside a container is more likely to cause hitting a&lt;br /&gt;
limit on some auxiliary parameter and normal termination of this mis-&lt;br /&gt;
behaving application, rather than abnormal termination of some other&lt;br /&gt;
long-running application inside the same container.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
These parameters may be used to impose some administrative limits&lt;br /&gt;
on the container (for example, to not allow the user to run&lt;br /&gt;
database servers by limiting the amount of [[shmpages]], or limiting the&lt;br /&gt;
number of simultaneous shell sessions through [[numpty]]).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, auxiliary parameters play a role similar to limits imposed by&lt;br /&gt;
&amp;lt;code&amp;gt;setrlimit(2)&amp;lt;/code&amp;gt; interface and limits configurable by&lt;br /&gt;
&amp;lt;code&amp;gt;sysctl(8)&amp;lt;/code&amp;gt; in standard&lt;br /&gt;
Linux installations.&lt;br /&gt;
&lt;br /&gt;
Because of this helper role in resource control, system management software&lt;br /&gt;
may show auxiliary parameters only in advanced mode for experienced&lt;br /&gt;
administrators and hide them in “basic” management modes.&lt;br /&gt;
&lt;br /&gt;
== lockedpages ==&lt;br /&gt;
Process pages not allowed to be swapped out (pages locked by &amp;lt;code&amp;gt;mlock(2)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The size of these pages is also accounted into &amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; or may allow&lt;br /&gt;
some gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, depending&lt;br /&gt;
on the nature of applications using memory locking features.&lt;br /&gt;
&lt;br /&gt;
Note that typical server applications like Web, FTP, mail servers&lt;br /&gt;
do not use memory locking features.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
== shmpages ==&lt;br /&gt;
The total size of shared memory (IPC, shared anonymous mappings and&lt;br /&gt;
&amp;lt;code&amp;gt;tmpfs&amp;lt;/code&amp;gt; objects).&lt;br /&gt;
&lt;br /&gt;
These pages are also accounted into &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
== physpages ==&lt;br /&gt;
Total number of RAM pages used by processes in this container.&lt;br /&gt;
&lt;br /&gt;
For memory pages used by several different containers (mappings of&lt;br /&gt;
shared libraries, for example), only a fraction of a page is charged to each&lt;br /&gt;
container.&lt;br /&gt;
The sum of the &amp;lt;code&amp;gt;physpages&amp;lt;/code&amp;gt; usage for all containers&lt;br /&gt;
corresponds to the total number of pages used in the system by all&lt;br /&gt;
containers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Physpages&amp;lt;/code&amp;gt; is an accounting-only parameter currently.&lt;br /&gt;
In future OpenVZ releases, this parameter will allow to provide guaranteed&lt;br /&gt;
amount of application memory, residing in RAM and not swappable.&lt;br /&gt;
For compatibility with future versions, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of this&lt;br /&gt;
parameter should be set to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; to&lt;br /&gt;
the maximal allowed value ([[MAX_ULONG]]).&lt;br /&gt;
&lt;br /&gt;
== numfile ==&lt;br /&gt;
Number of open files.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
Note: actually currently adjusting the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; will change the kernel behaviour on &amp;quot;pre-charging&amp;quot; the numfile resource. If you change one you will most likely not notice any changes in container behaviour at all. This ability was added for researching purposes purely.&lt;br /&gt;
&lt;br /&gt;
== numflock ==&lt;br /&gt;
Number of file locks.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter should have a&lt;br /&gt;
gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, as illustrated in&lt;br /&gt;
[[UBC configuration examples]].&lt;br /&gt;
&lt;br /&gt;
Very high limits on &amp;lt;code&amp;gt;numflock&amp;lt;/code&amp;gt; parameters and the big number&lt;br /&gt;
of file locks in the system may cause certain slowdown of&lt;br /&gt;
the whole system (but not fatal).&lt;br /&gt;
So, the limits on this parameter should be reasonable, depending&lt;br /&gt;
on the real requirements of the applications.&lt;br /&gt;
&lt;br /&gt;
== numpty ==&lt;br /&gt;
Number of pseudo-terminals.&lt;br /&gt;
&lt;br /&gt;
This parameter is usually used to limit the number of simultaneous shell&lt;br /&gt;
sessions.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
However, in OpenVZ systems, the actual number of pseudo-terminals allowed&lt;br /&gt;
for one container is limited to &amp;lt;code&amp;gt;256&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== numsiginfo ==&lt;br /&gt;
Number of &amp;lt;code&amp;gt;siginfo&amp;lt;/code&amp;gt; structures.&lt;br /&gt;
&lt;br /&gt;
The size of the structure is also accounted into &amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
The default installations of stand-alone Linux systems limit this number&lt;br /&gt;
to &amp;lt;code&amp;gt;1024&amp;lt;/code&amp;gt; for the whole system.&lt;br /&gt;
In OpenVZ installations, &amp;lt;code&amp;gt;numsiginfo&amp;lt;/code&amp;gt; limit applies to each&lt;br /&gt;
container individually.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
Very high settings of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of this parameter may reduce&lt;br /&gt;
responsiveness of the system.&lt;br /&gt;
It is unlikely that any container will need the limit greater than&lt;br /&gt;
the Linux default — &amp;lt;code&amp;gt;1024&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== dcachesize ==&lt;br /&gt;
The total size of &amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;inode&amp;lt;/code&amp;gt; structures locked in memory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dcachesize&amp;lt;/code&amp;gt; parameter controls filesystem-related caches, such as&lt;br /&gt;
directory entry (&amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt;) and inode caches.&lt;br /&gt;
The value accounted into &amp;lt;code&amp;gt;dcachesize&amp;lt;/code&amp;gt; is also included into&lt;br /&gt;
&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dcachesize&amp;lt;/code&amp;gt; exists as a separate parameter to impose a limit causing&lt;br /&gt;
file operations to sense memory shortage and return an error to applications,&lt;br /&gt;
protecting from memory shortages during critical operations that shouldn't&lt;br /&gt;
fail.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter should have a&lt;br /&gt;
gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, as illustrated in&lt;br /&gt;
[[UBC configuration examples]].&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
== numiptent ==&lt;br /&gt;
The number of NETFILTER (IP packet filtering) entries.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
There is a restriction on the total number of &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt;.&lt;br /&gt;
It depends on the amount of other allocations in so called “vmalloc”&lt;br /&gt;
memory area and constitutes about &amp;lt;code&amp;gt;250000&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
Violation of this restriction may cause failures of operations with&lt;br /&gt;
IP packet filter tables (execution of &amp;lt;code&amp;gt;iptables(8)&amp;lt;/code&amp;gt;)&lt;br /&gt;
in any container or the host system,&lt;br /&gt;
or failures of container starts.&lt;br /&gt;
Also, large &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt; cause considerable slowdown of processing&lt;br /&gt;
of network packets.  It is not recommended to allow containers&lt;br /&gt;
to create more than 200–300 &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_debug_options&amp;diff=6400</id>
		<title>Kernel debug options</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_debug_options&amp;diff=6400"/>
		<updated>2008-09-01T13:40:32Z</updated>

		<summary type="html">&lt;p&gt;Xemul: categorized&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes some debugging, that can be turned on in order to find more info about an oops/bug/deadlock/etc&lt;br /&gt;
&lt;br /&gt;
== Memory debugging options ==&lt;br /&gt;
There are two sets of options, depending on what kind of memory allocator you use&lt;br /&gt;
&lt;br /&gt;
=== SLAB ===&lt;br /&gt;
If you have a&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SLAB=y&lt;br /&gt;
# CONFIG_SLUB is not set&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
disposition in your config file, then the proper debugging options are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
CONFIG_DEBUG_SLAB=y&lt;br /&gt;
CONFIG_DEBUG_SLAB_LEAK=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== SLUB ===&lt;br /&gt;
If you have a&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# CONFIG_SLAB is not set&lt;br /&gt;
CONFIG_SLUB=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
set of options, then your choice should be&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SLUB_DEBUG=y&lt;br /&gt;
CONFIG_SLUB_DEBUG_ON=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Locking debugging ==&lt;br /&gt;
The following options are useful when debugging various deadlocks and memory corruptions. They produce some performance loss, however.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_DEBUG_SPINLOCK=y&lt;br /&gt;
CONFIG_DEBUG_MUTEXES=y&lt;br /&gt;
CONFIG_DEBUG_LOCK_ALLOC=y&lt;br /&gt;
CONFIG_DEBUG_SPINLOCK_SLEEP=y&lt;br /&gt;
CONFIG_DEBUG_LIST=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some others, but the above are minimal set.&lt;br /&gt;
&lt;br /&gt;
[[Category:Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_debug_options&amp;diff=6399</id>
		<title>Kernel debug options</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_debug_options&amp;diff=6399"/>
		<updated>2008-09-01T13:40:10Z</updated>

		<summary type="html">&lt;p&gt;Xemul: New page: This page describes some debugging, that can be turned on in order to find more info about an oops/bug/deadlock/etc  == Memory debugging options == There are two sets of options, depending...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes some debugging, that can be turned on in order to find more info about an oops/bug/deadlock/etc&lt;br /&gt;
&lt;br /&gt;
== Memory debugging options ==&lt;br /&gt;
There are two sets of options, depending on what kind of memory allocator you use&lt;br /&gt;
&lt;br /&gt;
=== SLAB ===&lt;br /&gt;
If you have a&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SLAB=y&lt;br /&gt;
# CONFIG_SLUB is not set&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
disposition in your config file, then the proper debugging options are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_DEBUG_KERNEL=y&lt;br /&gt;
CONFIG_DEBUG_SLAB=y&lt;br /&gt;
CONFIG_DEBUG_SLAB_LEAK=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== SLUB ===&lt;br /&gt;
If you have a&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# CONFIG_SLAB is not set&lt;br /&gt;
CONFIG_SLUB=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
set of options, then your choice should be&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SLUB_DEBUG=y&lt;br /&gt;
CONFIG_SLUB_DEBUG_ON=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Locking debugging ==&lt;br /&gt;
The following options are useful when debugging various deadlocks and memory corruptions. They produce some performance loss, however.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_DEBUG_SPINLOCK=y&lt;br /&gt;
CONFIG_DEBUG_MUTEXES=y&lt;br /&gt;
CONFIG_DEBUG_LOCK_ALLOC=y&lt;br /&gt;
CONFIG_DEBUG_SPINLOCK_SLEEP=y&lt;br /&gt;
CONFIG_DEBUG_LIST=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some others, but the above are minimal set.&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Disassembling_the_kernel&amp;diff=6354</id>
		<title>Disassembling the kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Disassembling_the_kernel&amp;diff=6354"/>
		<updated>2008-08-22T10:36:30Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes how to obtain sufficient disassembling of your kernel when reporting a new BUG caught on a self-compiled kernel.&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;code&amp;gt;objdump&amp;lt;/code&amp;gt; utility ==&lt;br /&gt;
&lt;br /&gt;
The main utility used to do it is the &amp;lt;code&amp;gt;objdump&amp;lt;/code&amp;gt; one. Most of the time it's enough just to run&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# objdump -dr &amp;lt;the-binary-file-to-dump&amp;gt; &amp;gt; &amp;lt;the-output-file&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and the disassembled binary will be obtained.&lt;br /&gt;
&lt;br /&gt;
Most often you'd need to provide the dump of the &amp;lt;code&amp;gt;vmlinu'''x'''&amp;lt;/code&amp;gt; file like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# objdump -dr vmlinux-&amp;lt;kernel-version&amp;gt; &amp;gt; vmlinux.decoded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We'll need the &amp;lt;code&amp;gt;vmlinux.decoded&amp;lt;/code&amp;gt; file in this case.&lt;br /&gt;
&lt;br /&gt;
== Some hints that can be get from the kernel BUG report ==&lt;br /&gt;
&lt;br /&gt;
Let's look at how a BUG report can look (in the &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; output)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BUG: unable to handle kernel NULL pointer dereference at virtual address 00000044&lt;br /&gt;
 printing eip:&lt;br /&gt;
c05d575b&lt;br /&gt;
*pde = 00000000&lt;br /&gt;
Oops: 0000 [#1]&lt;br /&gt;
SMP&lt;br /&gt;
Modules linked in: ...&lt;br /&gt;
...&lt;br /&gt;
 Call Trace:&lt;br /&gt;
 [&amp;lt;c0429ea3&amp;gt;] local_bh_enable+0x95/0xa4&lt;br /&gt;
 ...&lt;br /&gt;
 [&amp;lt;c05bc1ba&amp;gt;] net_rx_action+0x8f/0x185&lt;br /&gt;
 [&amp;lt;c05b1aa9&amp;gt;] kernel_sendmsg+0x2f/0x3d&lt;br /&gt;
 [&amp;lt;d0a7e24f&amp;gt;] xs_send_kvec+0x92/0x9a [sunrpc]&lt;br /&gt;
 [&amp;lt;c048e3bc&amp;gt;] destroy_inode+0x24/0x33&lt;br /&gt;
 [&amp;lt;d0a7e38e&amp;gt;] xs_sendpages+0x82/0x128 [sunrpc]&lt;br /&gt;
 ...&lt;br /&gt;
 [&amp;lt;d0a80732&amp;gt;] rpc_async_schedule+0x0/0x8 [sunrpc]&lt;br /&gt;
 [&amp;lt;c0433d6a&amp;gt;] run_workqueue+0x78/0xf5&lt;br /&gt;
 [&amp;lt;c0433de7&amp;gt;] worker_thread+0x0/0xdc&lt;br /&gt;
 ...&lt;br /&gt;
 [&amp;lt;c04371fb&amp;gt;] kthread+0x0/0x55&lt;br /&gt;
 [&amp;lt;c0405913&amp;gt;] kernel_thread_helper+0x7/0x10&lt;br /&gt;
 =======================&lt;br /&gt;
 ...&lt;br /&gt;
EIP: [&amp;lt;c05d575b&amp;gt;] ip_route_output_slow+0x40/0x6fa SS:ESP 0068:cf73bbbc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I've thrown away some unneeded info, so as you can see some function names in the stack trace are accompanied with the &amp;lt;code&amp;gt;[sunrpc]&amp;lt;/code&amp;gt; string. This is a module name, in you traces you can see some other modules. So, when you disassembled the &amp;lt;code&amp;gt;vmlinux&amp;lt;/code&amp;gt; file and attached this to the BUG report, very likely we'll ask you to disassemble the modules, that are seen in the stack trace, so you'd have to run the&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# objdump -dr /lib/modules/&amp;lt;version&amp;gt;/&amp;lt;path&amp;gt;/&amp;lt;module-name&amp;gt;.ko &amp;gt; &amp;lt;module-name&amp;gt;.decoded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
command and attach this module dump as well. Note, that the string&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EIP: [&amp;lt;c05d575b&amp;gt;] ip_route_output_slow+0x40/0x6fa SS:ESP 0068:cf73bbbc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
also contains the function name, that can also belong to some module.&lt;br /&gt;
&lt;br /&gt;
[[Category:Kernel]]&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5975</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5975"/>
		<updated>2008-05-29T10:40:41Z</updated>

		<summary type="html">&lt;p&gt;Xemul: raw table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
* persistent TUNs (should actually work, need CPT tunables)&lt;br /&gt;
* DCCP protocol&lt;br /&gt;
* Netfilter RAW(6) table in Containers&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** sockstat file in CT (currently empty)&lt;br /&gt;
* SCTP protocol (feature request: {{B|400}})&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5972</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5972"/>
		<updated>2008-05-28T16:27:57Z</updated>

		<summary type="html">&lt;p&gt;Xemul: flowlabels&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
* persistent TUNs (should actually work, need CPT tunables)&lt;br /&gt;
* DCCP protocol&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** sockstat file in CT (currently empty)&lt;br /&gt;
* SCTP protocol (feature request: {{B|400}})&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5796</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5796"/>
		<updated>2008-04-17T06:43:58Z</updated>

		<summary type="html">&lt;p&gt;Xemul: SCTP proto&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
* persistent TUNs (should actually work, need CPT tunes)&lt;br /&gt;
* DCCP protocol&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** sockstat file in CT (currently empty)&lt;br /&gt;
* SCTP protocol ([http://bugzilla.openvz.org/show_bug.cgi?id=400 Feature request])&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5795</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5795"/>
		<updated>2008-04-17T06:42:30Z</updated>

		<summary type="html">&lt;p&gt;Xemul: DCCP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
* persistent TUNs (should actually work, need CPT tunes)&lt;br /&gt;
* DCCP protocol&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** sockstat file in CT (currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=5794</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=5794"/>
		<updated>2008-04-16T14:04:16Z</updated>

		<summary type="html">&lt;p&gt;Xemul: buult-in modules owner for netlinks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
        .owner  = THIS_MODULE,  /* for consistency 8) */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.25/net/netlink/af_netlink.c (which is '''always''' built-in)''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * ...&lt;br /&gt;
 * Yes, it is a memory overhead, but in 2003 AD, who cares?&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/include/linux/netfilter_bridge/ebt_among.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define BITS_PER_BYTE           8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/include/linux/bitops.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* &amp;quot;NOOP&amp;quot; scheduler: the best scheduler, recommended for all interfaces&lt;br /&gt;
   under all circumstances. It is difficult to invent anything faster or&lt;br /&gt;
   cheaper.&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/net/sched/sch_generic.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Whee.. Weird sysv syscall. &lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/fs/filesystems.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static char vlan_copyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
static char vlan_buggyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/8021q/vlan.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
*/&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5793</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5793"/>
		<updated>2008-04-16T13:59:32Z</updated>

		<summary type="html">&lt;p&gt;Xemul: persistent TUNs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
* persistent TUNs (should actually work, need CPT tunes)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** sockstat file in CT (currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5792</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5792"/>
		<updated>2008-04-16T13:54:18Z</updated>

		<summary type="html">&lt;p&gt;Xemul: oops :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** sockstat file in CT (currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5791</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5791"/>
		<updated>2008-04-16T13:52:18Z</updated>

		<summary type="html">&lt;p&gt;Xemul: proc files rework&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
** &amp;lt;code&amp;gt;packet&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** sockstat file in CT (currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5790</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5790"/>
		<updated>2008-04-16T13:51:44Z</updated>

		<summary type="html">&lt;p&gt;Xemul: proc files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* &amp;lt;code&amp;gt;/proc/net&amp;lt;/code&amp;gt; files&lt;br /&gt;
** &amp;lt;code&amp;gt;netlink&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
** &amp;lt;code&amp;gt;packet&amp;lt;/code&amp;gt; (now absent)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* /proc/net/sockstat file in CT (this one is currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5789</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5789"/>
		<updated>2008-04-16T13:50:32Z</updated>

		<summary type="html">&lt;p&gt;Xemul: fixed file path&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* /proc/net/netlink file (it is now absent)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* /proc/net/sockstat file in CT (this one is currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5788</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5788"/>
		<updated>2008-04-16T13:50:01Z</updated>

		<summary type="html">&lt;p&gt;Xemul: netlink proc file&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
* /proc/net/netlink file (it is now absent)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* /proc/sockstat file in CT (this one is currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5787</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5787"/>
		<updated>2008-04-16T13:46:01Z</updated>

		<summary type="html">&lt;p&gt;Xemul: flowlabels for ipv6&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
* ipv6 flowlabels&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* /proc/sockstat file in CT (this one is currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5786</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5786"/>
		<updated>2008-04-16T13:39:40Z</updated>

		<summary type="html">&lt;p&gt;Xemul: /proc/sockstat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;br /&gt;
&lt;br /&gt;
* /proc/sockstat file in CT (this one is currently empty)&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5779</id>
		<title>Things we will have in 2.6.26 kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Things_we_will_have_in_2.6.26_kernel&amp;diff=5779"/>
		<updated>2008-04-16T11:40:48Z</updated>

		<summary type="html">&lt;p&gt;Xemul: New page: This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.  == Already in ==  * Tunnels ** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes the functionality that we've done for mainstream and are going to have in coming 2.6.26-based OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
== Already in ==&lt;br /&gt;
&lt;br /&gt;
* Tunnels&lt;br /&gt;
** IPv4-over-IPv4 (&amp;lt;code&amp;gt;ipip&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv4-over-GRE (&amp;lt;code&amp;gt;ip_gre&amp;lt;/code&amp;gt;)&lt;br /&gt;
** IPv6-over-IPv4 (&amp;lt;code&amp;gt;sit&amp;lt;/code&amp;gt;) ''already exists in 2.6.24''&lt;br /&gt;
** IP-in-IPv6 (&amp;lt;code&amp;gt;RFC2473&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== Sent for RFC ==&lt;br /&gt;
&lt;br /&gt;
* BSD process accounting&lt;br /&gt;
&lt;br /&gt;
== Planned ==&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Containers/Mini-summit_2008&amp;diff=5294</id>
		<title>Containers/Mini-summit 2008</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Containers/Mini-summit_2008&amp;diff=5294"/>
		<updated>2008-03-26T14:39:19Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added &amp;quot;small namespaces&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There will be a containers mini-summit at the [http://www.linuxsymposium.org/2008/ OLS'08]. This page is for organizing this mini-summit. Feel free to edit.&lt;br /&gt;
&lt;br /&gt;
'''When''': 21st or 22nd of July 2008&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Where''': Ottawa, ON, Canada.&lt;br /&gt;
&lt;br /&gt;
== Proposal ==&lt;br /&gt;
&lt;br /&gt;
The mini-summit proposal sent to OLS organizers. See [[/Proposal|proposal]].&lt;br /&gt;
&lt;br /&gt;
== Topics to discuss ==&lt;br /&gt;
&lt;br /&gt;
* Device accessibility cgroup (maybe with remap ability)&lt;br /&gt;
* TTYs&lt;br /&gt;
* Syslog&lt;br /&gt;
* Checkpoint/restart&lt;br /&gt;
* Memory controllers&lt;br /&gt;
* more?..&lt;br /&gt;
&lt;br /&gt;
== List of attendees ==&lt;br /&gt;
Please fill in your name here if you are going to attend, or email kir at openvz dot org if you are too lazy. Surely the list is not final, so put your name even if you are not sure you can make it.&lt;br /&gt;
&lt;br /&gt;
This list is in no particular order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Put this in three columns if browser is smart enough --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;-moz-column-count:3; -webkit-column-count:3; column-count:3; text-align: left; background: #fefef0; border: 1px solid #ddddc0;&amp;quot;&amp;gt;&lt;br /&gt;
# Kir Kolyshkin&lt;br /&gt;
# Pavel Emelyanov&lt;br /&gt;
# Denis Lunev&lt;br /&gt;
# Andrey Mirkin&lt;br /&gt;
# Serge Hallyn&lt;br /&gt;
# Dave Hansen&lt;br /&gt;
# Cedric Le Goater&lt;br /&gt;
# Daniel Lezcano&lt;br /&gt;
# Srivatsa Vaddagiri&lt;br /&gt;
# Balbir Singh&lt;br /&gt;
# Sukadev Bhattiprolu&lt;br /&gt;
# Paul Menage&lt;br /&gt;
# Eric W. Biederman&lt;br /&gt;
# Oren Laadan&lt;br /&gt;
# Yamamoto Takashi&lt;br /&gt;
# Kamezawa Hiroyuki&lt;br /&gt;
# Benjamin Thery&lt;br /&gt;
# Herbert Pötzl&lt;br /&gt;
# Oleg Nesterov&lt;br /&gt;
# Dhaval Giani&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Agenda ==&lt;br /&gt;
&lt;br /&gt;
* Namespaces/Containers&lt;br /&gt;
** Additional needed namespaces&lt;br /&gt;
*** Small namespaces ''What to do with small subsystem that might need virtualization. E.g. in openvz we have FUSE, binfmt_misc and some other small stuff virtualized. But how to merge it in mainline? Create a separate namespace for each? Mere them into one? How to call this then?''&lt;br /&gt;
** Nature of a 'container' — kernel object or userspace fiction&lt;br /&gt;
** Handling of /proc and /sysfs within containers&lt;br /&gt;
** Handling filesystem/namespace synchronization  (not sure what the issue is)&lt;br /&gt;
** How to enter a container&lt;br /&gt;
** User namespaces?&lt;br /&gt;
* Cgroups+Resource management&lt;br /&gt;
** Cgroup implementation&lt;br /&gt;
** Additional cgroups and their design&lt;br /&gt;
** Resource management&lt;br /&gt;
* Checkpoint/Restart&lt;br /&gt;
** Summary of existing c/r patchsets/designs&lt;br /&gt;
** How to initiate and synchronize checkpoint/restart&lt;br /&gt;
** (state of freezer subsystem?)&lt;br /&gt;
** Memory state dump&lt;br /&gt;
** How to dump/fetch data for resource (file, ipc) checkpoint&lt;br /&gt;
** How to do restart&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* http://www.linuxsymposium.org/2008/cfp.php — OLS call for papers&lt;br /&gt;
* https://lists.linux-foundation.org/pipermail/containers/2008-January/009688.html&lt;br /&gt;
&lt;br /&gt;
[[Category: Containers]]&lt;br /&gt;
[[Category: Events]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4217</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4217"/>
		<updated>2008-03-03T10:03:22Z</updated>

		<summary type="html">&lt;p&gt;Xemul: EBTABLES memory overhead attitude&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * ...&lt;br /&gt;
 * Yes, it is a memory overhead, but in 2003 AD, who cares?&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/include/linux/netfilter_bridge/ebt_among.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define BITS_PER_BYTE           8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/include/linux/bitops.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* &amp;quot;NOOP&amp;quot; scheduler: the best scheduler, recommended for all interfaces&lt;br /&gt;
   under all circumstances. It is difficult to invent anything faster or&lt;br /&gt;
   cheaper.&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/net/sched/sch_generic.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Whee.. Weird sysv syscall. &lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/fs/filesystems.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static char vlan_copyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
static char vlan_buggyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/8021q/vlan.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
*/&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4128</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4128"/>
		<updated>2008-02-14T08:21:32Z</updated>

		<summary type="html">&lt;p&gt;Xemul: extra line removed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define BITS_PER_BYTE           8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/include/linux/bitops.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* &amp;quot;NOOP&amp;quot; scheduler: the best scheduler, recommended for all interfaces&lt;br /&gt;
   under all circumstances. It is difficult to invent anything faster or&lt;br /&gt;
   cheaper.&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/net/sched/sch_generic.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Whee.. Weird sysv syscall. &lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/fs/filesystems.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static char vlan_copyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
static char vlan_buggyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/8021q/vlan.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
*/&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4127</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4127"/>
		<updated>2008-02-13T14:55:53Z</updated>

		<summary type="html">&lt;p&gt;Xemul: bits per page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define BITS_PER_BYTE           8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/include/linux/bitops.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* &amp;quot;NOOP&amp;quot; scheduler: the best scheduler, recommended for all interfaces&lt;br /&gt;
   under all circumstances. It is difficult to invent anything faster or&lt;br /&gt;
   cheaper.&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/net/sched/sch_generic.c''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Whee.. Weird sysv syscall. &lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/fs/filesystems.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static char vlan_copyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
static char vlan_buggyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/8021q/vlan.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
*/&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4126</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4126"/>
		<updated>2008-02-13T11:33:58Z</updated>

		<summary type="html">&lt;p&gt;Xemul: noop scheduler&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* &amp;quot;NOOP&amp;quot; scheduler: the best scheduler, recommended for all interfaces&lt;br /&gt;
   under all circumstances. It is difficult to invent anything faster or&lt;br /&gt;
   cheaper.&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/net/sched/sch_generic.c''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Whee.. Weird sysv syscall. &lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/fs/filesystems.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static char vlan_copyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
static char vlan_buggyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/8021q/vlan.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
*/&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4119</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=4119"/>
		<updated>2008-02-07T13:14:44Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Weird sysfs call&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Whee.. Weird sysv syscall. &lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24/fs/filesystes.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static char vlan_copyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
static char vlan_buggyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/8021q/vlan.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
*/&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Containers/Mini-summit_2008&amp;diff=4078</id>
		<title>Containers/Mini-summit 2008</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Containers/Mini-summit_2008&amp;diff=4078"/>
		<updated>2008-01-28T14:47:24Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Eric W.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are plans to organize a containers mini-summit at the OLS'08. This page is for organizing this mini-summit. Feel free to edit.&lt;br /&gt;
&lt;br /&gt;
'''When''': before 23rd of July 2008 (on a day before the OLS itself)&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Where''': Ottawa, ON, Canada.&lt;br /&gt;
&lt;br /&gt;
== Proposal ==&lt;br /&gt;
&lt;br /&gt;
A mini-summit proposal to be sent to OLS organizers. See [[{{PAGENAME}}/Proposal]].&lt;br /&gt;
&lt;br /&gt;
== Topics to discuss ==&lt;br /&gt;
&lt;br /&gt;
* device accessibility cgroup (maybe with remap ability)&lt;br /&gt;
* ttys&lt;br /&gt;
* syslog&lt;br /&gt;
* checkpoint/restart&lt;br /&gt;
* more?..&lt;br /&gt;
&lt;br /&gt;
== List of attendees ==&lt;br /&gt;
Please fill in your name here if you are going to attend, or email kir at openvz dot org if you are too lazy. Surely the list is not final, so put your name even if you are not sure you can make it.&lt;br /&gt;
&lt;br /&gt;
This list is in no particular order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Put this in three columns if browser is smart enough --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;-moz-column-count:3; -webkit-column-count:3; column-count:3; text-align: left; background: #fefef0; border: 1px solid #ddddc0;&amp;quot;&amp;gt;&lt;br /&gt;
# Kir Kolyshkin&lt;br /&gt;
# Pavel Emelyanov&lt;br /&gt;
# Denis Lunev&lt;br /&gt;
# Andrey Mirkin&lt;br /&gt;
# Serge Hallyn&lt;br /&gt;
# Dave Hansen&lt;br /&gt;
# Cedric Le Goater&lt;br /&gt;
# Daniel Lezcano&lt;br /&gt;
# Srivatsa Vaddagiri&lt;br /&gt;
# Balbir Singh&lt;br /&gt;
# Sukadev Bhattiprolu&lt;br /&gt;
# Paul Menage&lt;br /&gt;
# Eric W. Biederman&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Agenda ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* http://www.linuxsymposium.org/2008/cfp.php — OLS call for papers&lt;br /&gt;
* https://lists.linux-foundation.org/pipermail/containers/2008-January/009688.html&lt;br /&gt;
&lt;br /&gt;
[[Category: Containers]]&lt;br /&gt;
[[Category: Events]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Containers/Mini-summit_2008&amp;diff=4077</id>
		<title>Containers/Mini-summit 2008</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Containers/Mini-summit_2008&amp;diff=4077"/>
		<updated>2008-01-28T14:47:02Z</updated>

		<summary type="html">&lt;p&gt;Xemul: fixed devices&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are plans to organize a containers mini-summit at the OLS'08. This page is for organizing this mini-summit. Feel free to edit.&lt;br /&gt;
&lt;br /&gt;
'''When''': before 23rd of July 2008 (on a day before the OLS itself)&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Where''': Ottawa, ON, Canada.&lt;br /&gt;
&lt;br /&gt;
== Proposal ==&lt;br /&gt;
&lt;br /&gt;
A mini-summit proposal to be sent to OLS organizers. See [[{{PAGENAME}}/Proposal]].&lt;br /&gt;
&lt;br /&gt;
== Topics to discuss ==&lt;br /&gt;
&lt;br /&gt;
* device accessibility cgroup (maybe with remap ability)&lt;br /&gt;
* ttys&lt;br /&gt;
* syslog&lt;br /&gt;
* checkpoint/restart&lt;br /&gt;
* more?..&lt;br /&gt;
&lt;br /&gt;
== List of attendees ==&lt;br /&gt;
Please fill in your name here if you are going to attend, or email kir at openvz dot org if you are too lazy. Surely the list is not final, so put your name even if you are not sure you can make it.&lt;br /&gt;
&lt;br /&gt;
This list is in no particular order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Put this in three columns if browser is smart enough --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;-moz-column-count:3; -webkit-column-count:3; column-count:3; text-align: left; background: #fefef0; border: 1px solid #ddddc0;&amp;quot;&amp;gt;&lt;br /&gt;
# Kir Kolyshkin&lt;br /&gt;
# Pavel Emelyanov&lt;br /&gt;
# Denis Lunev&lt;br /&gt;
# Andrey Mirkin&lt;br /&gt;
# Serge Hallyn&lt;br /&gt;
# Dave Hansen&lt;br /&gt;
# Cedric Le Goater&lt;br /&gt;
# Daniel Lezcano&lt;br /&gt;
# Srivatsa Vaddagiri&lt;br /&gt;
# Balbir Singh&lt;br /&gt;
# Sukadev Bhattiprolu&lt;br /&gt;
# Paul Menage&lt;br /&gt;
# Eric Biederman&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Agenda ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* http://www.linuxsymposium.org/2008/cfp.php — OLS call for papers&lt;br /&gt;
* https://lists.linux-foundation.org/pipermail/containers/2008-January/009688.html&lt;br /&gt;
&lt;br /&gt;
[[Category: Containers]]&lt;br /&gt;
[[Category: Events]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Basic_operations_in_OpenVZ_environment&amp;diff=3907</id>
		<title>Basic operations in OpenVZ environment</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Basic_operations_in_OpenVZ_environment&amp;diff=3907"/>
		<updated>2008-01-08T07:12:41Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article assumes you have already [[Quick installation|installed OpenVZ]] and prepared the [[OS template cache]](s). If not, follow the links to perform the steps needed.&lt;br /&gt;
&lt;br /&gt;
== Create and start a VE ==&lt;br /&gt;
&lt;br /&gt;
To create and start a [[VE]], run the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl create VEID --ostemplate osname&lt;br /&gt;
[host-node]# vzctl set VEID --ipadd a.b.c.d --save&lt;br /&gt;
[host-node]# vzctl set VEID --nameserver a.b.c.d --save&lt;br /&gt;
[host-node]# vzctl start VEID&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;tt&amp;gt;VEID&amp;lt;/tt&amp;gt; is the numeric ID for the VE; &amp;lt;tt&amp;gt;osname&amp;lt;/tt&amp;gt; is the name of the OS template for the VE, and &amp;lt;tt&amp;gt;a.b.c.d&amp;lt;/tt&amp;gt; is the IP address to be assigned to the VE.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl create 101 --ostemplate fedora-core-5-minimal&lt;br /&gt;
[host-node]# vzctl set 101 --ipadd 10.1.2.3 --save&lt;br /&gt;
[host-node]# vzctl set 101 --nameserver 10.0.2.1 --save&lt;br /&gt;
[host-node]# vzctl start 101&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your freshly-created VE should be up and running now; you can see its processes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl exec VEID ps ax&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enter to and exit from the VE ==&lt;br /&gt;
&lt;br /&gt;
To enter VE give the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl enter VEID&lt;br /&gt;
entered into VPS VEID&lt;br /&gt;
[ve]#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To exit from VE, just type &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; and press enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[ve]# exit&lt;br /&gt;
exited from VPS VEID&lt;br /&gt;
&lt;br /&gt;
[host-node]#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Stop and destroy the VE ==&lt;br /&gt;
&lt;br /&gt;
To stop VE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl stop VEID&lt;br /&gt;
Stopping VPS ...&lt;br /&gt;
VPS was stopped&lt;br /&gt;
VPS is unmounted&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And to destroy VE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl destroy VEID&lt;br /&gt;
Destroying VPS private area: /vz/private/VEID&lt;br /&gt;
VPS private area was destroyed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when you know how to manage your [[VE]], learn about [[Resource management]].&lt;br /&gt;
&lt;br /&gt;
[[Category: Installation]]&lt;br /&gt;
[[Category: HOWTO]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3745</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3745"/>
		<updated>2007-12-12T12:21:50Z</updated>

		<summary type="html">&lt;p&gt;Xemul: vlan buggyright&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static char vlan_copyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
static char vlan_buggyright[] = &amp;quot;...&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/8021q/vlan.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
 */&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3743</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3743"/>
		<updated>2007-12-12T10:24:29Z</updated>

		<summary type="html">&lt;p&gt;Xemul: arp comment&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
So... these &amp;quot;amateur&amp;quot; devices are hopeless.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.24-rc5/net/ipv4/arp.c:arp_constructor()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
 */&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3703</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3703"/>
		<updated>2007-12-04T13:18:08Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added RR comment about sucking code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* This code sucks.  But you should have seen it before! --RR */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/route.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
 */&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3669</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3669"/>
		<updated>2007-11-29T16:39:15Z</updated>

		<summary type="html">&lt;p&gt;Xemul: LOOOOOOONG error report&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void dn_long_error_report(struct neighbour *neigh, struct sk_buff *skb)&lt;br /&gt;
{&lt;br /&gt;
        printk(KERN_DEBUG &amp;quot;dn_long_error_report: called\n&amp;quot;);&lt;br /&gt;
        kfree_skb(skb);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/decnet/dn_neigh.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
 */&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3668</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3668"/>
		<updated>2007-11-29T13:21:00Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added forward csum&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Unfortunately we don't support this one.  Any brave souls? */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/linux/skbuff.h:skb_forward_csum()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
 */&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3666</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3666"/>
		<updated>2007-11-28T13:09:42Z</updated>

		<summary type="html">&lt;p&gt;Xemul: new true/false macros :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define IT_ID_SET       1&lt;br /&gt;
#define IT_ID_NOT_SET   0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/posix-timers.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
 */&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3665</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3665"/>
		<updated>2007-11-28T12:55:12Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Orphanned pgrp&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * &amp;quot;I ask you, have you ever known what it is to be an orphan?&amp;quot;&lt;br /&gt;
 */&lt;br /&gt;
static int will_become_orphaned_pgrp(...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/kernel/exit.c''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3580</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3580"/>
		<updated>2007-11-12T15:32:12Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Perfect world from gre&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef I_WISH_WORLD_WERE_PERFECT&lt;br /&gt;
&lt;br /&gt;
/* It is not :-( ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/ip_gre.c:ipgre_err()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3569</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3569"/>
		<updated>2007-11-07T14:51:22Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added packet quote&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
weird, but documented&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/packet/af_packet.c:packet_create()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3568</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3568"/>
		<updated>2007-11-07T13:37:49Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Added ANK comment in af_unix.c&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
What the above comment does talk about? --ANK(980817)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/unix/af_unix.c:unix_release_sock()''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3567</id>
		<title>Kernel code quotes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Kernel_code_quotes&amp;diff=3567"/>
		<updated>2007-11-07T07:39:47Z</updated>

		<summary type="html">&lt;p&gt;Xemul: Add them upside-down to make new quotes appear at the top&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we're collecting some funny quotes from the linux kernel code&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static inline int sk_hashed(const struct sock *sk)&lt;br /&gt;
{&lt;br /&gt;
        return !sk_unhashed(sk);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/include/net/sock.h''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Instead of using a dedicated spinlock, we (ab)use inetsw_lock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''from linux-2.6.23/net/ipv4/af_inet.c:build_ehash_secret()''&lt;br /&gt;
&lt;br /&gt;
[[Category: Kernel]]&lt;/div&gt;</summary>
		<author><name>Xemul</name></author>
		
	</entry>
</feed>