man 2 pivot_root
pivot_root()moves the root file system of the current process to the directory _put_old_ and makes _new_root_ the new root file system of the current process.
int pivot_root(const char *new_root, const char *put_old);
While reading this I got following doubts
- What is the use of _put_old_? Is it is used only by kernal for its internal purpose or do we have any use with this?
- Why current filesystem should move to _put_old_ directory?
- Why _put_old_ directory should be under the _new_root_ directory?
Official doc clearly explains what we wanted to do if we wanted to utilize
pivot_root syscall but I feel doc not clearly explained why it is enforcing these many rules and what it is doing behind the scene.
Someone who knows this kindly help me to solve this.