tools/testing/selftests/landlock/scoped_common.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/landlock/scoped_common.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/landlock/scoped_common.h
Extension
.h
Size
631 bytes
Lines
29
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

#define _GNU_SOURCE

#include <sys/types.h>

static void create_scoped_domain(struct __test_metadata *const _metadata,
				 const __u16 scope)
{
	int ruleset_fd;
	const struct landlock_ruleset_attr ruleset_attr = {
		.scoped = scope,
	};

	ruleset_fd =
		landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0);
	ASSERT_LE(0, ruleset_fd)
	{
		TH_LOG("Failed to create a ruleset: %s", strerror(errno));
	}
	enforce_ruleset(_metadata, ruleset_fd);
	EXPECT_EQ(0, close(ruleset_fd));
}

Annotation

Implementation Notes