kernel/nstree.c

Source file repositories/reference/linux-study-clean/kernel/nstree.c

File Facts

System
Linux kernel
Corpus path
kernel/nstree.c
Extension
.c
Size
18828 bytes
Lines
793
Domain
Core OS
Bucket
Scheduler, Processes, Timers, Sync, And Syscalls
Inferred role
Core OS: syscall or user/kernel boundary
Status
core implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

SYSCALL_DEFINE4(listns, const struct ns_id_req __user *, req,
		u64 __user *, ns_ids, size_t, nr_ns_ids, unsigned int, flags)
{
	struct klistns klns __free(klistns_free) = {};
	const size_t maxcount = 1000000;
	struct ns_id_req kreq;
	ssize_t ret;

	if (flags)
		return -EINVAL;

	if (unlikely(nr_ns_ids > maxcount))
		return -EOVERFLOW;

	if (!access_ok(ns_ids, nr_ns_ids * sizeof(*ns_ids)))
		return -EFAULT;

	ret = copy_ns_id_req(req, &kreq);
	if (ret)
		return ret;

	ret = prepare_klistns(&klns, &kreq, ns_ids, nr_ns_ids);
	if (ret)
		return ret;

	if (kreq.user_ns_id)
		return do_listns_userns(&klns);

	return do_listns(&klns);
}

Annotation

Implementation Notes