A few quick tweaks for /proc/animal

lilo (TaRDiS@mail.utexas.edu)
Tue, 14 May 1996 09:36:55 -0500 (CDT)


Hmmm, I've noticed a couple of sub-optimal designations in /proc/animal,
corrected below.

For one thing, `on' and `doing' are way too close to being synonymous. So
I've eliminated `doing' (`on' flows better, as for example, kernel 2.0.0,
`Turbocharged Chicken on LSD') and moved `on' up to its spot. Feedback
gratefully accepted.

Also, I fixed the spelling error (`felling' versus `feeling').

Finally, I've replaced the old `on' designation with `making', thus enabling
kernels such as `Turbocharged Chicken making LSD', which seemed a useful and
productive innovation. I'm not entirely satisfied with the order of the
verbs though---it seems to me they should progress from use through
out-of-control abuse on through manufacture, but please, feedback on this
would be greatly appreciated.... :) At this rate though, the traffic might
warrant the creation of a newsgroup for this herculean development effort.
I had in mind something like

alt.os.linux.proc.animal.development

Let me know what you think.

The next patch should provide a configuration option to allow people
compiling the kernel to decide whether they want to add this important
feature. I'd say the default should be `N'. :) But I'm certain Linus will
want to get this into the standard kernel source before the advent of
Turbocharged Chicken on LSD. I'll try to get modules support in. I know
it's important.

Thank you again for your support.

:) lilo

--- linux/fs/proc/array.c Tue Apr 30 05:09:45 1996
+++ linux/fs/proc/array.c.NEW Tue May 14 09:01:23 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;
}
--- linux/fs/proc/root.c Tue Apr 30 05:09:45 1996
+++ linux/fs/proc/root.c.NEW Tue May 14 09:01:23 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);
--- linux/include/linux/animal.h Tue May 14 09:01:23 1996
+++ linux/include/linux/animal.h.NEW Tue May 14 09:01:23 1996
@@ -0,0 +1,135 @@
+/*
+ * /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"
+#elif GET_ANIMAL_INTERNAL_2 == 99
+# define GET_ANIMAL_PATCHLEVEL "Platypus"
+#else
+# define GET_ANIMAL_PATCHLEVEL "Unknown"
+#endif
+
+
+#if GET_ANIMAL_INTERNAL_3 == 0
+# define GET_ANIMAL_SUBLEVEL0 "on"
+#elif GET_ANIMAL_INTERNAL_3 == 1
+# define GET_ANIMAL_SUBLEVEL0 "selling"
+#elif GET_ANIMAL_INTERNAL_3 == 2
+# define GET_ANIMAL_SUBLEVEL0 "feeling 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 "making"
+#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
+
--- linux/include/linux/proc_fs.h Tue May 14 05:27:56 1996
+++ linux/include/linux/proc_fs.h.NEW Tue May 14 09:01:23 1996
@@ -43,7 +43,8 @@
PROC_MTAB,
PROC_MD,
PROC_RTC,
- PROC_LOCKS
+ PROC_LOCKS,
+ PROC_ANIMAL
};

enum pid_directory_inos {