From 682e1329f912b11edf9f7f6332ea292bf7404105 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 10 Sep 2019 11:35:37 +0200 Subject: [PATCH] pivot_root.2: Eliminate text suggesting that behavior may change in the future After around 19 years, the behavior of pivot_root() has not been changed, and will almost certainly not change in the future. So, reword to remove the suggestion that the behavior may change. Also, more clearly document the effect of pivot_root() on the calling process's current working directory. Signed-off-by: Michael Kerrisk --- man2/pivot_root.2 | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/man2/pivot_root.2 b/man2/pivot_root.2 index 68ffb8e03..a2099144a 100644 --- a/man2/pivot_root.2 +++ b/man2/pivot_root.2 @@ -33,7 +33,7 @@ the same mount namespace as the caller of .BR pivot_root (). The caller of .BR pivot_root () -must ensure that processes with root or current working directory +should ensure that processes with root or current working directory at the old root operate correctly in either case. An easy way to ensure this is to change their root and current working directory to \fInew_root\fP before invoking @@ -45,20 +45,25 @@ It is therefore recommended to call \fBchdir("/")\fP immediately after .BR pivot_root (). .PP -The paragraph above is intentionally vague because the implementation of -.BR pivot_root () -may change in the future -(or so it was thought when this system call was first added). -However, -the behavior on this point has remained consistent since +The paragraph above is intentionally vague because at the time when .BR pivot_root () +was first implemented, it was unclear whether its affect +on other process's root and current working directories\(emand +the caller's current working directory\(emmight change in the future. +However, the behavior has remained consistent since this system call was first implemented: .BR pivot_root () changes the root directory and the current working directory of each process or thread in the same mount namespace to .I new_root if they point to the old root directory. -See also NOTES. +(See also NOTES.) +On the other hand, +.BR pivot_root () +does not change the caller's current working directory +(unless it is on the old root directory), +and thus it should be followed by a +\fBchdir("/")\fP call. .PP The following restrictions apply: .IP \- 3