Re: PATCH: /proc/cflags

Ulrich Windl (Ulrich.Windl@rz.uni-regensburg.de)
Thu, 2 May 1996 11:11:37 +0200


On 1 May 96 at 16:51, Joe wrote:

> The patch below adds an entry to /proc that represents the CFLAGS
> definition passed to gcc at compile time.

Do we really need this? Why not adding it to /proc/version (if you
think you'll need it)?

>
> The CFLAGS value is defined in linux/compile.h as LINUX_CFLAGS.
>
> This diff should apply to all recent kernels.
>
> .-.
> . |-
> -- -- | |
> \_/
>
>
> --- linux/Makefile.orig Wed May 1 13:01:45 1996
> +++ linux/Makefile Wed May 1 13:30:22 1996
> @@ -230,6 +230,7 @@
> echo \#define LINUX_COMPILE_DOMAIN ; \
> fi >> .ver
> @echo \#define LINUX_COMPILER \"`$(HOSTCC) -v 2>&1 | tail -1`\" >> .ver
> + @echo \#define LINUX_CFLAGS \"$(CFLAGS)\" >> .ver
> @mv -f .ver $@
>
> include/linux/version.h: ./Makefile
> --- linux/include/linux/proc_fs.h.orig Wed May 1 13:11:54 1996
> +++ linux/include/linux/proc_fs.h Wed May 1 13:12:43 1996
> @@ -42,7 +42,8 @@
> PROC_SYS,
> PROC_MTAB,
> PROC_MD,
> - PROC_RTC
> + PROC_RTC,
> + PROC_CFLAGS
> };
>
> enum pid_directory_inos {
> --- linux/fs/proc/root.c.orig Wed May 1 13:21:18 1996
> +++ linux/fs/proc/root.c Wed May 1 16:20:31 1996
> @@ -359,6 +359,11 @@
> });
> #endif
>
> + proc_register(&proc_root, &(struct proc_dir_entry) {
> + PROC_CFLAGS, 6, "cflags",
> + S_IFREG | S_IRUGO, 1, 0, 0,
> + });
> +
> proc_register( &proc_root, &(struct proc_dir_entry)
> { PROC_MTAB, 6, "mounts", S_IFREG | S_IRUGO, 1, 0, 0, } );
>
> --- linux/fs/proc/array.c.orig Wed May 1 13:13:45 1996
> +++ linux/fs/proc/array.c Wed May 1 13:22:29 1996
> @@ -43,6 +43,7 @@
> #include <linux/mm.h>
> #include <linux/pagemap.h>
> #include <linux/swap.h>
> +#include <linux/compile.h>
>
> #include <asm/segment.h>
> #include <asm/pgtable.h>
> @@ -317,6 +318,11 @@
> return sprintf(buffer, "%s\n", saved_command_line);
> }
>
> +static int get_cflags(char * buffer)
> +{
> + return sprintf(buffer, "%s\n", LINUX_CFLAGS);
> +}
> +
> static struct task_struct ** get_task(pid_t pid)
> {
> struct task_struct ** p;
> @@ -1041,6 +1047,8 @@
> case PROC_RTC:
> return get_rtc_status(page);
> #endif
> + case PROC_CFLAGS:
> + return get_cflags(page);
> }
> return -EBADF;
> }
>
>