xid = -1: - on host? or at least !LOCK, then proceed - get a new context id (dynamic) - switch_user_struct (new id) if okay then - lower current caps - alloc s_info if successful - call set_initpid (flags) - current flags |= flags if not revert old id xid = -2 - set_initpid (flags) if okay then - lower current caps - if current flags & INIT current initpid = pid - current flags |= flags - return xid xid = >0, <= MAX - search for context if not found create new one - switch_user_struct (new id) if okay then - lower current caps - current flags |= flags set_initpid (flags) no s_info, return -EINVAL initpid already set, return -EPERM else current initpid = pid