K
K
k3rnel2016-12-12 03:04:18
linux
k3rnel, 2016-12-12 03:04:18

Where is the system call open() source code?

Goodnight. I want to look at the implementation of the open() system call that glibc's fopen() does. There is no open() function in fs/open.c. There is only something similar to it, but everything is in macros, and the macros themselves are defined through macros, as a result, 5-storey macros and nothing is clear. Am I looking there? How to understand kernel code? I would not say that this is the pure code.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
CityCat4, 2016-12-12
@CityCat4

This is the most pure code. Start with man open and see how many open types there are. It’s too lazy for me to go into the source of the bucket now, but one hundred percent - all these open-s are reduced by macros to one of some __open (), which transfers the call to the kernel, to some __kernel_open ()

J
jcmvbkbc, 2016-12-12
@jcmvbkbc

There is no open() function in fs/open.c

Yes, here it is: lxr.free-electrons.com/source/fs/open.c#L1049
SYSCALL_DEFINEx is an implementation of a system call with x parameters, the first word in brackets is the name of the call, then x pairs: type parameter and parameter name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question