2 ms·
You know that convention where a program’s first argument is the name of the program? Behind the scenes the Program For Execution needs to go to Kernel where it
by naman5a 1y ago
You know that convention where a program’s first argument is the name of the program?
Behind the scenes the Program For Execution needs to go to Kernel where it will be executed by syscall .
The syscall for execution is execve
and the call signature for that is int execve(const char filename, char const argv[], char *const envp[]);
The filename argument is passed to a getname() function, which copies the string from user space to kernel space and does some usage tracking things. It returns a filename struct, which is defined in include/linux/fs.h. It stores a pointer to the original string in user space as well as a new pointer to the value copied to kernel space: