Calling syscalls from the kernel
Calling syscalls from the kernel
Posted Aug 11, 2014 12:45 UTC (Mon) by rwmj (subscriber, #5474)In reply to: Calling syscalls from the kernel by YogeshC
Parent article: Anatomy of a system call, part 1
No one answered your question so I'll have a go.
The main user of sys_read at the moment is the code for unpacking the initramfs. You could imagine this "should" be done by a userspace process, because it's doing a lot of userspace-type stuff, like uncompressing a cpio file and then creating a tree of directories and files from it. It's nearly the equivalent of running:
zcat initramfs | cpio -idHowever because the initramfs is needed before userspace is up -- because creating the initramfs is creating the initial userspace -- they have to do this userspace-type stuff in the kernel instead.
So it's a layering violation, but for understandable reasons.
