Re: Quasi-(un)deletion question

From: Martin Dickopp (martin-deb_at_zero-based.org)
Date: 02/16/04

  • Next message: wattoo: "kernel upgrade and LVM"
    To: debian-user@lists.debian.org
    Date: Mon, 16 Feb 2004 00:25:08 +0100
    
    

    Tim Otten <tim@cap.american.edu> writes:

    >> /proc/PID/fd seems to work just fine; see transcript below.
    >
    > OMG. That does work. I didn't try it because the file looks like a symlink
    > in 'ls' -- a similar process with symlinks on a normal filesystem will
    > produce different results:

    Yes, /proc is quite different from other filesystems in many ways. :)

    > tim@truffula:/tmp$ echo This is a test > t.txt
    > tim@truffula:/tmp$ tail -f t.txt > /dev/null &
    > [1] 15538
    > tim@truffula:/tmp$ ln -s t.txt t.txt-symlink
    > tim@truffula:/tmp$ rm t.txt
    > tim@truffula:/tmp$ cat t.txt-symlink
    > cat: t.txt-symlink: No such file or directory
    >
    > So the proc filesystem somehow provides hardlink semantics with a
    > symlink facade?

    The behavior is similar to hardlinks, but it's not really a hardlink,
    since hardlinks cannot work between different filesystems. A hardlink in
    the strict sense means that two or more directory entries refer to the
    same inode. That's not what's happening here.

    When the kernel is asked what type of file it is (as 'ls' does), it
    claims that it is a symlink. But when the kernel is asked for the
    content of the file (as 'cat' does), it returns the content of the
    open file on another filesystem. These two system-calls are really
    independent of each other, so the kernel can do that.

    Martin

    -- 
    To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: wattoo: "kernel upgrade and LVM"

    Relevant Pages

    • Re: Finding hardlinks
      ... The problem is that if inode number collision happens occasionally, you get data corruption with cp -a command --- it will just copy one file and hardlink the other. ... I think the best solution for these filesystems would be either to add new syscall ... int is_hardlink(char *filename1, char *filename2) ... (but I know adding syscall bloat may be objectionable) ...
      (Linux-Kernel)
    • Re: ext2 vs ext3?
      ... [pseudo-filesystems snipped, rearranged so that filesystems of like ... Having a partition devoted to /tmp seems like overkill. ... symlink to /var/tmp typically suffices. ... Waiting for disks to fsck is really annoying, ...
      (comp.os.linux.misc)
    • Re: /var/mail -vs- /var/spool/mail
      ... |>filesystems while still getting each mounted where it needs to be, ... Good luck with your experimentation. ... So instead of a symlink, I use a bind mount. ...
      (comp.os.linux.setup)
    • Re: Finding hardlinks
      ... Another part is that only few applications actually care about hardlinks ... be a waste of memory to track every object as a possible hardlink. ... And because Coda already restrict hardlinks in many cases they end up ... the best solution for these filesystems would be either to add new syscall ...
      (Linux-Kernel)
    • Re: Finding hardlinks
      ... I didn't hardlink directories, I just patched stat, lstat and fstat to ... are going to happen on non-POSIX filesystems in real world too, ... The UNIX world has relied upon this ... Numerous popular POSIX filesystems do that. ...
      (Linux-Kernel)