arch/arm/kernel/sys_oabi-compat.c
Source file repositories/reference/linux-study-clean/arch/arm/kernel/sys_oabi-compat.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/kernel/sys_oabi-compat.c- Extension
.c- Size
- 12807 bytes
- Lines
- 515
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/syscalls.hlinux/syscalls.hlinux/errno.hlinux/fs.hlinux/filelock.hlinux/cred.hlinux/fcntl.hlinux/eventpoll.hlinux/sem.hlinux/socket.hlinux/net.hlinux/ipc.hlinux/ipc_namespace.hlinux/uaccess.hlinux/slab.hasm/syscall.h
Detected Declarations
struct oldabi_stat64struct oabi_flock64struct oabi_epoll_eventstruct oabi_sembuffunction cp_oldabi_stat64function sys_oabi_stat64function sys_oabi_lstat64function sys_oabi_fstat64function sys_oabi_fstatat64function get_oabi_flockfunction put_oabi_flockfunction sys_oabi_fcntl64function sys_oabi_epoll_ctlfunction sys_oabi_epoll_ctlfunction epoll_put_ueventfunction sys_oabi_semtimedopfunction sys_oabi_semopfunction sys_oabi_ipcfunction sys_oabi_semtimedopfunction sys_oabi_semopfunction sys_oabi_ipcfunction sys_oabi_bindfunction sys_oabi_connectfunction sys_oabi_sendtofunction sys_oabi_sendmsgfunction get_userfunction sys_oabi_socketcall
Annotated Snippet
struct oldabi_stat64 {
unsigned long long st_dev;
unsigned int __pad1;
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned int __pad2;
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
} __attribute__ ((packed,aligned(4)));
static long cp_oldabi_stat64(struct kstat *stat,
struct oldabi_stat64 __user *statbuf)
{
struct oldabi_stat64 tmp;
tmp.st_dev = huge_encode_dev(stat->dev);
tmp.__pad1 = 0;
tmp.__st_ino = stat->ino;
tmp.st_mode = stat->mode;
tmp.st_nlink = stat->nlink;
tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid);
tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid);
tmp.st_rdev = huge_encode_dev(stat->rdev);
tmp.st_size = stat->size;
tmp.st_blocks = stat->blocks;
tmp.__pad2 = 0;
tmp.st_blksize = stat->blksize;
tmp.st_atime = stat->atime.tv_sec;
tmp.st_atime_nsec = stat->atime.tv_nsec;
tmp.st_mtime = stat->mtime.tv_sec;
tmp.st_mtime_nsec = stat->mtime.tv_nsec;
tmp.st_ctime = stat->ctime.tv_sec;
tmp.st_ctime_nsec = stat->ctime.tv_nsec;
tmp.st_ino = stat->ino;
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
}
asmlinkage long sys_oabi_stat64(const char __user * filename,
struct oldabi_stat64 __user * statbuf)
{
struct kstat stat;
int error = vfs_stat(filename, &stat);
if (!error)
error = cp_oldabi_stat64(&stat, statbuf);
return error;
}
asmlinkage long sys_oabi_lstat64(const char __user * filename,
struct oldabi_stat64 __user * statbuf)
{
struct kstat stat;
int error = vfs_lstat(filename, &stat);
if (!error)
error = cp_oldabi_stat64(&stat, statbuf);
return error;
}
asmlinkage long sys_oabi_fstat64(unsigned long fd,
struct oldabi_stat64 __user * statbuf)
{
struct kstat stat;
int error = vfs_fstat(fd, &stat);
if (!error)
error = cp_oldabi_stat64(&stat, statbuf);
return error;
}
asmlinkage long sys_oabi_fstatat64(int dfd,
const char __user *filename,
struct oldabi_stat64 __user *statbuf,
int flag)
Annotation
- Immediate include surface: `asm/syscalls.h`, `linux/syscalls.h`, `linux/errno.h`, `linux/fs.h`, `linux/filelock.h`, `linux/cred.h`, `linux/fcntl.h`, `linux/eventpoll.h`.
- Detected declarations: `struct oldabi_stat64`, `struct oabi_flock64`, `struct oabi_epoll_event`, `struct oabi_sembuf`, `function cp_oldabi_stat64`, `function sys_oabi_stat64`, `function sys_oabi_lstat64`, `function sys_oabi_fstat64`, `function sys_oabi_fstatat64`, `function get_oabi_flock`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.