If a process has /var as its cwd, and makes the syscall chdir("..") how does the cwd becomes / and not /var/.. ?
I tried reading linux's source but there are to many macros for me to understand what's happening...
Edit: I know that / and /var/.. both point to the same inode, but there are different directory entries stored in different directories, with different names. My question is: how does the linux kernel decides that ("/", 2) -> ("var", 11) -> ("..", 2) should become ("/", 2) ?
(With dirents written as (name, inode))
Context: I'm currently writing the vfs of my kernel, and I don't know what is the "cleanest" solution. My current solution is to check, each time I'm accessing a child dirent, if it has the same pointer to in-memory inode as its parent.