Animal patch 1.03.

Joel Maslak (j@pobox.com)
Sun, 26 May 1996 14:59:32 -0600 (MDT)


1.03 is HERE!

WHAT:

The animal patch gives you two features:
1. FULL name of kernel is displayed during boot

VFS: Diskquotas version dquot_5.6.0 initialized
Checking 386/387 coupling... Ok, fpu using exception 16 error reporting.
Checking 'hlt' instruction... Ok.
Linux version 1.99.6 (root@blackhole.mordor) (gcc version 2.7.2)
#3-pre-2.0 Sun May 26 14:21:30 MDT 1996
<Greased Platypus on Warm Milk>
Serial driver version 4.12 with no serial options enabled
tty00 at 0x03f8 (irq = 4) is a 16550A

2. A /proc/sys/kernel/animal is created. You may use this in programs to
display what kernel an application is running under.
# cat /proc/sys/kernel/animal
Greased Platypus on Warm Milk
#

Obviously this patch is *VITAL* to ANY fully-functional Linux machine!
Besides, it's small. (thanks much to the C pre-processor)

WHAT'S NEW:

1. /proc/animal is now gone. Use /proc/sys/kernel/animal instead. (This
will NOT change again.) You will need to change scripts which refer to
/proc/animal. :(

2. Removed animal name from /proc/version. /proc/version now only
displays traditional info.

3. BIG BUG FIX: 2.x.x kernels will now be known as Penguins. Previously,
2.0.x would have been a (???!!!) CHICKEN!!! Also, animal selection used
to be based on kernel patch level (x.2.x), instead of version number
(2.x.x). This has been fixed. Now, the adjective describing the animal
changes with the patch level and the animal only changes when a new
version is released (won't change until 2.0). Hard-wired in support so
that pre2.0 continues to be greased Platypus. This also enables me to
change order of verbs/adjectives for 2.0 without fear of breaking support
for 1.3. The current naming system is final for pre2.0 series kernels.

4. Put code in to display animal name upon boot-up.

USAGE:

1. Apply patch to kernel.

2. Reconfigure kernel. Make sure that you say "Y" to experimental
drivers, and "Y" to kernel nick-names (under procfs support). If you
don't do this, your kernel WILL NOT support animal names! :(

3. Recompile kernel and reboot.

4. cat /proc/sys/kernel/animal

=======================================================================

This patch has been tested with pre2.0.6, but should work with most
kernels. Please reverse all previously applied animal patches.

PATCH:
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/init/main.c linux/init/main.c
--- linux-1.99.6.orig/init/main.c Thu May 16 07:35:55 1996
+++ linux/init/main.c Sun May 26 13:49:40 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,14 @@
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
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
+