diff options
author | chunx <chunx@nvidia.com> | 2013-07-05 11:42:05 +0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:40:37 -0700 |
commit | db969bbf31dbb79c0f06497f083b4bad16ad88c7 (patch) | |
tree | 79b3f7b9091cbb454e70b1b0e28585175daa904c /fs/eventpoll.c | |
parent | d8461f401990820027131da3ec597361d8906cb8 (diff) |
net: show cmdline in /proc/net/{tcp udp tcp6 udp6}
Get process's cmdline from a sock's corresponding inode pointer,
so that cmdline can't be used by Android active-standby app
to find the corresponding package name.
Bug 1185001
Change-Id: Idc8651e4bb85b8a152dfade9689a719f7d72687d
Signed-off-by: Chun Xu <chunx@nvidia.com>
Reviewed-on: http://git-master/r/253458
(cherry picked from commit 5dcfe4f561bd8d1767e0938dfd7565b2b7718478)
Reviewed-on: http://git-master/r/260013
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r-- | fs/eventpoll.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 0cff4434880d..e92a15091d80 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -9,6 +9,8 @@ * * Davide Libenzi <davidel@xmailserver.org> * + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * */ #include <linux/init.h> @@ -967,7 +969,7 @@ static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd) * mechanism. It is called by the stored file descriptors when they * have events to report. */ -static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *key) +int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *key) { int pwake = 0; unsigned long flags; @@ -1064,6 +1066,7 @@ static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead, if (epi->nwait >= 0 && (pwq = kmem_cache_alloc(pwq_cache, GFP_KERNEL))) { init_waitqueue_func_entry(&pwq->wait, ep_poll_callback); + pwq->wait.private = get_thread_process(current); pwq->whead = whead; pwq->base = epi; add_wait_queue(whead, &pwq->wait); @@ -1287,6 +1290,7 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event, spin_lock(&tfile->f_lock); list_add_tail(&epi->fllink, &tfile->f_ep_links); spin_unlock(&tfile->f_lock); + tfile->f_path.dentry->d_inode->i_private = get_thread_process(current); /* * Add the current item to the RB tree. All RB tree operations are @@ -1728,6 +1732,35 @@ static void clear_tfile_check_list(void) INIT_LIST_HEAD(&tfile_check_list); } +struct task_struct *get_epoll_file_task(struct file *file) +{ + struct list_head *lh; + struct epitem *epi = NULL; + struct eppoll_entry *pwq = NULL; + struct task_struct *task = NULL; + wait_queue_head_t *whead = NULL; + wait_queue_t *wq = NULL; + + lh = &file->f_ep_links; + if (!list_empty(lh)) { + lh = lh->next; + epi = list_entry(lh, struct epitem, fllink); + lh = &epi->pwqlist; + if (!list_empty(lh)) { + lh = lh->next; + pwq = list_entry(lh, struct eppoll_entry, llink); + lh = &pwq->whead->task_list; + if (!list_empty(lh)) { + lh = lh->next; + wq = list_entry(lh, wait_queue_t, task_list); + task = wq->private; + } + } + } + + return task; +} + /* * Open an eventpoll file descriptor. */ |