I'd like to know where to find the code lines that actually open the standard file descriptors (stdin, stdout, stderr) in a Linux/Glibc stack. I expect them to be in the glibc, but it would also be possible that they are written in the kernel and standard file descriptors are already open on spawning the process.
If it is in the libc, I'm specifically interested in the syscall parameters. (I assume it to be a "open" syscall.)
FYI, I want to use this as an inspiration for coding a libc for my x86 kernel.
Thanks in advance,