diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-12-09 16:45:03 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-12-09 16:45:03 +0100 |
commit | 2a07a1f5abba308729bd082dce4d035365165d85 (patch) | |
tree | 6608a88e5bb8552fb061430eea7f6955d81544cd /fs/proc/thread_self.c | |
parent | 6c988f575915ab5162332d61f91dca99dcc17335 (diff) | |
download | linux-stable-2a07a1f5abba308729bd082dce4d035365165d85.tar.gz linux-stable-2a07a1f5abba308729bd082dce4d035365165d85.tar.bz2 linux-stable-2a07a1f5abba308729bd082dce4d035365165d85.zip |
proc/self: use generic_readlink
The /proc/self and /proc/self-thread symlinks have separate but identical
functionality for reading and following. This cleanup utilizes
generic_readlink to remove the duplication.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/proc/thread_self.c')
-rw-r--r-- | fs/proc/thread_self.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c index 595b90a9766c..adaba20b59b6 100644 --- a/fs/proc/thread_self.c +++ b/fs/proc/thread_self.c @@ -6,19 +6,6 @@ /* * /proc/thread_self: */ -static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer, - int buflen) -{ - struct pid_namespace *ns = dentry->d_sb->s_fs_info; - pid_t tgid = task_tgid_nr_ns(current, ns); - pid_t pid = task_pid_nr_ns(current, ns); - char tmp[PROC_NUMBUF + 6 + PROC_NUMBUF]; - if (!pid) - return -ENOENT; - sprintf(tmp, "%d/task/%d", tgid, pid); - return readlink_copy(buffer, buflen, tmp); -} - static const char *proc_thread_self_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) @@ -40,7 +27,7 @@ static const char *proc_thread_self_get_link(struct dentry *dentry, } static const struct inode_operations proc_thread_self_inode_operations = { - .readlink = proc_thread_self_readlink, + .readlink = generic_readlink, .get_link = proc_thread_self_get_link, }; |