core: Save tasks' namespaces IDs in the ids image

The recent kernels allow to get namespaces IDs by reading proc-ns links.
Use this to generate IDs for tasks' namespaces (I do generate them, since
IDs provided by kernel look ugly :( ).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
ids: Split routine that dumps task's IDs

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
img: Save crtools process IDs in inventory

On restore we'll need to know whether the root task should be
cloned in new set of namespaces. It's natural to do it by
comparing root ids with some "other-world" IDs.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
dump: Collect tasks' IDs early

It's required to know whether the root task lives in
namespaces very very early (e.g. -- to lock the network
properly). Thus we have to collect task IDs right at
the time we collect the tasks themselves.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr: Detect namespaces presence automatically

Introduce the current_ns_mask variable, that collects info about
which namespaces tasks being dumped and to be restored live in.

For simlicity all tasks are supposed to live in one set of spaces.
This should be fixed eventually.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr: Obsolete the --namespaces option

It's no longer required to use this option -- two currently
supported cases (tasks on host and tasks in containers) can
be detected automatically. Keep this option for future.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr: Fix namespaces restore from older images

In old images we had no clue whether the root task is to be
created in new namespaces. Remember using the --namespaces
option for explicitl specification of this fact.

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