animal patch 1.03, Take 2

Joel Maslak (j@pobox.com)
Sun, 26 May 1996 17:17:09 -0600 (MDT)


Here's the CORRECT patch. (I messed up the first time)...

diff -u --recursive --new-file linux-1.99.6.orig/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-1.99.6.orig/Documentation/Configure.help Sun May 19 06:29:28 1996
+++ linux/Documentation/Configure.help Sun May 26 13:53:42 1996
@@ -2774,7 +2774,16 @@
source of trouble if two devices are mistakenly configured to use
the same IRQ). Several programs depend on this, so everyone should
say Y here.
-
+
+Kernel nick-name support
+CONFIG_PROC_ANIMAL
+ By saying Y here, you will install /proc/sys/kernel/animal. This
+ file is used to determine the full name of the current release.
+ For instance, pre2.0.5's name was "Greased Platypus on Warm Milk".
+ Nothing bad will happen if you say N (yet!), but this driver takes
+ less than 1K of RAM. Thus, you should probably say Y, unless you
+ are running Linux on an embedded system.
+
NFS filesystem support
CONFIG_NFS_FS
If you are connected to some other (usually local) Unix computer
diff -u --recursive --new-file linux-1.99.6.orig/MAINTAINERS linux/MAINTAINERS
--- linux-1.99.6.orig/MAINTAINERS Sun May 12 12:33:00 1996
+++ linux/MAINTAINERS Sun May 26 13:20:04 1996
@@ -311,6 +311,11 @@
W: http://www.advansys.com/linux
S: Maintained

+KERNEL NAMING SYSTEM (/proc/animal) SUPPORT
+P: Joel Maslak
+M: Joel Maslak <j@pobox.com>
+S: Maintained
+
CREDITS FILE
P: John A. Martin
M: jam@acm.org
diff -u --recursive --new-file linux-1.99.6.orig/fs/Config.in linux/fs/Config.in
--- linux-1.99.6.orig/fs/Config.in Sun May 19 06:22:19 1996
+++ linux/fs/Config.in Sun May 26 13:20:04 1996
@@ -18,6 +18,12 @@
dep_tristate 'umsdos: Unix like fs on top of std MSDOS FAT fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS

bool '/proc filesystem support' CONFIG_PROC_FS
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+ bool ' Kernel nick-name support in /proc/animal' CONFIG_PROC_ANIMAL
+ fi
+fi
+
if [ "$CONFIG_INET" = "y" ]; then
tristate 'NFS filesystem support' CONFIG_NFS_FS
if [ "$CONFIG_NFS_FS" = "y" ]; then
diff -u --recursive --new-file linux-1.99.6.orig/include/linux/sysctl.h linux/include/linux/sysctl.h
--- linux-1.99.6.orig/include/linux/sysctl.h Sun May 12 22:17:23 1996
+++ linux/include/linux/sysctl.h Sun May 26 13:22:22 1996
@@ -61,6 +61,7 @@
#define KERN_NFSRADDRS 18 /* NFS root addresses */
#define KERN_JAVA_INTERPRETER 19 /* path to Java(tm) interpreter */
#define KERN_JAVA_APPLETVIEWER 20 /* path to Java(tm) appletviewer */
+#define KERN_PROC_ANIMAL 21

/* CTL_VM names: */
#define VM_SWAPCTL 1 /* struct: Set vm swapping control */
diff -u --recursive --new-file linux-1.99.6.orig/kernel/sysctl.c linux/kernel/sysctl.c
--- linux-1.99.6.orig/kernel/sysctl.c Sun May 12 22:17:23 1996
+++ linux/kernel/sysctl.c Sun May 26 13:47:24 1996
@@ -6,6 +6,7 @@
* Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
* Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
* Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
+ * Added /proc/sys/kernel/animal support, 96/5/22, Joel Maslak.
*/

#include <linux/config.h>
@@ -23,6 +24,11 @@
#include <linux/utsname.h>
#include <linux/swapctl.h>

+#ifdef CONFIG_PROC_ANIMAL
+# include <linux/version.h>
+# include <linux/animal.h>
+#endif
+
/* External variables not in a header file. */
extern int panic_timeout;

@@ -147,6 +153,12 @@
64, 0644, NULL, &proc_dostring, &sysctl_string },
{KERN_JAVA_APPLETVIEWER, "java-appletviewer", binfmt_java_appletviewer,
64, 0644, NULL, &proc_dostring, &sysctl_string },
+#endif
+#ifdef CONFIG_PROC_ANIMAL
+ {KERN_PROC_ANIMAL, "animal", (char *) GET_ANIMAL_PATCHLEVEL " "
+ GET_ANIMAL_VERSION " " GET_ANIMAL_SUBLEVEL0 " "
+ GET_ANIMAL_SUBLEVEL1, GET_ANIMAL_MAX_LEN, 0644, NULL,
+ &proc_dostring, &sysctl_string },
#endif
{0}
};
diff -u --recursive --new-file linux-1.99.6.orig/include/linux/animal.h linux/include/linux/animal.h
--- linux-1.99.6.orig/include/linux/animal.h Wed Dec 31 17:00:00 1969
+++ linux/include/linux/animal.h Sun May 26 14:13:57 1996
@@ -0,0 +1,145 @@
+/*
+ * /proc/animal header file
+ * Joel C. Maslak, 1996, j@pobox.com
+ *
+ * Idea from: Andrew Esh
+ */
+
+#define GET_ANIMAL_MAX_LEN 64
+
+#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) && (GET_ANIMAL_INTERNAL_2 != 99)
+# if GET_ANIMAL_INTERNAL_1 == 0
+# define GET_ANIMAL_VERSION "Ostrich"
+# elif GET_ANIMAL_INTERNAL_1 == 1
+# define GET_ANIMAL_VERSION "HedgeHog"
+# elif GET_ANIMAL_INTERNAL_1 == 2
+# define GET_ANIMAL_VERSION "Penguin"
+# elif GET_ANIMAL_INTERNAL_1 == 3
+# define GET_ANIMAL_VERSION "GroundHog"
+# elif GET_ANIMAL_INTERNAL_1 == 4
+# define GET_ANIMAL_VERSION "Chicken"
+# elif GET_ANIMAL_INTERNAL_1 == 5
+# define GET_ANIMAL_VERSION "Kitten"
+# elif GET_ANIMAL_INTERNAL_1 == 6
+# define GET_ANIMAL_VERSION "Owl"
+# elif GET_ANIMAL_INTERNAL_1 == 7
+# define GET_ANIMAL_VERSION "Shrew"
+# elif GET_ANIMAL_INTERNAL_1 == 8
+# define GET_ANIMAL_VERSION "Rabbit"
+# elif GET_ANIMAL_INTERNAL_1 == 9
+# define GET_ANIMAL_VERSION "Hawk"
+# else
+# define GET_ANIMAL_VERSION "Unknown"
+# endif
+
+
+# if GET_ANIMAL_INTERNAL_2 == 0
+# define GET_ANIMAL_PATCHLEVEL "Electrified"
+# elif GET_ANIMAL_INTERNAL_2 == 1
+# define GET_ANIMAL_PATCHLEVEL "Supercharged"
+# elif GET_ANIMAL_INTERNAL_2 == 2
+# define GET_ANIMAL_PATCHLEVEL "Turbocharged"
+# elif GET_ANIMAL_INTERNAL_2 == 3
+# define GET_ANIMAL_PATCHLEVEL "Greased"
+# elif GET_ANIMAL_INTERNAL_2 == 4
+# define GET_ANIMAL_PATCHLEVEL "Stealthy"
+# elif GET_ANIMAL_INTERNAL_2 == 5
+# define GET_ANIMAL_PATCHLEVEL "Hyper-active"
+# elif GET_ANIMAL_INTERNAL_2 == 6
+# define GET_ANIMAL_PATCHLEVEL "Tired"
+# elif GET_ANIMAL_INTERNAL_2 == 7
+# define GET_ANIMAL_PATCHLEVEL "Crazy"
+# elif GET_ANIMAL_INTERNAL_2 == 8
+# define GET_ANIMAL_PATCHLEVEL "Dyslexic"
+# elif GET_ANIMAL_INTERNAL_2 == 9
+# define GET_ANIMAL_PATCHLEVEL "Unbeatable"
+# else
+# define GET_ANIMAL_PATCHLEVEL "Unknown"
+# endif
+
+/* Special Case here -- pre2.0.x */
+#else
+# if GET_ANIMAL_INTERNAL_2 == 99
+# if GET_ANIMAL_INTERNAL_1 == 1
+# define GET_ANIMAL_PATCHLEVEL "Greased"
+# define GET_ANIMAL_VERSION "Platypus"
+# endif
+# endif
+#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-1.99.6.orig/init/main.c Thu May 16 07:35:55 1996
+++ linux/init/main.c Sun May 26 17:05:34 1996
@@ -5,6 +5,8 @@
*
* GK 2/5/95 - Changed to support mounting root fs via NFS
* Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96
+ * JM 5/26/95 - Changed to print animal name upon boot if /proc/animal is
+ * configured
*/

#define __KERNEL_SYSCALLS__
@@ -35,6 +37,10 @@
#ifdef CONFIG_ROOT_NFS
#include <linux/nfs_fs.h>
#endif
+#ifdef CONFIG_PROC_ANIMAL
+# include <linux/version.h>
+# include <linux/animal.h>
+#endif

#include <asm/bugs.h>

@@ -813,7 +819,21 @@
sti();
check_bugs();

+#ifdef CONFIG_PROC_ANIMAL
+ printk(linux_banner);
+ printk(" <");
+ printk(GET_ANIMAL_PATCHLEVEL);
+ printk(" ");
+ printk(GET_ANIMAL_VERSION);
+ printk(" ");
+ printk(GET_ANIMAL_SUBLEVEL0);
+ printk(" ");
+ printk(GET_ANIMAL_SUBLEVEL1)
+ printk(">\n");
+#else
printk(linux_banner);
+#endif
+
#ifdef __SMP__
smp_init();
#endif