tools/testing/selftests/riscv/mm/mmap_test.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/riscv/mm/mmap_test.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/riscv/mm/mmap_test.h
Extension
.h
Size
574 bytes
Lines
24
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef _TESTCASES_MMAP_TEST_H
#define _TESTCASES_MMAP_TEST_H
#include <sys/mman.h>
#include <sys/resource.h>
#include <stddef.h>
#include <strings.h>
#include "kselftest_harness.h"

#define TOP_DOWN 0
#define BOTTOM_UP 1

#define PROT (PROT_READ | PROT_WRITE)
#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS)

static inline int memory_layout(void)
{
	void *value1 = mmap(NULL, sizeof(int), PROT, FLAGS, 0, 0);
	void *value2 = mmap(NULL, sizeof(int), PROT, FLAGS, 0, 0);

	return value2 > value1;
}
#endif /* _TESTCASES_MMAP_TEST_H */

Annotation

Implementation Notes