A recent query on the lkml asked for opinions as to what are "the most frightening pieces of the kernel". The many responses offered more humor than fright, with a handful of snippets that prove entertaining to read through. From colorful metaphors, to burning printers, to happy meals...
I suspect there's plenty of other entertaining pieces of kernel code to be shared. What else have you come across in your own kernel efforts that brought you a smile? Please feel free to post some snippets...
From: Maciej Soltysiak Subject: [STUPID] Best looking code to transfer to a t-shirt Date: Fri, 3 Jan 2003 14:25:09 +0100 (CET) Hi, I am in a t-shirt transfering frenzy and was wondering which part of the kernel code it would be best to have on my t-shirt. I was looking at my favourite: netfilter code, but it is to clean, short and simple functions, no tons of pointers, no mallocs, no hex numbers, too many defines used. I was looking for something terribly complicated and looking awesome to the eye. How about we have a poll of the most frightening pieces of the kernel ? What are your ideas? Regards, Maciej Soltysiak
From: Jose Celestino Subject: Re: [STUPID] Best looking code to transfer to a t-shirt Date: Fri, 3 Jan 2003 13:26:04 +0000 Words by Maciej Soltysiak [Fri, Jan 03, 2003 at 02:25:09PM +0100]: > Hi, > > I am in a t-shirt transfering frenzy and was wondering which part of the > kernel code it would be best to have on my t-shirt. > I was looking at my favourite: netfilter code, but it is to clean, short > and simple functions, no tons of pointers, no mallocs, no hex numbers, too > many defines used. I was looking for something terribly complicated and > looking awesome to the eye. > > How about we have a poll of the most frightening pieces of the kernel ? > What are your ideas? > [root@morgoth:/usr/src/linux]# egrep -ir "( fuck)|( shit)" * and choose. -- Jose Celestino | http://xpto.org/~japc/files/japc-pgpkey.asc ---------------------------------------------------------------- "Don't summarize. Don't abbreviate. Don't interpret." -- djb
From: Matthias Schniedermeyer Subject: Re: [STUPID] Best looking code to transfer to a t-shirt Date: Fri, 3 Jan 2003 15:55:14 +0100 On Fri, Jan 03, 2003 at 02:25:09PM +0100, Maciej Soltysiak wrote: > Hi, > > I am in a t-shirt transfering frenzy and was wondering which part of the > kernel code it would be best to have on my t-shirt. > I was looking at my favourite: netfilter code, but it is to clean, short > and simple functions, no tons of pointers, no mallocs, no hex numbers, too > many defines used. I was looking for something terribly complicated and > looking awesome to the eye. > > How about we have a poll of the most frightening pieces of the kernel ? > What are your ideas? egrep -ir "(on fire)" * drivers/usb/printer.c:static char *usblp_messages[] = { "ok", "out of paper", "off-line", "on fire" }; :-) Bis denn -- Real Programmers consider "what you see is what you get" to be just as bad a concept in Text Editors as it is in women. No, the Real Programmer wants a "you asked for it, you got it" text editor -- complicated, cryptic, powerful, unforgiving, dangerous.
From: Anders Gustafsson Subject: Re: [STUPID] Best looking code to transfer to a t-shirt Date: Fri, 3 Jan 2003 16:03:38 +0100 On Fri, Jan 03, 2003 at 03:55:14PM +0100, Matthias Schniedermeyer wrote: > egrep -ir "(on fire)" * > > drivers/usb/printer.c:static char *usblp_messages[] = { "ok", "out of > paper", "off-line", "on fire" }; A good explanation of that message by Jesse Pollard can be found here: http://marc.theaimsgroup.com/?l=linux-kernel&m=102893054014512&w=2 -- Anders Gustafsson - andersg@0x63.nu - http://0x63.nu/
From: Rik van Riel Subject: Re: [STUPID] Best looking code to transfer to a t-shirt Date: Fri, 3 Jan 2003 20:58:50 -0200 (BRST) On Fri, 3 Jan 2003, Maciej Soltysiak wrote: > I am in a t-shirt transfering frenzy and was wondering which part of the > kernel code it would be best to have on my t-shirt. > How about we have a poll of the most frightening pieces of the kernel ? How about drivers/net/sunhme.c ? It's not scary, but it is absolutely hilarious, even to people who don't even know C. static void happy_meal_tcvr_write(struct happy_meal *hp, unsigned long tregs, int reg, unsigned short value) { int tries = TCVR_WRITE_TRIES; ASD(("happy_meal_tcvr_write: reg=0x%02x value=%04xn", reg, value)); /* Welcome to Sun Microsystems, can I take your order please? */ if (!hp->happy_flags & HFLAG_FENABLE) return happy_meal_bb_write(hp, tregs, reg, value); /* Would you like fries with that? */ hme_write32(hp, tregs + TCVR_FRAME, (FRAME_WRITE | (hp->paddr From: William Lee Irwin III Subject: Re: [STUPID] Best looking code to transfer to a t-shirt Date: Fri, 3 Jan 2003 15:39:27 -0800 On Fri, Jan 03, 2003 at 02:25:09PM +0100, Maciej Soltysiak wrote: > I am in a t-shirt transfering frenzy and was wondering which part of the > kernel code it would be best to have on my t-shirt. > I was looking at my favourite: netfilter code, but it is to clean, short > and simple functions, no tons of pointers, no mallocs, no hex numbers, too > many defines used. I was looking for something terribly complicated and > looking awesome to the eye. > How about we have a poll of the most frightening pieces of the kernel ? > What are your ideas? sheer bulk: include/asm-ia64/sn/sn2/shub_mmr.h most typedefs: include/asm-ia64/sn/sn2/shub_mmr_t.h bizarre (and ugly) idiom: fs/devfs/*.c just plain ugly: arch/i386/kernel/cpu/mtrr/generic.c really crusty-looking: drivers/char/*tty*.c terrifying ultra-legacyness: drivers/ide/legacy/hd.c fishiness: drivers/usb/serial/pl2303.c why so much code?: drivers/char/dz.c highly cleanup-resistant: mm/slab.c unusual preprocessor games: kernel/cpufreq.c contrived inefficiency: fs/proc/inode.c:proc_fill_super() Bill
From: Ranjeet Shetye To: Subject: RE: [STUPID] Best looking code to transfer to a t-shirt Date: Fri, 3 Jan 2003 16:20:43 -0800 I vote for "panic ()" in kernel/panic.c The panic output makes my heart sink everytime single time. If only the Linux kernel had something as heart-warming as FreeBSD's "diediedie ()". :D Ranjeet Shetye Senior Software Engineer
From: Maciej Soltysiak Subject: RE: [STUPID] Best looking code to transfer to a t-shirt Date: Sat, 4 Jan 2003 14:47:46 +0100 (CET) Thank you all for your suggestions, i found this very entertaining, lot of laughs i must say. Also the ammount of 'shit' and 'fuck' words totally blew me off :) I think i'll put on my t-shirt: - panic() - risc logos (on the sides) - printer "on fire" line (btw. 2.4.20 doesn't have "on fire", just: "unknown error", 2.5.54 has it in drivers/usb/class/usblp.c) - the elegant idle routine - also nice to have. maybe on the back I'll look also through William's suggestions. Thank you all very much. Have a really nice day.
sunhme.c
that happy meal code isn't as funny as its origin. The Sun hme ethernet devices actually stand for "happy meal ethernet". Something about the sun engineers having had happy meals for lunch the day they put those in.
Re: sunhme.c
Sun defines hme as 'hundred meg ethernet.'
Yeah, right
I've never heard *anyone* at Sun refer to them as anything else than Happy Meal interfaces, and I admin 200 Suns, so I speak to them quite a lot.
HME
That's only the start... most products tend to have internal, development names, and external, finished, product names, along with the tidy code name.
You can find a whole load of Sun product names here
HME == Happy Meal Ethernet
Actually, it *is* a Sun engineer joke. The 10 Mbps predecessor was a chip called the "Big MAC Ethernet" -- in this case, it was a mere pun, since MAC stands for Media Access Control, i.e. the Ethernet data-link layer. When they designed the 10/100Mbps chip later on, they decided to turn the pun into a full-out joke, and they called it the "Happy Meal Ethernet."
On a Solaris machine, the interfaces are named by the driver type, so instead of "eth0" you'll see something like "hme0" instead.
Regards,
Art Cancro
UNCENSORED! BBS
BigMac ethernet
I am sorry, the BigMac interface is also 100MBps. (Possibly the first 100MBps Sun ethernet interface?)
sfdisk --help
[brian@hellfire ~]# sudo /sbin/sfdisk --help | grep force
-f [or --force]: do what I say, even if it is stupid
favorite from egrep -ir "( fuck)|( shit)" *
include/asm-mips/mmu_context.h:/* Fuck. The f-word is here so you can grep for it :-) */
init/main.c static void __
init/main.c
static void __init do_basic_setup(void)
{
/*
* Tell the world that we're going to be the grim
* reaper of innocent orphaned children.
*
* We don't want people to have to make incorrect
* assumptions about where in the task array this
* can be found.
*/
child_reaper = current;
Killing the children
As a comp.sci major, I have worked both as a computer lab supervisor and a tutor. It is always rather amusing when they are learning about processes, especially child processes. One of the asignments is to make a simple shell with job control. It is hilarious to see non-comp.sci girls react when you talk about killing the children (This is in a foreign language, where a translation reap doesn't really differ from killing in the normal spoken way). After a while, they start to talk about it as more experienced students and often shock their friends by explaining what problems they have with their assignments. "The parent won't kill the children like it should".
isn't that a metallica song?
isn't that a metallica song?
Re: isn't that a metallica song?
I think you are thinking of "Don't Fear the Reaper" by Blue Oyster Cult.
or
"please don't eat the children" by bloodrock
or maybe even
"children of the grave" by black sabbath
fetus on the beat
check out "fetus on the beat" via google -- an entire meat-rocker album about abortion and such
As long as this misinterprati
As long as this misinterpration doesn't lead you to the assumption that the Children of Bodom are a bunch of nerds..
CoB ARE a bunch of nerds, no
CoB ARE a bunch of nerds (mayby not computers, though), no doubt about that ;)
Nice music, however.
You might be thinking about "I Kill Children"...
"I kill children, I like to see them die."
-- The Dead Kennedys
child_reaper = current;
I worked in a medical equipment company on an ultrasound system (Frequently used on pregnant people) running awhere we had a project to clean up any possibility of any such messages.
Ron
I can imagine!!!
"Child process died" or similar would be rather disconcerting in this situation!
HAHAHAHA
I would like to see that plaque... it's just SO funny it hurts, thanks for the laugh man, all respect.
appeal to the almighty
in drivers/char/rio/list.h
/*
** Will God see it within his heart to forgive us for this thing that
** we have created?
polytheistic kernel?
in 2.4.20
grep -r "[gG]od" ./* | wc -l
27
/usr/src/linux-2.6.11-gentoo-
/usr/src/linux-2.6.11-gentoo-rc5 $ grep -r "[gG]od" ./* | wc -l
33
Does the following say someth
Does the following say something about Gentoo (I run it myself btw)?
Happy Meal
drivers/net/sunhme.c: printk(KERN_ERR "%s: Happy Meal would not start auto negotiation "
I hate when my Happy Meal doesn't negotiate.
drivers/net/sunhme.c: /* Reset the Happy Meal Big Mac transceiver and the receiver. */
Big Mac's have transceivers?
drivers/net/sunhme.c: printk(KERN_ERR "happy meal: Eieee, rx config register gets greasy fries.\n");
No wonder my motherboard keeps getting fried.
drivers/net/sunhme.c:static int happy_meal_is_not_so_happy(struct happy_meal *hp, u32 status)
When your happy meal turns upside down.
drivers/net/sunhme.c: printk(KERN_ERR "%s: Happy Meal BigMAC SQE test failed.\n", hp->dev->name);
Stomach Queue Empty, maybe it could empty easier if those Big Macs didn't have tranceivers?
drivers/net/sunhme.c: /* Return it to the Happy meal. */
In Soviet Russia, the Happy Meal returns YOU!
drivers/net/sunhme.c: printk(KERN_ERR "happymeal: Would you like that for here or to go?\n");
To go, please.
drivers/net/sunhme.c: /* Happy Meal can do it all... */
Fries, hamburger, a drink... oh, and a really cool toy!
drivers/net/sunhme.c: happy_meal_set_initial_advertisement(hp);
I wonder if McDonalds sponsors these advertisements?
drivers/net/sunhme.c: /* Assume PCI happy meals can handle all burst sizes. */
Burst sizes... no comment. I would love to see a PCI happy meal, though.
drivers/net/sunhme.c:module_init(happy_meal_probe);
Happy Meal probe... *shudder*
sun hme controller
The sun hme aka happy meal is a real name for the sun 100 base T controller. The device shows up as hme0, hme1, etc on solaris.
The "happy meal name" could have come from the fact that the original hme controller has a scsi controller and a network interface on the same
card. You get scsi with network combined in a single s-bus slot.
Sort of like you get a burger and fries together in a happy meal.
RE: Happy Meal code comments
This has got to be the best one:
/* Only Sun can take such nice parts and fuck up the programming interface
* like this. Good job guys...
*/
Must be the same wackos who d
Must be the same wackos who designed the BSD sockets API (they all went to Sun, right)?
This is cute.
Some more
drivers/block/floppy.c: * computers possessed by the Devil :-) */
sound/isa/wavefront/wavefront_fx.c: /* Now, for some strange reason, lets reload every page
3rdparty/mod_dvb/dvb_filter.c: printk("NULL POINTER IDIOT\n");
Documentation/usb/error-codes.txt:-EINVAL ISO madness, if this happens: Log off and go home
drivers/message/fusion/mptscsih.h: * (good grief; heaven help me!)
Interesting comments in the kernel...
From /usr/include/linux/kdev_t.h:
Admissible operations on an object of type kdev_t:
- passing it along
- comparing it for equality with another such object
- storing it in ROOT_DEV, inode->i_dev, inode->i_rdev, sb->s_dev,
bh->b_dev, req->rq_dev, de->dc_dev, tty->device
- using its bit pattern as argument in a hash function
- finding its major and minor
- complaining about it
I vaguely remember
I vaguely remember that a previous version of the kernel had the phrase "Fuck me Gently with a Chainsaw" somewhere in the comments.
Still there
That comment is actually still there - see arch/sparc/kernel/ptrace.c in 2.4.19, for example. :)
--
schnee
Heathers
"Fuck me Gently with a Chainsaw" is a quote from the movie "Heathers". No originality credit to Linux engineers here..
More linux kernel fun
I remember getting a message on the console from a 2.0-era kernel
that said 'fucking Sun blows me' as it panicked, IIRC it was in either the NFS code
or somewhere in dealing with sun-style disklabels. it was pretty
amusing.. just grepping now, the comment seems to have disappeared
from more recent kernels.
Bits I thought were funny...
egrep -ir "( duh)" *
how about `egrep -ir " hell
how about `egrep -ir " hell " *` ?
drivers/net/seeq8005.h:#define SEEQCMD_WINDOW_INT_EN (0x0008) /* What the hell is this for?? */
drivers/ieee1394/dv1394.c: wake = 1; /* why the hell not? */
drivers/i2c/i2c-core.c- * use a trick here: we call driver->attach_adapter to
drivers/i2c/i2c-core.c- * *detach* it! Of course, each dummy driver should know about
drivers/i2c/i2c-core.c: * this or hell will break loose...
and there's more :-)
not from the kernel, but fun
linux sysklogd(8) man page:
[...]
SECURITY THREATS
[...]
4. Disabling inet domain sockets will limit risk to the local machine.
5. Use step 4 and if the problem persists and is not secondary to a rogue program/daemon get a 3.5 ft
(approx. 1 meter) length of sucker rod* and have a chat with the user in question.
Sucker rod def. -- 3/4, 7/8 or 1in. hardened steel rod, male threaded on each end. Primary use in the
oil industry in Western North Dakota and other locations to pump 'suck' oil from oil wells. Secondary
uses are for the construction of cattle feed lots and for dealing with the occasional recalcitrant or
belligerent individual.
[...]
cheers, sq5bpf
Good Humor
Nerd humor at its best!
--------------------
Tax Man
kernel code
For the complicated code there is the the code written under NDA(=>non documented and tremendously hard to read) would be great for his T shirt
he could also create one comparing blobs(asembler),nda and clean code(if he don't like blobs and NDA code)
:)
maybe this [root@morgoth:/usr/src/linux]# egrep -ir "( fuck)|( shit)" * ?
The same in time
The ages passed since that thread, but it still being the same brutal linux. I found 966 fuck inclusions.
Hurr
$ egrep -ir "( poop)" *
sound/pci/ice1712/aureon.c: * we have no digital output, no capture, pretty bad clicks and poops