Messages in this thread Patch in this message | | | Date | Wed, 6 Sep 2000 11:31:42 +0200 | Subject | Re: [PATCH] 2.2: /proc/config.gz | From | Andreas Schwab <> |
| |
Chip Salzenberg <chip@valinux.com> writes:
|> According to Andi Kleen: |> > You probably don't have a .config.gz that is longer than a page |> > (4K), because in that case it'll badly corrupt your memory (or you |> > just haven't noticed the corruption yet ;) |> |> Hm... they're all <4K, but a few are pushing it.
Use this instead. It has the additional advantage of avoiding the useless memcpy.
diff -urN linux-2.2.16.tmp/fs/proc/array.c linux-2.2.16.SuSE/fs/proc/array.c --- linux-2.2.16.tmp/fs/proc/array.c Sat Jul 15 00:37:00 2000 +++ linux-2.2.16.SuSE/fs/proc/array.c Sat Jul 15 00:38:18 2000 @@ -414,6 +414,25 @@ return strlen(buffer); } +#ifdef CONFIG_PROC_CONFIG +static int get_proc_config(char *buffer, char **start, off_t offset, off_t length) +{ + extern char *kernel_config_data; + extern int kernel_config_data_size; + off_t i; + + i = kernel_config_data_size - offset; + if (i > 0) { + if (i > length) + i = length; + *start = kernel_config_data + offset; + return i; + } + else + return 0; +} +#endif + static int get_cmdline(char * buffer) { extern char saved_command_line[]; @@ -1460,6 +1479,11 @@ case PROC_STRAM: return get_stram_list(page); #endif +#ifdef CONFIG_PROC_CONFIG + case PROC_CONFIG: + return get_proc_config(page, start, offset, length); +#endif + } return -EBADF; } Andreas.
-- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
| |