lkml.org 
[lkml]   [2019]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC 1/5] proc: introduce madvise placeholder
Date
Add a write-only /proc/<pid>/madvise file to handle remote madvise
operations.

For now, this is just a soother that does nothing.

Signed-off-by: Oleksandr Natalenko <oleksandr@redhat.com>
---
fs/proc/base.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 6a803a0b75df..f69532d6b74f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2957,6 +2957,25 @@ static int proc_stack_depth(struct seq_file *m, struct pid_namespace *ns,
}
#endif /* CONFIG_STACKLEAK_METRICS */

+static ssize_t madvise_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ struct task_struct *task;
+
+ task = get_proc_task(file_inode(file));
+ if (!task)
+ return -ESRCH;
+
+ put_task_struct(task);
+
+ return count;
+}
+
+static const struct file_operations proc_madvise_operations = {
+ .write = madvise_write,
+ .llseek = noop_llseek,
+};
+
/*
* Thread groups
*/
@@ -3061,6 +3080,7 @@ static const struct pid_entry tgid_base_stuff[] = {
#ifdef CONFIG_STACKLEAK_METRICS
ONE("stack_depth", S_IRUGO, proc_stack_depth),
#endif
+ REG("madvise", S_IRUGO|S_IWUSR, proc_madvise_operations),
};

static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx)
--
2.21.0
\
 
 \ /
  Last update: 2019-05-16 11:43    [W:0.056 / U:46.516 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site