arch/alpha/kernel/osf_sys.c
Source file repositories/reference/linux-study-clean/arch/alpha/kernel/osf_sys.c
File Facts
- System
- Linux kernel
- Corpus path
arch/alpha/kernel/osf_sys.c- Extension
.c- Size
- 31537 bytes
- Lines
- 1304
- Domain
- Architecture Layer
- Bucket
- arch/alpha
- Inferred role
- Architecture Layer: syscall or user/kernel boundary
- Status
- core 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 participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
- 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/errno.hlinux/sched/signal.hlinux/sched/mm.hlinux/sched/task_stack.hlinux/sched/cputime.hlinux/kernel.hlinux/mm.hlinux/smp.hlinux/stddef.hlinux/syscalls.hlinux/unistd.hlinux/ptrace.hlinux/user.hlinux/utsname.hlinux/time.hlinux/timex.hlinux/major.hlinux/stat.hlinux/mman.hlinux/shm.hlinux/poll.hlinux/file.hlinux/types.hlinux/ipc.hlinux/namei.hlinux/mount.hlinux/uio.hlinux/vfs.hlinux/rcupdate.hlinux/slab.hasm/fpu.hasm/io.h
Detected Declarations
syscall osf_brksyscall osf_set_program_attributessyscall osf_getdirentriessyscall osf_mmapsyscall osf_statfssyscall osf_statsyscall osf_lstatsyscall osf_fstatsyscall osf_fstatfssyscall osf_statfs64syscall osf_fstatfs64syscall osf_mountsyscall osf_utsnamesyscall getpagesizesyscall getdtablesizesyscall osf_getdomainnamesyscall osf_proplist_syscallsyscall osf_sigstacksyscall osf_sysinfosyscall osf_getsysinfosyscall osf_setsysinfosyscall osf_gettimeofdaysyscall osf_settimeofdaysyscall osf_utimessyscall osf_selectsyscall osf_getrusagesyscall osf_wait4syscall osf_usleep_threadsyscall old_adjtimexsyscall osf_getprioritysyscall getxuidsyscall getxgidsyscall getxpidsyscall alpha_pipesyscall sethaestruct osf_direntstruct osf_dirent_callbackstruct osf_statstruct osf_statfsstruct osf_statfs64struct ufs_argsstruct cdfs_argsstruct procfs_argsstruct proplistname_argsstruct setargsstruct fsetargsstruct getargsstruct fgetargs
Annotated Snippet
SYSCALL_DEFINE1(osf_brk, unsigned long, brk)
{
unsigned long retval = sys_brk(brk);
if (brk && brk != retval)
retval = -ENOMEM;
return retval;
}
/*
* This is pure guess-work..
*/
SYSCALL_DEFINE4(osf_set_program_attributes, unsigned long, text_start,
unsigned long, text_len, unsigned long, bss_start,
unsigned long, bss_len)
{
struct mm_struct *mm;
mm = current->mm;
mm->end_code = bss_start + bss_len;
mm->start_brk = bss_start + bss_len;
mm->brk = bss_start + bss_len;
#if 0
printk("set_program_attributes(%lx %lx %lx %lx)\n",
text_start, text_len, bss_start, bss_len);
#endif
return 0;
}
/*
* OSF/1 directory handling functions...
*
* The "getdents()" interface is much more sane: the "basep" stuff is
* braindamage (it can't really handle filesystems where the directory
* offset differences aren't the same as "d_reclen").
*/
#define NAME_OFFSET offsetof (struct osf_dirent, d_name)
struct osf_dirent {
unsigned int d_ino;
unsigned short d_reclen;
unsigned short d_namlen;
char d_name[];
};
struct osf_dirent_callback {
struct dir_context ctx;
struct osf_dirent __user *dirent;
long __user *basep;
unsigned int count;
int error;
};
static bool
osf_filldir(struct dir_context *ctx, const char *name, int namlen,
loff_t offset, u64 ino, unsigned int d_type)
{
struct osf_dirent __user *dirent;
struct osf_dirent_callback *buf =
container_of(ctx, struct osf_dirent_callback, ctx);
unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32));
unsigned int d_ino;
buf->error = -EINVAL; /* only used if we fail */
if (reclen > buf->count)
return false;
d_ino = ino;
if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
buf->error = -EOVERFLOW;
return false;
}
if (buf->basep) {
if (put_user(offset, buf->basep))
goto Efault;
buf->basep = NULL;
}
dirent = buf->dirent;
if (put_user(d_ino, &dirent->d_ino) ||
put_user(namlen, &dirent->d_namlen) ||
put_user(reclen, &dirent->d_reclen) ||
copy_to_user(dirent->d_name, name, namlen) ||
put_user(0, dirent->d_name + namlen))
goto Efault;
dirent = (void __user *)dirent + reclen;
buf->dirent = dirent;
buf->count -= reclen;
return true;
Efault:
buf->error = -EFAULT;
return false;
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sched/signal.h`, `linux/sched/mm.h`, `linux/sched/task_stack.h`, `linux/sched/cputime.h`, `linux/kernel.h`, `linux/mm.h`, `linux/smp.h`.
- Detected declarations: `syscall osf_brk`, `syscall osf_set_program_attributes`, `syscall osf_getdirentries`, `syscall osf_mmap`, `syscall osf_statfs`, `syscall osf_stat`, `syscall osf_lstat`, `syscall osf_fstat`, `syscall osf_fstatfs`, `syscall osf_statfs64`.
- Atlas domain: Architecture Layer / arch/alpha.
- Implementation status: core 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.