include/linux/compat.h
Source file repositories/reference/linux-study-clean/include/linux/compat.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/compat.h- Extension
.h- Size
- 33337 bytes
- Lines
- 992
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/time.hlinux/stat.hlinux/param.hlinux/sem.hlinux/socket.hlinux/if.hlinux/fs.hlinux/aio_abi.hlinux/uaccess.hlinux/unistd.hasm/compat.hasm/siginfo.hasm/signal.hasm/syscall_wrapper.h
Detected Declarations
struct compat_iovecstruct compat_sel_arg_structstruct rusagestruct old_itimerval32struct compat_tmsstruct compat_sigactionstruct compat_rlimitstruct compat_flockstruct compat_flock64struct compat_rusagestruct compat_siginfostruct __compat_aio_sigsetstruct compat_direntstruct compat_ustatstruct compat_ifmapstruct compat_if_settingsstruct compat_ifreqstruct compat_ifconfstruct compat_robust_liststruct compat_robust_list_headstruct compat_old_sigactionstruct compat_keyctl_kdf_paramsstruct compat_statstruct compat_statfsstruct compat_statfs64struct compat_old_linux_direntstruct compat_linux_direntstruct linux_dirent64struct compat_msghdrstruct compat_mmsghdrstruct compat_sysinfostruct compat_sysctl_argsstruct compat_kexec_segmentstruct compat_mq_attrstruct compat_msgbufstruct epoll_eventfunction put_compat_sigsetfunction ns_to_old_timeval32function in_compat_syscallfunction in_compat_syscallfunction ptr_to_compat
Annotated Snippet
struct compat_iovec {
compat_uptr_t iov_base;
compat_size_t iov_len;
};
#ifndef compat_user_stack_pointer
#define compat_user_stack_pointer() current_user_stack_pointer()
#endif
#ifndef compat_sigaltstack /* we'll need that for MIPS */
typedef struct compat_sigaltstack {
compat_uptr_t ss_sp;
int ss_flags;
compat_size_t ss_size;
} compat_stack_t;
#endif
#ifndef COMPAT_MINSIGSTKSZ
#define COMPAT_MINSIGSTKSZ MINSIGSTKSZ
#endif
#define compat_jiffies_to_clock_t(x) \
(((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
typedef __compat_uid32_t compat_uid_t;
typedef __compat_gid32_t compat_gid_t;
struct compat_sel_arg_struct;
struct rusage;
struct old_itimerval32;
struct compat_tms {
compat_clock_t tms_utime;
compat_clock_t tms_stime;
compat_clock_t tms_cutime;
compat_clock_t tms_cstime;
};
#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
typedef struct {
compat_sigset_word sig[_COMPAT_NSIG_WORDS];
} compat_sigset_t;
int set_compat_user_sigmask(const compat_sigset_t __user *umask,
size_t sigsetsize);
struct compat_sigaction {
#ifndef __ARCH_HAS_IRIX_SIGACTION
compat_uptr_t sa_handler;
compat_ulong_t sa_flags;
#else
compat_uint_t sa_flags;
compat_uptr_t sa_handler;
#endif
#ifdef __ARCH_HAS_SA_RESTORER
compat_uptr_t sa_restorer;
#endif
compat_sigset_t sa_mask __packed;
};
typedef union compat_sigval {
compat_int_t sival_int;
compat_uptr_t sival_ptr;
} compat_sigval_t;
typedef struct compat_siginfo {
int si_signo;
#ifndef __ARCH_HAS_SWAPPED_SIGINFO
int si_errno;
int si_code;
#else
int si_code;
int si_errno;
#endif
union {
int _pad[128/sizeof(int) - 3];
/* kill() */
struct {
compat_pid_t _pid; /* sender's pid */
__compat_uid32_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
struct {
compat_timer_t _tid; /* timer id */
int _overrun; /* overrun count */
compat_sigval_t _sigval; /* same as below */
} _timer;
Annotation
- Immediate include surface: `linux/types.h`, `linux/time.h`, `linux/stat.h`, `linux/param.h`, `linux/sem.h`, `linux/socket.h`, `linux/if.h`, `linux/fs.h`.
- Detected declarations: `struct compat_iovec`, `struct compat_sel_arg_struct`, `struct rusage`, `struct old_itimerval32`, `struct compat_tms`, `struct compat_sigaction`, `struct compat_rlimit`, `struct compat_flock`, `struct compat_flock64`, `struct compat_rusage`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.