In the file util-linux-2.17.2/mount/umount.c
, line #246, it is written res = umount (node);
.
But where's the umount
function located? I've searched so much, but didn't find.
umount is a call to the library function of the same name in libc. This function in turn makes a call to the umount system call. How a library function makes a call to the kernel to execute a particular function can be found out by reading about how system calls works. This link might help you in the process How do system calls work?
If you want to know where the system call umount is present, then download the latest kernel. Go to file fs/namespace.c. There you will find
SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
and
SYSCALL_DEFINE1(oldumount, char __user *, name)
which define the umount and the oldumount functions.