mm/memfd.c

Source file repositories/reference/linux-study-clean/mm/memfd.c

File Facts

System
Linux kernel
Corpus path
mm/memfd.c
Extension
.c
Size
13213 bytes
Lines
524
Domain
Core OS
Bucket
Memory Management
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_DEFINE2(memfd_create,
		const char __user *, uname,
		unsigned int, flags)
{
	char *name __free(kfree) = NULL;
	unsigned int fd_flags;
	int error;

	error = sanitize_flags(&flags);
	if (error < 0)
		return error;

	name = alloc_name(uname);
	if (IS_ERR(name))
		return PTR_ERR(name);

	fd_flags = (flags & MFD_CLOEXEC) ? O_CLOEXEC : 0;
	return FD_ADD(fd_flags, memfd_alloc_file(name, flags));
}

Annotation

Implementation Notes