The 3 system calls for manipulating namespaces are clone(2), setns(2) and unshare(2). Have a read through the namespaces(7) man page I linked to above, the man pages for those 3 system calls and also the pid_namespaces(7) and user_namespaces(7) man pages.