int join_namespace(pid_t pid, char *typestr) {
	char path[64];
	snprintf(path, sizeof(path), "/proc/%d", pid);
	int fd = open(path, O_PATH|O_CLOEXEC);
	if (fd < 0) {
		fprintf(stderr, "Error: cannot open %s: %s\n", path, strerror(errno));
		exit(1);
	}

	int rv = join_namespace_by_fd(fd, typestr);
	close(fd);
	return rv;
}
int join_namespace(pid_t pid, char *typestr) {
	char path[64];
	snprintf(path, sizeof(path), "/proc/%d", pid);
	int fd = open(path, O_PATH|O_CLOEXEC);
	if (fd < 0) {
		fprintf(stderr, "Error: cannot open %s: %s\n", path, strerror(errno));
		exit(1);
	}

	int rv = join_namespace_by_fd(fd, typestr);
	close(fd);
	return rv;
}