arch/um/os-Linux/tty.c
Source file repositories/reference/linux-study-clean/arch/um/os-Linux/tty.c
File Facts
- System
- Linux kernel
- Corpus path
arch/um/os-Linux/tty.c- Extension
.c- Size
- 1043 bytes
- Lines
- 61
- Domain
- Architecture Layer
- Bucket
- arch/um
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdlib.hunistd.herrno.hfcntl.hkern_util.hos.h
Detected Declarations
struct grantpt_infofunction grantpt_cbfunction get_pty
Annotated Snippet
struct grantpt_info {
int fd;
int res;
int err;
};
static void grantpt_cb(void *arg)
{
struct grantpt_info *info = arg;
info->res = grantpt(info->fd);
info->err = errno;
}
int get_pty(void)
{
struct grantpt_info info;
int fd, err;
fd = open("/dev/ptmx", O_RDWR);
if (fd < 0) {
err = -errno;
printk(UM_KERN_ERR "get_pty : Couldn't open /dev/ptmx - "
"err = %d\n", errno);
return err;
}
info.fd = fd;
initial_thread_cb(grantpt_cb, &info);
if (info.res < 0) {
err = -info.err;
printk(UM_KERN_ERR "get_pty : Couldn't grant pty - "
"errno = %d\n", -info.err);
goto out;
}
if (unlockpt(fd) < 0) {
err = -errno;
printk(UM_KERN_ERR "get_pty : Couldn't unlock pty - "
"errno = %d\n", errno);
goto out;
}
return fd;
out:
close(fd);
return err;
}
Annotation
- Immediate include surface: `stdlib.h`, `unistd.h`, `errno.h`, `fcntl.h`, `kern_util.h`, `os.h`.
- Detected declarations: `struct grantpt_info`, `function grantpt_cb`, `function get_pty`.
- Atlas domain: Architecture Layer / arch/um.
- 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.