Skip to contentSkip to conversation

task_nommu: fix compile failing bug because of spilt file.h

PATCH In review Bryan Wu 2 participants 4 messages May 4, 2008

Subsystems (2)
lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

PATCH 1/1 task_nommu: fix compile failing bug because of spilt file.h

CC fs/proc/task_nommu.o
fs/proc/task_nommu.c: In function ‘task_mem’:
fs/proc/task_nommu.c:55: error: dereferencing pointer to incomplete type make[2]: *** [fs/proc/task_nommu.o] Error 1
make[1]: *** [fs/proc] Error 2
make: *** [fs] Error 2

---
 fs/proc/task_nommu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/proc/task_nommu.c +1 -0
index 6cba820..987bc69 100644
@@ -1,6 +1,7 @@
 
 #include <linux/mm.h>
 #include <linux/file.h>
+#include <linux/fdtable.h>
 #include <linux/mount.h>
 #include <linux/ptrace.h>
 #include <linux/seq_file.h>
Signature · 1 line
1.5.5
#1 lore raw

fs/proc/task_nommu.c line 7

Quoted 12 lines · Bryan Wu
fs/proc/task_nommu.c +1 -0
index 6cba820..987bc69 100644
@@ -1,6 +1,7 @@
 
 #include <linux/mm.h>
 #include <linux/file.h>
+#include <linux/fdtable.h>
 #include <linux/mount.h>
 #include <linux/ptrace.h>
 #include <linux/seq_file.h>

Well... I see what it's trying to do, but it's a bullshit. Look: it's from

        if (current->files && atomic_read(&current->files->count) > 1)
                sbytes += kobjsize(current->files);
        else
                bytes += kobjsize(current->files);
Now, what we really have is size of current->files (fixed and not too large)
+ if descriptor table is too large to be embedded,
	size of current->files->fdt
	size of current->files->fdt->fd
	size of current->files->fdt->open_fds/->close_on_exec

And the second term there can be *large*, so if we are really serious about taking descriptor table footprint into account, we'd better take care of that too. I'm not sure that we want to, though - note that we do that only on nommu targets...

So what's that code really trying to achieve?

author
#2 lore raw
Quoted 24 lines · Al Viro

fs/proc/task_nommu.c line 7

Quoted 12 lines · Bryan Wu
fs/proc/task_nommu.c +1 -0
index 6cba820..987bc69 100644
@@ -1,6 +1,7 @@
 
 #include <linux/mm.h>
 #include <linux/file.h>
+#include <linux/fdtable.h>
 #include <linux/mount.h>
 #include <linux/ptrace.h>
 #include <linux/seq_file.h>

Well... I see what it's trying to do, but it's a bullshit. Look: it's from

        if (current->files && atomic_read(&current->files->count) > 1)
                sbytes += kobjsize(current->files);
        else
                bytes += kobjsize(current->files);
 Now, what we really have is size of current->files (fixed and not too large)
 + if descriptor table is too large to be embedded,
        size of current->files->fdt
        size of current->files->fdt->fd
        size of current->files->fdt->open_fds/->close_on_exec
Quoted 7 lines

And the second term there can be *large*, so if we are really serious about taking descriptor table footprint into account, we'd better take care of that too. I'm not sure that we want to, though - note that we do that only on nommu targets...

So what's that code really trying to achieve?

Wow, my patch is just to kill the compile error, I did not notice this large size issue here.
I'd like to improve this code later.

Thanks
-Bryan

#3 lore raw
Quoted 3 lines · Bryan Wu

Wow, my patch is just to kill the compile error, I did not notice this large size issue here.
I'd like to improve this code later.

I certainly have no objections to the patch as is - the include is obviously missing.