S
S
Sane Barbarian2017-04-05 20:10:27
linux
Sane Barbarian, 2017-04-05 20:10:27

What memory do libc system calls run in?

I deal with User Space and Kernel Space, I found out that the processes of the kernel itself are launched in the Kernel space, aka the code that was loaded from under the Kernel. Userspace is the memory where standard user processes run.
The question is, do processes called from Libc (glibc) run in Kernel or User space, or both? (as I know, we constantly refer to libc during a system call)
Please correct me if I'm floating ....
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-04-05
@SaneBarbarian

processes called from Libc (glibc) run in Kernel or User space

libc is part of the user process. It accesses the kernel through system calls. System calls are made by the kernel in kernel space. libc does additional processing in user space, such as converting error codes and updating errno.
For example, the program calls printf (3) , libc parses the format string in a loop and calls the write (2) system call , execution switches to kernel mode, the kernel prints characters to the stdout of the current process, execution returns to user space, libc checks that there were no errors and either continues the loop to the end of the format string, or updates errno and returns the result.
Some libc functions run entirely in userspace, such as sprintf (3) .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question