lkml.org 
[lkml]   [2002]   [Jan]   [19]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
DateSat, 19 Jan 2002 13:15:11 +0200
FromVille Herva <>
SubjectRe: rm-ing files with open file descriptors
On Fri, Jan 18, 2002 at 06:29:36PM -0800, you [H. Peter Anvin] said:
> 
> This *might* work:
> 
> link("/proc/self/fd/40", newpath);

I don't think so: firstly, it would create a cross device link and secondly,
/proc/<pid>/fd/* are symbolic links. See:
/tmp>while true; do sleep 1; echo kukkanen; done > r &
[1] 19925
/tmp>L /proc/19925/fd 
total 0
lrwx------    1 root     root           64 Jan 19 13:10 0 -> /dev/pts/7
l-wx------    1 root     root           64 Jan 19 13:10 1 -> /tmp/r
lrwx------    1 root     root           64 Jan 19 13:10 2 -> /dev/pts/7
/tmp>rm r               
/tmp>L /proc/19925/fd
total 0
lrwx------    1 root     root           64 Jan 19 13:10 0 -> /dev/pts/7
l-wx------    1 root     root           64 Jan 19 13:10 1 -> /tmp/r (deleted)
lrwx------    1 root     root           64 Jan 19 13:10 2 -> /dev/pts/7
/tmp>ln /proc/19925/fd/1 r2
ln: /proc/19925/fd/1: warning: making a hard link to a symbolic link is not portable
ln: create hard link `r2' to `/proc/19925/fd/1': Invalid cross-device link
I think one has to use lsof, ps and/or fuser and then kill.


-- v --

v@iki.fi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 11:15    [W:0.436 / U:0.090 seconds]
©2003-2008 Jasper Spaans