Bug 203105
Summary: | Wrong description of CLONE_CHILD_SETTID | ||
---|---|---|---|
Product: | Documentation | Reporter: | Jakub Nowak (jakub.jakub.nowak) |
Component: | man-pages | Assignee: | documentation_man-pages (documentation_man-pages) |
Status: | RESOLVED CODE_FIX | ||
Severity: | low | CC: | jakub.jakub.nowak, linux-man, mtk.manpages |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | Subsystem: | ||
Regression: | No | Bisected commit-id: |
Description
Jakub Nowak
2019-03-29 19:40:59 UTC
Jakub, I'm not quite sure if I understand your report. The manual page text says: CLONE_CHILD_SETTID (since Linux 2.5.49) Store the child thread ID at the location ctid in the child's memory. The store operation completes before clone() returns control to user space. I don't see what part of your report or your sample program contradicts that. Could you say a bit more please? Thanks, Michael Michael, Sorry, English is not my native language. I'll try to describe it better. I've made a mistake when I've said what the program prints, it should be: parent, ctid: 0 child, ctid: 24379 parent, ctid: 24379 where 24379 is a tid of the child. The sentence "The store operation completes before clone() returns control to user space" from manual page isn't correct. As can be seen in this example program, the ctid value printed _right after_ returning from clone() is 0. The manual page says that it should be set before clone() returns, but it's not. It then prints non-zero value after the sleep. This shows that the value isn't set before clone() returns but rather later on, after some time. Thank you for your patience, Jakub Hello Jakub, Okay, now I understand what you meant to say. (Perhaps I should have worked it out to begin with!) The text of the page says: CLONE_CHILD_SETTID (since Linux 2.5.49) Store the child thread ID at the location ctid in the child's memory. The store operation completes before clone() returns control to user space. When I read that text, then because the first sentence meantipns the child's memory, I naturally read the second sentence as implying *before clone() returns in the child*. But I also that other's might not take that implication, so I changed the text to read: CLONE_CHILD_SETTID (since Linux 2.5.49) Store the child thread ID at the location ctid in the child's memory. The store operation completes before clone() returns control to user space in the child process. Thanks, Michael So, I revisited this, and realized that I wrote the sentence against which you reported the bug. I hope that I was at that time thinking what I said in comment 3! However, I think it does not hurt to say even more in the manual page, so I amended it further to say: Store the child thread ID at the location ctid in the child's memory. The store operation completes before clone() returns control to user space in the child process. (Note that the store operation may not have completed before clone() returns in the parent process, which will be relevant if the CLONE_VM flag is also employed.) |