rust/helpers/task.c
Source file repositories/reference/linux-study-clean/rust/helpers/task.c
File Facts
- System
- Linux kernel
- Corpus path
rust/helpers/task.c- Extension
.c- Size
- 1233 bytes
- Lines
- 63
- Domain
- Rust Kernel Layer
- Bucket
- Rust API Membrane
- Inferred role
- Rust Kernel Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.
- Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/sched/task.h
Detected Declarations
function rust_helper_might_reschedfunction rust_helper_get_task_structfunction rust_helper_put_task_structfunction rust_helper_task_uidfunction rust_helper_task_euidfunction rust_helper_from_kuidfunction rust_helper_uid_eqfunction rust_helper_current_euidfunction rust_helper_task_tgid_nr_ns
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/sched/task.h>
__rust_helper void rust_helper_might_resched(void)
{
might_resched();
}
__rust_helper struct task_struct *rust_helper_get_current(void)
{
return current;
}
__rust_helper void rust_helper_get_task_struct(struct task_struct *t)
{
get_task_struct(t);
}
__rust_helper void rust_helper_put_task_struct(struct task_struct *t)
{
put_task_struct(t);
}
__rust_helper kuid_t rust_helper_task_uid(struct task_struct *task)
{
return task_uid(task);
}
__rust_helper kuid_t rust_helper_task_euid(struct task_struct *task)
{
return task_euid(task);
}
#ifndef CONFIG_USER_NS
__rust_helper uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_t uid)
{
return from_kuid(to, uid);
}
#endif /* CONFIG_USER_NS */
__rust_helper bool rust_helper_uid_eq(kuid_t left, kuid_t right)
{
return uid_eq(left, right);
}
__rust_helper kuid_t rust_helper_current_euid(void)
{
return current_euid();
}
__rust_helper struct user_namespace *rust_helper_current_user_ns(void)
{
return current_user_ns();
}
__rust_helper pid_t rust_helper_task_tgid_nr_ns(struct task_struct *tsk,
struct pid_namespace *ns)
{
return task_tgid_nr_ns(tsk, ns);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/sched/task.h`.
- Detected declarations: `function rust_helper_might_resched`, `function rust_helper_get_task_struct`, `function rust_helper_put_task_struct`, `function rust_helper_task_uid`, `function rust_helper_task_euid`, `function rust_helper_from_kuid`, `function rust_helper_uid_eq`, `function rust_helper_current_euid`, `function rust_helper_task_tgid_nr_ns`.
- Atlas domain: Rust Kernel Layer / Rust API Membrane.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.