setns
Setns is a Linux system call that re-associates the calling process with an existing namespace. By using a file descriptor that refers to a namespace instance, setns can cause the process to adopt the resources, identifiers, and behavior of that namespace. This mechanism is central to how containers and namespace tools move processes between different isolated environments.
The function signature is int setns(int fd, int nstype). The fd must reference a namespace, for example
Privileges and constraints apply to setns. The operation is permitted only if the process has the necessary
Related concepts include unshare, which creates new namespaces, and nsenter, which provides a user-facing way to