[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/
From: |
Linda Walsh |
Subject: |
Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes? |
Date: |
Wed, 21 Oct 2015 19:57:22 -0700 |
User-agent: |
Thunderbird |
Bob Proulx wrote:
Linda Walsh wrote:
Where does the OS claim it is a file descriptor?
---
1) in the kernel documentation:
file 'devices.txt:
/dev/fd /proc/self/fd symbolic File descriptors
2) ls -Ll shows the type of what the symlink points to:
ls -Ll /dev/fd/
total 0
crw--w---- 1 law tty 136, 0 Oct 21 19:49 0
crw--w---- 1 law tty 136, 0 Oct 21 19:49 1
crw--w---- 1 law tty 136, 0 Oct 21 19:49 2
---
and 3)
YOU claim it is a descriptor further down in this note:
tmpname=<(sort /dev/null); ls -l "$tmpname"
ls: cannot access /dev/fd/63: No such file or directory
But as soon as the first commend is finished at the ';' then the
descriptor will be closed and the path will evaporate. Therefore the
^^^^^^^^^^^^^^^^^^^^^^^^^
path won't exist for the second command.
---
If you close a file-descriptor to a normal file
it doesn't disappear. If it was deleted via 'rm' the name disappears
immediately, and the only access to it is through the descriptor.
In this case, closing the descriptor deletes the temporary
name in the process's 'file descriptor' "/fd/". Normal filenames
are not "auto-deleted" when you close an I/O handle to them.
But if you use it for the ls command itself then it exists for that
command.
ls -l <(sort /dev/null)
lr-x------ 1 rwp rwp 64 Oct 19 15:56 /dev/fd/63 -> pipe:[102059434]
----
But only as a pointer to something one can do I/O on.
You can't set any file attributes or metadata on "pipe:[xxxx]"
It's not a real file somewhere.
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, (continued)
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Chris F.A. Johnson, 2015/10/17
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Oleg Popov, 2015/10/17
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Chet Ramey, 2015/10/18
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Stephane Chazelas, 2015/10/19
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Ken Irving, 2015/10/19
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Chet Ramey, 2015/10/19
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Greg Wooledge, 2015/10/19
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Linda Walsh, 2015/10/19
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Greg Wooledge, 2015/10/19
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Bob Proulx, 2015/10/19
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?,
Linda Walsh <=
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Pierre Gaston, 2015/10/22
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Bob Proulx, 2015/10/23
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Greg Wooledge, 2015/10/26
- Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?, Ken Irving, 2015/10/19