cg: Split controller adding into two parts

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cg: Fix attaching to cgroups

In local_config_controller we check for CT being running.
When it comes to attach, the ct->state is not yet updated,
but the CT is running at this moment.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
libct: Add service controller

Sometimes we need to keep track of tasks running in CT. For
that sake introduce a service controllers that gets created
with other cgroups.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test: Add test for service controller

(and lost code from previous commit :( )

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cg: Fix merge of previous patches

Lost add_service_controller move, lost code from config_controller.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cg: Don't create sub-mounts for service controllers

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
ct: Attach to cgroups before changin root

Otherwise /sys/fs/cgroups is not accessible.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
ct: Add ability to kill container w/o pid namespace

For that the LIBCT_OPT_KILLABLE should be set, then
killing would go via service cgroup.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test: Add test for killing container w/o pid namespace

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
enter: Attach to cgroups before changing root

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cg: Alias for libct service ctl path

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
libct: Move sanity args checks from backends to frontend

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test: Clean out files before run

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fs: Structure code

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
enter: Add comment about root switching

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
local: Split local ct creation and linking it to the session

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
ses: Unify ct->ses linkage for different session types

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
ses: Unify containers unlinkage from session on destroy/session close

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
ct: Don't add opened handler to session list twice

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>