How should we understand symlinks under `/proc/pid/fd`?
Clash Royale CLAN TAG#URR8PPP
They seems more like a link to inode instead a link to path.
What does the readlink()
mean to them, the canonical path of the inode from the calling process's root directory?
What happened when a process try to open them, will a new open file description to the inode be created?
linux symlink proc inode
add a comment |
They seems more like a link to inode instead a link to path.
What does the readlink()
mean to them, the canonical path of the inode from the calling process's root directory?
What happened when a process try to open them, will a new open file description to the inode be created?
linux symlink proc inode
1
The thing these points to varies. Could you edit your question to show exactly what you are seeing.
– Philip Couling
Feb 19 at 13:07
add a comment |
They seems more like a link to inode instead a link to path.
What does the readlink()
mean to them, the canonical path of the inode from the calling process's root directory?
What happened when a process try to open them, will a new open file description to the inode be created?
linux symlink proc inode
They seems more like a link to inode instead a link to path.
What does the readlink()
mean to them, the canonical path of the inode from the calling process's root directory?
What happened when a process try to open them, will a new open file description to the inode be created?
linux symlink proc inode
linux symlink proc inode
edited Feb 19 at 13:23
Jeff Schaller
43.4k1160140
43.4k1160140
asked Feb 19 at 12:54
炸鱼薯条德里克炸鱼薯条德里克
5821216
5821216
1
The thing these points to varies. Could you edit your question to show exactly what you are seeing.
– Philip Couling
Feb 19 at 13:07
add a comment |
1
The thing these points to varies. Could you edit your question to show exactly what you are seeing.
– Philip Couling
Feb 19 at 13:07
1
1
The thing these points to varies. Could you edit your question to show exactly what you are seeing.
– Philip Couling
Feb 19 at 13:07
The thing these points to varies. Could you edit your question to show exactly what you are seeing.
– Philip Couling
Feb 19 at 13:07
add a comment |
1 Answer
1
active
oldest
votes
What does the readlink() mean to them, the canonical path of the inode from the calling process's root directory?
For regular files, the link text seems related to the path the file was opened with, e.g.:
$ echo foo > abba
$ ln abba acdc
$ cat >> abba &
[1] 12312
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/abba
Renaming that name changes the shown path:
$ mv abba qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty
As does deleting it:
$ rm qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty (deleted)
Though opening a file through the link still finds the inode in question:
$ echo testtest > /proc/12312/fd/1
$ cat acdc
testtest
For non-regular files, it shows the inode type (e.g. pipe or socket), and the inode number, which might be visible somewhere in /proc
(e.g. /proc/net/tcp
for TCP sockets shows the inode numbers).
What happened when a process try to open them, will a new open file description to the inode be created?
That's my impression. I think I've seen posts here on unix.SE about that, but I haven't seen any "official" documentation. The behavior is definitely that of an independent file description; I wrote a program testing that in this answer on Stackoverflow just a while ago: Duplicating file descriptor and seeking through both of them independently
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501581%2fhow-should-we-understand-symlinks-under-proc-pid-fd%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
What does the readlink() mean to them, the canonical path of the inode from the calling process's root directory?
For regular files, the link text seems related to the path the file was opened with, e.g.:
$ echo foo > abba
$ ln abba acdc
$ cat >> abba &
[1] 12312
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/abba
Renaming that name changes the shown path:
$ mv abba qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty
As does deleting it:
$ rm qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty (deleted)
Though opening a file through the link still finds the inode in question:
$ echo testtest > /proc/12312/fd/1
$ cat acdc
testtest
For non-regular files, it shows the inode type (e.g. pipe or socket), and the inode number, which might be visible somewhere in /proc
(e.g. /proc/net/tcp
for TCP sockets shows the inode numbers).
What happened when a process try to open them, will a new open file description to the inode be created?
That's my impression. I think I've seen posts here on unix.SE about that, but I haven't seen any "official" documentation. The behavior is definitely that of an independent file description; I wrote a program testing that in this answer on Stackoverflow just a while ago: Duplicating file descriptor and seeking through both of them independently
add a comment |
What does the readlink() mean to them, the canonical path of the inode from the calling process's root directory?
For regular files, the link text seems related to the path the file was opened with, e.g.:
$ echo foo > abba
$ ln abba acdc
$ cat >> abba &
[1] 12312
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/abba
Renaming that name changes the shown path:
$ mv abba qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty
As does deleting it:
$ rm qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty (deleted)
Though opening a file through the link still finds the inode in question:
$ echo testtest > /proc/12312/fd/1
$ cat acdc
testtest
For non-regular files, it shows the inode type (e.g. pipe or socket), and the inode number, which might be visible somewhere in /proc
(e.g. /proc/net/tcp
for TCP sockets shows the inode numbers).
What happened when a process try to open them, will a new open file description to the inode be created?
That's my impression. I think I've seen posts here on unix.SE about that, but I haven't seen any "official" documentation. The behavior is definitely that of an independent file description; I wrote a program testing that in this answer on Stackoverflow just a while ago: Duplicating file descriptor and seeking through both of them independently
add a comment |
What does the readlink() mean to them, the canonical path of the inode from the calling process's root directory?
For regular files, the link text seems related to the path the file was opened with, e.g.:
$ echo foo > abba
$ ln abba acdc
$ cat >> abba &
[1] 12312
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/abba
Renaming that name changes the shown path:
$ mv abba qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty
As does deleting it:
$ rm qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty (deleted)
Though opening a file through the link still finds the inode in question:
$ echo testtest > /proc/12312/fd/1
$ cat acdc
testtest
For non-regular files, it shows the inode type (e.g. pipe or socket), and the inode number, which might be visible somewhere in /proc
(e.g. /proc/net/tcp
for TCP sockets shows the inode numbers).
What happened when a process try to open them, will a new open file description to the inode be created?
That's my impression. I think I've seen posts here on unix.SE about that, but I haven't seen any "official" documentation. The behavior is definitely that of an independent file description; I wrote a program testing that in this answer on Stackoverflow just a while ago: Duplicating file descriptor and seeking through both of them independently
What does the readlink() mean to them, the canonical path of the inode from the calling process's root directory?
For regular files, the link text seems related to the path the file was opened with, e.g.:
$ echo foo > abba
$ ln abba acdc
$ cat >> abba &
[1] 12312
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/abba
Renaming that name changes the shown path:
$ mv abba qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty
As does deleting it:
$ rm qwerty
$ ls -l /proc/12312/fd/1
l-wx------ 1 foo users 64 Feb 19 15:19 /proc/12312/fd/1 -> /tmp/qwerty (deleted)
Though opening a file through the link still finds the inode in question:
$ echo testtest > /proc/12312/fd/1
$ cat acdc
testtest
For non-regular files, it shows the inode type (e.g. pipe or socket), and the inode number, which might be visible somewhere in /proc
(e.g. /proc/net/tcp
for TCP sockets shows the inode numbers).
What happened when a process try to open them, will a new open file description to the inode be created?
That's my impression. I think I've seen posts here on unix.SE about that, but I haven't seen any "official" documentation. The behavior is definitely that of an independent file description; I wrote a program testing that in this answer on Stackoverflow just a while ago: Duplicating file descriptor and seeking through both of them independently
edited Feb 19 at 14:13
answered Feb 19 at 13:21
ilkkachuilkkachu
61.4k10100177
61.4k10100177
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501581%2fhow-should-we-understand-symlinks-under-proc-pid-fd%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
The thing these points to varies. Could you edit your question to show exactly what you are seeing.
– Philip Couling
Feb 19 at 13:07