lkml.org 
[lkml]   [1996]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Patch to include animal names
Date
	This belongs in /proc/sys/kernel, and should also be printed
by INIT at boot time.

- jared

Joel Maslak graced my mailbox with this long sought knowledge:
>
> This patch works on a recent kernel.
>
> It adds a /proc/animal so you can see what 'animal' the kernel currently
> is. (This will not break until 2.10.0. It will work fine with 1.3.100
> and above).
>
> This increases kernel size by just a little bit, due to all the
> pre-processor work.
>
> You can also use this in your programs (Compiled under Greased HedgeHog on
> Steroids) by including linux/version.h and linux/animal.h.
>
> Patch at end of message.
>
> Let me know how you guys like it!
>
>
> Joel Maslak
>
> The University of California at Berkeley has refined TWO things:
> 1. LSD
> 2. Unix
> Coincidence? I think not.
>
>
>
> diff -ur linux-1.3.98.orig/fs/proc/array.c linux-1.3.98/fs/proc/array.c
> --- linux-1.3.98.orig/fs/proc/array.c Tue Apr 30 04:09:45 1996
> +++ linux-1.3.98/fs/proc/array.c Tue May 7 00:01:34 1996
> @@ -25,6 +25,9 @@
> *
> * Bruno Haible : remove 4K limit for the maps file
> * <haible@ma2s2.mathematik.uni-karlsruhe.de>
> + *
> + * Joel Maslak : Added animal extension.
> + * <j@pobox.com>
> */
>
> #include <linux/types.h>
> @@ -43,6 +46,8 @@
> #include <linux/mm.h>
> #include <linux/pagemap.h>
> #include <linux/swap.h>
> +#include <linux/version.h>
> +#include <linux/animal.h>
>
> #include <asm/segment.h>
> #include <asm/pgtable.h>
> @@ -187,6 +192,13 @@
> nr_running, nr_tasks, last_pid);
> }
>
> +static int get_animal(char * buffer)
> +{
> + return sprintf(buffer, "%s %s %s %s\n", GET_ANIMAL_VERSION,
> + GET_ANIMAL_PATCHLEVEL, GET_ANIMAL_SUBLEVEL0,
> + GET_ANIMAL_SUBLEVEL1);
> +}
> +
> static int get_kstat(char * buffer)
> {
> int i, len;
> @@ -1044,6 +1056,9 @@
> #endif
> case PROC_LOCKS:
> return get_locks_status(page);
> +
> + case PROC_ANIMAL:
> + return get_animal(page);
> }
> return -EBADF;
> }
>
> diff -ur linux-1.3.98.orig/fs/proc/root.c linux-1.3.98/fs/proc/root.c
> --- linux-1.3.98.orig/fs/proc/root.c Tue Apr 30 04:09:45 1996
> +++ linux-1.3.98/fs/proc/root.c Mon May 6 22:28:57 1996
> @@ -293,6 +293,10 @@
> S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, 1, 0, 0,
> 64, &proc_self_inode_operations,
> });
> + proc_register(&proc_root, &(struct proc_dir_entry) {
> + PROC_ANIMAL, 6, "animal",
> + S_IFREG | S_IRUGO, 1, 0, 0,
> + });
> proc_register(&proc_root, &proc_net);
> proc_register(&proc_root, &proc_scsi);
> proc_register(&proc_root, &proc_sys_root);
> diff -ur linux-1.3.98.orig/include/linux/proc_fs.h linux-1.3.98/include/linux/proc_fs.h
> --- linux-1.3.98.orig/include/linux/proc_fs.h Fri May 3 07:19:04 1996
> +++ linux-1.3.98/include/linux/proc_fs.h Mon May 6 22:25:50 1996
> @@ -43,7 +43,8 @@
> PROC_MTAB,
> PROC_MD,
> PROC_RTC,
> - PROC_LOCKS
> + PROC_LOCKS,
> + PROC_ANIMAL
> };
>
> enum pid_directory_inos {
> diff -ur --new-file linux-1.3.98.orig/include/linux/animal.h linux-1.3.98/include/linux/animal.h
> --- linux-1.3.98.orig/include/linux/animal.h Wed Dec 31 17:00:00 1969
> +++ linux-1.3.98/include/linux/animal.h Tue May 7 00:14:18 1996
> @@ -0,0 +1,133 @@
> +/*
> + * /proc/animal header file
> + * Joel C. Maslak, 1996, j@pobox.com
> + *
> + * Idea from: Andrew Esh
> + */
> +
> +#define GET_ANIMAL_INTERNAL_1 ( LINUX_VERSION_CODE / 65536)
> +#define GET_ANIMAL_INTERNAL_2 ((LINUX_VERSION_CODE % 65536) / 256)
> +#define GET_ANIMAL_INTERNAL_3 ((LINUX_VERSION_CODE % 256) / 16)
> +#define GET_ANIMAL_INTERNAL_4 ( LINUX_VERSION_CODE % 16)
> +
> +#if GET_ANIMAL_INTERNAL_1 == 1
> +# define GET_ANIMAL_VERSION "Greased"
> +#elif GET_ANIMAL_INTERNAL_1 == 2
> +# define GET_ANIMAL_VERSION "Turbocharged"
> +#elif GET_ANIMAL_INTERNAL_1 == 3
> +# define GET_ANIMAL_VERSION "Supercharged"
> +#elif GET_ANIMAL_INTERNAL_1 == 4
> +# define GET_ANIMAL_VERSION "Stealthy"
> +#elif GET_ANIMAL_INTERNAL_1 == 5
> +# define GET_ANIMAL_VERSION "Electrified"
> +#elif GET_ANIMAL_INTERNAL_1 == 6
> +# define GET_ANIMAL_VERSION "Tired"
> +#elif GET_ANIMAL_INTERNAL_1 == 7
> +# define GET_ANIMAL_VERSION "Crazy"
> +#elif GET_ANIMAL_INTERNAL_1 == 8
> +# define GET_ANIMAL_VERSION "Dyslexic"
> +#elif GET_ANIMAL_INTERNAL_1 == 9
> +# define GET_ANIMAL_VERSION "Unbeatable"
> +#else
> +# define GET_ANIMAL_VERSION "Unknown"
> +#endif
> +
> +
> +#if GET_ANIMAL_INTERNAL_2 == 0
> +# define GET_ANIMAL_PATCHLEVEL "Chicken"
> +#elif GET_ANIMAL_INTERNAL_2 == 1
> +# define GET_ANIMAL_PATCHLEVEL "GroundHog"
> +#elif GET_ANIMAL_INTERNAL_2 == 2
> +# define GET_ANIMAL_PATCHLEVEL "Ostrich"
> +#elif GET_ANIMAL_INTERNAL_2 == 3
> +# define GET_ANIMAL_PATCHLEVEL "HedgeHog"
> +#elif GET_ANIMAL_INTERNAL_2 == 4
> +# define GET_ANIMAL_PATCHLEVEL "Penguin"
> +#elif GET_ANIMAL_INTERNAL_2 == 5
> +# define GET_ANIMAL_PATCHLEVEL "Kitten"
> +#elif GET_ANIMAL_INTERNAL_2 == 6
> +# define GET_ANIMAL_PATCHLEVEL "Owl"
> +#elif GET_ANIMAL_INTERNAL_2 == 7
> +# define GET_ANIMAL_PATCHLEVEL "Shrew"
> +#elif GET_ANIMAL_INTERNAL_2 == 8
> +# define GET_ANIMAL_PATCHLEVEL "Rabbit"
> +#elif GET_ANIMAL_INTERNAL_2 == 9
> +# define GET_ANIMAL_PATCHLEVEL "Hawk"
> +#else
> +# define GET_ANIMAL_PATCHLEVEL "Unknown"
> +#endif
> +
> +
> +#if GET_ANIMAL_INTERNAL_3 == 0
> +# define GET_ANIMAL_SUBLEVEL0 "doing"
> +#elif GET_ANIMAL_INTERNAL_3 == 1
> +# define GET_ANIMAL_SUBLEVEL0 "selling"
> +#elif GET_ANIMAL_INTERNAL_3 == 2
> +# define GET_ANIMAL_SUBLEVEL0 "felling the effects of"
> +#elif GET_ANIMAL_INTERNAL_3 == 3
> +# define GET_ANIMAL_SUBLEVEL0 "spewing"
> +#elif GET_ANIMAL_INTERNAL_3 == 4
> +# define GET_ANIMAL_SUBLEVEL0 "needing"
> +#elif GET_ANIMAL_INTERNAL_3 == 5
> +# define GET_ANIMAL_SUBLEVEL0 "buying"
> +#elif GET_ANIMAL_INTERNAL_3 == 6
> +# define GET_ANIMAL_SUBLEVEL0 "handing out"
> +#elif GET_ANIMAL_INTERNAL_3 == 7
> +# define GET_ANIMAL_SUBLEVEL0 "whining for"
> +#elif GET_ANIMAL_INTERNAL_3 == 8
> +# define GET_ANIMAL_SUBLEVEL0 "looking for"
> +#elif GET_ANIMAL_INTERNAL_3 == 9
> +# define GET_ANIMAL_SUBLEVEL0 "on"
> +#elif GET_ANIMAL_INTERNAL_3 == 10
> +# define GET_ANIMAL_SUBLEVEL0 "abusing"
> +#elif GET_ANIMAL_INTERNAL_3 == 11
> +# define GET_ANIMAL_SUBLEVEL0 "missing"
> +#elif GET_ANIMAL_INTERNAL_3 == 12
> +# define GET_ANIMAL_SUBLEVEL0 "wanting"
> +#elif GET_ANIMAL_INTERNAL_3 == 13
> +# define GET_ANIMAL_SUBLEVEL0 "seeing"
> +#elif GET_ANIMAL_INTERNAL_3 == 14
> +# define GET_ANIMAL_SUBLEVEL0 "imagining"
> +#elif GET_ANIMAL_INTERNAL_3 == 15
> +# define GET_ANIMAL_SUBLEVEL0 "remembering"
> +#else
> +# define GET_ANIMAL_SUBLEVEL0 "Unknown"
> +#endif
> +
> +
> +#if GET_ANIMAL_INTERNAL_4 == 0
> +# define GET_ANIMAL_SUBLEVEL1 "LSD"
> +#elif GET_ANIMAL_INTERNAL_4 == 1
> +# define GET_ANIMAL_SUBLEVEL1 "Quaaludes"
> +#elif GET_ANIMAL_INTERNAL_4 == 2
> +# define GET_ANIMAL_SUBLEVEL1 "Prozac"
> +#elif GET_ANIMAL_INTERNAL_4 == 3
> +# define GET_ANIMAL_SUBLEVEL1 "Pot"
> +#elif GET_ANIMAL_INTERNAL_4 == 4
> +# define GET_ANIMAL_SUBLEVEL1 "Whiskey"
> +#elif GET_ANIMAL_INTERNAL_4 == 5
> +# define GET_ANIMAL_SUBLEVEL1 "Steroids"
> +#elif GET_ANIMAL_INTERNAL_4 == 6
> +# define GET_ANIMAL_SUBLEVEL1 "Warm Milk"
> +#elif GET_ANIMAL_INTERNAL_4 == 7
> +# define GET_ANIMAL_SUBLEVEL1 "Hot Java"
> +#elif GET_ANIMAL_INTERNAL_4 == 8
> +# define GET_ANIMAL_SUBLEVEL1 "Mountain Dew"
> +#elif GET_ANIMAL_INTERNAL_4 == 9
> +# define GET_ANIMAL_SUBLEVEL1 "Jolt Cola"
> +#elif GET_ANIMAL_INTERNAL_4 == 10
> +# define GET_ANIMAL_SUBLEVEL1 "Cocaine"
> +#elif GET_ANIMAL_INTERNAL_4 == 11
> +# define GET_ANIMAL_SUBLEVEL1 "Dark Rum"
> +#elif GET_ANIMAL_INTERNAL_4 == 12
> +# define GET_ANIMAL_SUBLEVEL1 "Endorphins"
> +#elif GET_ANIMAL_INTERNAL_4 == 13
> +# define GET_ANIMAL_SUBLEVEL1 "Adrenaline"
> +#elif GET_ANIMAL_INTERNAL_4 == 14
> +# define GET_ANIMAL_SUBLEVEL1 "Vitamins"
> +#elif GET_ANIMAL_INTERNAL_4 == 15
> +# define GET_ANIMAL_SUBLEVEL1 "Nicotine"
> +#else
> +# define GET_ANIMAL_SUBLEVEL1 "Unknown"
> +#endif
> +
> #define LINUX_VERSION_CODE 66402
>
>



\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.199 / U:1.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site