Re: [PATCH 3/7] Introduce nat/linux-namespaces.[ch]

Doug Evans
2015-04-17T17:32:36Z

On Fri, Apr 17, 2015 at 7:52 AM, Pedro Alves <palves@redhat.com> wrote:
>> +/* Enter the TYPE namespace of process PID and call FUNC with the
>> + argument ARG, returning to the original TYPE namespace afterwards.
>> + If process PID has the same TYPE namespace as the current process,
>> + or if TYPE namespaces are not supported, just call FUNC with ARG.
>> + Return nonzero if FUNC was called, zero otherwise (and set ERRNO). */
>> +
>> +extern int linux_ns_enter (int pid, const char *type,
>> + void (*func) (void *), void *arg);
>
>
> So the function:
>
> #1 - enters the namespace
> #2 - calls func
> #3 - exits the namespace.
>
> IMO, "linux_ns_ENTER" isn't a good name for that. I'd expect that a function
> called "enter" do just #1 above. Something like "linux_ns_do",
> "linux_do_in_ns", "linux_in_ns", etc., would be clearer, IMO.

with_linux_ns ?

full disclosure: borrowed from Scheme
/ducks