-
-
Save wmealing/99b1acc0e75c4daf9ed1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/fs/proc/array.c b/fs/proc/array.c | |
index 25b1ebc..3f9de99 100644 | |
--- a/fs/proc/array.c | |
+++ b/fs/proc/array.c | |
@@ -155,11 +155,27 @@ static inline const char *get_task_state(struct task_struct *tsk) | |
return *p; | |
} | |
+static int count_open_files(struct fdtable *fdt) | |
+{ | |
+ int fd = 0; | |
+ int count = 0; | |
+ | |
+ if(!fdt) | |
+ return 0; | |
+ | |
+ for (; fd < fdt->max_fds; fd++) { | |
+ if (FD_ISSET(fd, fdt->open_fds)) | |
+ ount++; | |
+ } | |
+ | |
+ return count; | |
+} | |
+ | |
static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |
struct pid *pid, struct task_struct *p) | |
{ | |
struct group_info *group_info; | |
- int g; | |
+ int g, fdcount = 0; | |
struct fdtable *fdt = NULL; | |
const struct cred *cred; | |
pid_t ppid, tpid; | |
@@ -192,14 +208,22 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |
task_utrace_proc_status(m, p); | |
task_lock(p); | |
- if (p->files) | |
+ if (p->files) { | |
+ spin_lock(&p->files->file_lock); | |
+ | |
fdt = files_fdtable(p->files); | |
+ fdcount = count_open_files(fdt); | |
+ | |
+ spin_unlock(&p->files->file_lock); | |
+ } | |
+ | |
seq_printf(m, | |
"FDSize:\t%d\n" | |
+ "FDCount:\t%d\n" | |
"Groups:\t", | |
- fdt ? fdt->max_fds : 0); | |
- rcu_read_unlock(); | |
+ fdt ? fdt->max_fds : 0, fdcount); | |
+ rcu_read_unlock(); | |
group_info = cred->group_info; | |
task_unlock(p); | |
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template | |
index 2117b0e..2e2edd3 100644 | |
--- a/redhat/kernel.spec.template | |
+++ b/redhat/kernel.spec.template | |
@@ -14,7 +14,7 @@ Summary: The Linux kernel | |
# that the kernel isn't the stock distribution kernel, for example, | |
# by setting the define to ".local" or ".bz123456" | |
# | |
-# % define buildid .local | |
+%define buildid .whatever | |
%define distro_build %%BUILD%% | |
%define signmodules 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment