static ProcessHandle find_pidns_parent(pid_t pid) {
	// identify current pid namespace
	struct stat self_pidns;
	if (stat("/proc/self/ns/pid", &self_pidns) < 0)
		errExit("stat");

	ProcessHandle process = pin_process(pid);

	// in case pid is member of a different pid namespace
	// find parent who created that namespace
	while (1) {
		struct stat dest_pidns;
		process_stat(process, "ns/pid", &dest_pidns);

		if (dest_pidns.st_ino == self_pidns.st_ino &&
		    dest_pidns.st_dev == self_pidns.st_dev)
			break; // always true for init process

		// next parent process
		ProcessHandle next = pin_parent_process(process);
		unpin_process(process);
		process = next;
	}

	return process;
}
static ProcessHandle find_pidns_parent(pid_t pid) {
	 
	struct stat self_pidns;
	if (stat("/proc/self/ns/pid", &self_pidns) < 0)
		errExit("stat");

	ProcessHandle process = pin_process(pid);

	 
	 
	while (1) {
		struct stat dest_pidns;
		process_stat(process, "ns/pid", &dest_pidns);

		if (dest_pidns.st_ino == self_pidns.st_ino &&
		    dest_pidns.st_dev == self_pidns.st_dev)
			break;  

		 
		ProcessHandle next = pin_parent_process(process);
		unpin_process(process);
		process = next;
	}

	return process;
}