arch/alpha/kernel/termios.c
Source file repositories/reference/linux-study-clean/arch/alpha/kernel/termios.c
File Facts
- System
- Linux kernel
- Corpus path
arch/alpha/kernel/termios.c- Extension
.c- Size
- 1771 bytes
- Lines
- 57
- Domain
- Architecture Layer
- Bucket
- arch/alpha
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/termios_internal.h
Detected Declarations
function user_termio_to_kernel_termiosfunction kernel_termios_to_user_termio
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/termios_internal.h>
int user_termio_to_kernel_termios(struct ktermios *termios,
struct termio __user *termio)
{
struct termio v;
bool canon;
if (copy_from_user(&v, termio, sizeof(struct termio)))
return -EFAULT;
termios->c_iflag = (0xffff0000 & termios->c_iflag) | v.c_iflag;
termios->c_oflag = (0xffff0000 & termios->c_oflag) | v.c_oflag;
termios->c_cflag = (0xffff0000 & termios->c_cflag) | v.c_cflag;
termios->c_lflag = (0xffff0000 & termios->c_lflag) | v.c_lflag;
termios->c_line = (0xffff0000 & termios->c_lflag) | v.c_line;
canon = v.c_lflag & ICANON;
termios->c_cc[VINTR] = v.c_cc[_VINTR];
termios->c_cc[VQUIT] = v.c_cc[_VQUIT];
termios->c_cc[VERASE] = v.c_cc[_VERASE];
termios->c_cc[VKILL] = v.c_cc[_VKILL];
termios->c_cc[VEOL2] = v.c_cc[_VEOL2];
termios->c_cc[VSWTC] = v.c_cc[_VSWTC];
termios->c_cc[canon ? VEOF : VMIN] = v.c_cc[_VEOF];
termios->c_cc[canon ? VEOL : VTIME] = v.c_cc[_VEOL];
return 0;
}
int kernel_termios_to_user_termio(struct termio __user *termio,
struct ktermios *termios)
{
struct termio v;
bool canon;
memset(&v, 0, sizeof(struct termio));
v.c_iflag = termios->c_iflag;
v.c_oflag = termios->c_oflag;
v.c_cflag = termios->c_cflag;
v.c_lflag = termios->c_lflag;
v.c_line = termios->c_line;
canon = v.c_lflag & ICANON;
v.c_cc[_VINTR] = termios->c_cc[VINTR];
v.c_cc[_VQUIT] = termios->c_cc[VQUIT];
v.c_cc[_VERASE] = termios->c_cc[VERASE];
v.c_cc[_VKILL] = termios->c_cc[VKILL];
v.c_cc[_VEOF] = termios->c_cc[canon ? VEOF : VMIN];
v.c_cc[_VEOL] = termios->c_cc[canon ? VEOL : VTIME];
v.c_cc[_VEOL2] = termios->c_cc[VEOL2];
v.c_cc[_VSWTC] = termios->c_cc[VSWTC];
return copy_to_user(termio, &v, sizeof(struct termio));
}
Annotation
- Immediate include surface: `linux/termios_internal.h`.
- Detected declarations: `function user_termio_to_kernel_termios`, `function kernel_termios_to_user_termio`.
- Atlas domain: Architecture Layer / arch/alpha.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.