fs/signalfd.c
Source file repositories/reference/linux-study-clean/fs/signalfd.c
File Facts
- System
- Linux kernel
- Corpus path
fs/signalfd.c- Extension
.c- Size
- 8849 bytes
- Lines
- 352
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: syscall or user/kernel boundary
- Status
- core 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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
linux/file.hlinux/poll.hlinux/init.hlinux/fs.hlinux/sched.hlinux/slab.hlinux/kernel.hlinux/signal.hlinux/list.hlinux/anon_inodes.hlinux/signalfd.hlinux/syscalls.hlinux/proc_fs.hlinux/compat.h
Detected Declarations
syscall signalfd4syscall signalfdstruct signalfd_ctxfunction Copyrightfunction signalfd_releasefunction signalfd_pollfunction copy_siginfo_to_userfunction signalfd_dequeuefunction signalfd_read_iterfunction signalfd_show_fdinfofunction do_signalfd4function do_compat_signalfd4
Annotated Snippet
SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
size_t, sizemask, int, flags)
{
sigset_t mask;
if (sizemask != sizeof(sigset_t))
return -EINVAL;
if (copy_from_user(&mask, user_mask, sizeof(mask)))
return -EFAULT;
return do_signalfd4(ufd, &mask, flags);
}
SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
size_t, sizemask)
{
sigset_t mask;
if (sizemask != sizeof(sigset_t))
return -EINVAL;
if (copy_from_user(&mask, user_mask, sizeof(mask)))
return -EFAULT;
return do_signalfd4(ufd, &mask, 0);
}
#ifdef CONFIG_COMPAT
static long do_compat_signalfd4(int ufd,
const compat_sigset_t __user *user_mask,
compat_size_t sigsetsize, int flags)
{
sigset_t mask;
if (sigsetsize != sizeof(compat_sigset_t))
return -EINVAL;
if (get_compat_sigset(&mask, user_mask))
return -EFAULT;
return do_signalfd4(ufd, &mask, flags);
}
COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
const compat_sigset_t __user *, user_mask,
compat_size_t, sigsetsize,
int, flags)
{
return do_compat_signalfd4(ufd, user_mask, sigsetsize, flags);
}
COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd,
const compat_sigset_t __user *, user_mask,
compat_size_t, sigsetsize)
{
return do_compat_signalfd4(ufd, user_mask, sigsetsize, 0);
}
#endif
Annotation
- Immediate include surface: `linux/file.h`, `linux/poll.h`, `linux/init.h`, `linux/fs.h`, `linux/sched.h`, `linux/slab.h`, `linux/kernel.h`, `linux/signal.h`.
- Detected declarations: `syscall signalfd4`, `syscall signalfd`, `struct signalfd_ctx`, `function Copyright`, `function signalfd_release`, `function signalfd_poll`, `function copy_siginfo_to_user`, `function signalfd_dequeue`, `function signalfd_read_iter`, `function signalfd_show_fdinfo`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: core implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.