aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a7310841c831..c7f9f23449dc 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -81,6 +81,7 @@
81#include <linux/elf.h> 81#include <linux/elf.h>
82#include <linux/pid_namespace.h> 82#include <linux/pid_namespace.h>
83#include <linux/fs_struct.h> 83#include <linux/fs_struct.h>
84#include <linux/slab.h>
84#include "internal.h" 85#include "internal.h"
85 86
86/* NOTE: 87/* NOTE:
@@ -442,12 +443,13 @@ static const struct file_operations proc_lstats_operations = {
442unsigned long badness(struct task_struct *p, unsigned long uptime); 443unsigned long badness(struct task_struct *p, unsigned long uptime);
443static int proc_oom_score(struct task_struct *task, char *buffer) 444static int proc_oom_score(struct task_struct *task, char *buffer)
444{ 445{
445 unsigned long points; 446 unsigned long points = 0;
446 struct timespec uptime; 447 struct timespec uptime;
447 448
448 do_posix_clock_monotonic_gettime(&uptime); 449 do_posix_clock_monotonic_gettime(&uptime);
449 read_lock(&tasklist_lock); 450 read_lock(&tasklist_lock);
450 points = badness(task->group_leader, uptime.tv_sec); 451 if (pid_alive(task))
452 points = badness(task, uptime.tv_sec);
451 read_unlock(&tasklist_lock); 453 read_unlock(&tasklist_lock);
452 return sprintf(buffer, "%lu\n", points); 454 return sprintf(buffer, "%lu\n", points);
453} 455}
@@ -728,6 +730,7 @@ out_no_task:
728 730
729static const struct file_operations proc_info_file_operations = { 731static const struct file_operations proc_info_file_operations = {
730 .read = proc_info_read, 732 .read = proc_info_read,
733 .llseek = generic_file_llseek,
731}; 734};
732 735
733static int proc_single_show(struct seq_file *m, void *v) 736static int proc_single_show(struct seq_file *m, void *v)
@@ -985,6 +988,7 @@ out_no_task:
985 988
986static const struct file_operations proc_environ_operations = { 989static const struct file_operations proc_environ_operations = {
987 .read = environ_read, 990 .read = environ_read,
991 .llseek = generic_file_llseek,
988}; 992};
989 993
990static ssize_t oom_adjust_read(struct file *file, char __user *buf, 994static ssize_t oom_adjust_read(struct file *file, char __user *buf,
@@ -1058,6 +1062,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
1058static const struct file_operations proc_oom_adjust_operations = { 1062static const struct file_operations proc_oom_adjust_operations = {
1059 .read = oom_adjust_read, 1063 .read = oom_adjust_read,
1060 .write = oom_adjust_write, 1064 .write = oom_adjust_write,
1065 .llseek = generic_file_llseek,
1061}; 1066};
1062 1067
1063#ifdef CONFIG_AUDITSYSCALL 1068#ifdef CONFIG_AUDITSYSCALL
@@ -1129,6 +1134,7 @@ out_free_page:
1129static const struct file_operations proc_loginuid_operations = { 1134static const struct file_operations proc_loginuid_operations = {
1130 .read = proc_loginuid_read, 1135 .read = proc_loginuid_read,
1131 .write = proc_loginuid_write, 1136 .write = proc_loginuid_write,
1137 .llseek = generic_file_llseek,
1132}; 1138};
1133 1139
1134static ssize_t proc_sessionid_read(struct file * file, char __user * buf, 1140static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
@@ -1149,6 +1155,7 @@ static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
1149 1155
1150static const struct file_operations proc_sessionid_operations = { 1156static const struct file_operations proc_sessionid_operations = {
1151 .read = proc_sessionid_read, 1157 .read = proc_sessionid_read,
1158 .llseek = generic_file_llseek,
1152}; 1159};
1153#endif 1160#endif
1154 1161
@@ -1200,6 +1207,7 @@ static ssize_t proc_fault_inject_write(struct file * file,
1200static const struct file_operations proc_fault_inject_operations = { 1207static const struct file_operations proc_fault_inject_operations = {
1201 .read = proc_fault_inject_read, 1208 .read = proc_fault_inject_read,
1202 .write = proc_fault_inject_write, 1209 .write = proc_fault_inject_write,
1210 .llseek = generic_file_llseek,
1203}; 1211};
1204#endif 1212#endif
1205 1213
@@ -1941,7 +1949,7 @@ static ssize_t proc_fdinfo_read(struct file *file, char __user *buf,
1941} 1949}
1942 1950
1943static const struct file_operations proc_fdinfo_file_operations = { 1951static const struct file_operations proc_fdinfo_file_operations = {
1944 .open = nonseekable_open, 1952 .open = nonseekable_open,
1945 .read = proc_fdinfo_read, 1953 .read = proc_fdinfo_read,
1946}; 1954};
1947 1955
@@ -2225,6 +2233,7 @@ out_no_task:
2225static const struct file_operations proc_pid_attr_operations = { 2233static const struct file_operations proc_pid_attr_operations = {
2226 .read = proc_pid_attr_read, 2234 .read = proc_pid_attr_read,
2227 .write = proc_pid_attr_write, 2235 .write = proc_pid_attr_write,
2236 .llseek = generic_file_llseek,
2228}; 2237};
2229 2238
2230static const struct pid_entry attr_dir_stuff[] = { 2239static const struct pid_entry attr_dir_stuff[] = {
@@ -2345,6 +2354,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
2345static const struct file_operations proc_coredump_filter_operations = { 2354static const struct file_operations proc_coredump_filter_operations = {
2346 .read = proc_coredump_filter_read, 2355 .read = proc_coredump_filter_read,
2347 .write = proc_coredump_filter_write, 2356 .write = proc_coredump_filter_write,
2357 .llseek = generic_file_llseek,
2348}; 2358};
2349#endif 2359#endif
2350 2360
@@ -2907,7 +2917,7 @@ out_no_task:
2907 */ 2917 */
2908static const struct pid_entry tid_base_stuff[] = { 2918static const struct pid_entry tid_base_stuff[] = {
2909 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations), 2919 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
2910 DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fd_operations), 2920 DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations),
2911 REG("environ", S_IRUSR, proc_environ_operations), 2921 REG("environ", S_IRUSR, proc_environ_operations),
2912 INF("auxv", S_IRUSR, proc_pid_auxv), 2922 INF("auxv", S_IRUSR, proc_pid_auxv),
2913 ONE("status", S_IRUGO, proc_pid_status), 2923 ONE("status", S_IRUGO, proc_pid_status),