History log of /external/ltp/include/lapi/namespaces_constants.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
39ef6df9cbe25279aded8ea3032b8f413267f8e1 18-Aug-2015 Matus Marhefka <mmarhefk@redhat.com> added helper tools for creating and working with namespaces

This patch introduces helper tools for creating and working
with namespaces (ltp/testcases/kernel/containers/share) and
also includes documentation (ltp/doc/namespaces-helper-tools.txt):

* ns_create:
Creates a child process in the new specified namespace(s),
child is then daemonized and is running in the background.
PID of the daemonized child process is printed on the stdout.
As the new namespace(s) is(are) maintained by the daemonized
child process it(they) can be removed by killing this process.
* ns_exec:
Enters the namespace(s) of a process specified by a PID and
then executes the indicated program inside that namespace(s).
* ns_ifmove:
Moves a network interface to the namespace of a process
specified by a PID.

Example usage:
==============
$ myns=$(ns_create net ipc)

$ ip link add veth0 type veth peer name veth1
$ ns_exec $myns ip a
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

$ ns_ifmove veth1 $myns
$ ns_exec $myns ip a
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
6: veth1: <BROADCAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 6a:0a:45:ed:6e:d0 brd ff:ff:ff:ff:ff:ff

$ ip link del veth0
$ kill -9 $myns
==============

The only requirement from kernel side is the support of "setns"
syscall. There is no need to have util-linux (unshare, nsenter)
installed. This way test cases utilizing namespaces can be
executed even on older kernels which do not provide required
tools for working with namespaces.

Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
/external/ltp/include/lapi/namespaces_constants.h