Messages in this thread Patch in this message | | | Date | Sat, 24 Aug 2013 20:29:39 +0200 | From | Oleg Nesterov <> | Subject | /proc/pid/fd && anon_inode_fops |
| |
Sorry for off-topic, I am just curios.
On 08/22, Willy Tarreau wrote: > > It's not only that, it also supports sockets and pipes that you can access > via /proc/pid/fd and not via a real symlink which would try to open eg > "pipe:[23456]" instead of the real file.
But sock_no_open() disallows this, and for good reason I guess.
I am wondering, perhaps anon_inode should do the same? I do not see any problem, but it looks pointless and misleading to allow to open a file you can do nothing with.
Or is there any reason why, say, open("anon_inode:[perf_event]") should succeed?
Thanks,
Oleg.
--- x/fs/anon_inodes.c +++ x/fs/anon_inodes.c @@ -24,7 +24,15 @@ static struct vfsmount *anon_inode_mnt __read_mostly; static struct inode *anon_inode_inode; -static const struct file_operations anon_inode_fops; + +static int anon_open(struct inode *inode, struct file *file) +{ + return -ENXIO; +} + +static const struct file_operations anon_inode_fops = { + .open = anon_open, +}; /* * anon_inodefs_dname() is called from d_path().
| |