summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorchunx <chunx@nvidia.com>2013-07-05 11:42:05 +0800
committerGabby Lee <galee@nvidia.com>2013-07-30 03:20:49 -0700
commit5dcfe4f561bd8d1767e0938dfd7565b2b7718478 (patch)
tree4b6e7776a488e4f132a8bd8a105b7111d6ca9ad8 /fs
parent61129a28e27bd4c5f794aa9af6903fd8ba68c746 (diff)
arm: tegra: tegratab: active-standby: add cmdline informatioin
into /proc/net/{tcp udp tcp6 udp6} files. 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 Tested-by: Jiukai Ma <jiukaim@nvidia.com> Reviewed-by: Gabby Lee <galee@nvidia.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/eventpoll.c35
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/select.c5
3 files changed, 41 insertions, 3 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0863bab42c4d..205b31e10f6b 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>
@@ -893,7 +895,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;
@@ -990,6 +992,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);
@@ -1201,6 +1204,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
@@ -1639,6 +1643,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.
*/
diff --git a/fs/proc/base.c b/fs/proc/base.c
index c8cb15dcca08..68375ebe25c3 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -45,6 +45,8 @@
*
* Paul Mundt <paul.mundt@nokia.com>:
* Overall revision about smaps.
+ *
+ * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
*/
#include <asm/uaccess.h>
@@ -209,7 +211,7 @@ struct mm_struct *mm_for_maps(struct task_struct *task)
return mm_access(task, PTRACE_MODE_READ);
}
-static int proc_pid_cmdline(struct task_struct *task, char * buffer)
+static int proc_pid_cmdline(struct task_struct *task, char *buffer)
{
int res = 0;
unsigned int len;
diff --git a/fs/select.c b/fs/select.c
index 0baa0a351a1c..a010736dfe20 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -12,6 +12,8 @@
* 24 January 2000
* Changed sys_poll()/do_poll() to use PAGE_SIZE chunk-based allocation
* of fds to overcome nfds < 16390 descriptors limit (Tigran Aivazian).
+ *
+ * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
*/
#include <linux/kernel.h>
@@ -202,7 +204,7 @@ static int __pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key)
return default_wake_function(&dummy_wait, mode, sync, key);
}
-static int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key)
+int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key)
{
struct poll_table_entry *entry;
@@ -211,6 +213,7 @@ static int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key)
return 0;
return __pollwake(wait, mode, sync, key);
}
+EXPORT_SYMBOL(pollwake);
/* Add a new entry */
static void __pollwait(struct file *filp, wait_queue_head_t *wait_address,