+ BSOD_MARGINS (bst, xoff, yoff);
+
+ BSOD_COLOR (bst, bc, bg);
+ BSOD_RECT (bst, True, 0, 0, bst->xgwa.width, bst->xgwa.height);
+ BSOD_COLOR (bst, bg, bg);
+ BSOD_RECT (bst, True, xoff-2, yoff, page_right+4, page_bottom);
+ BSOD_COLOR (bst, fg, bg);
+
+ BSOD_MOVETO (bst, xoff, yoff + line_height);
+ BSOD_TEXT (bst, LEFT, left);
+ BSOD_MOVETO (bst, xoff+col_right, yoff + row_top + line_height);
+ BSOD_TEXT (bst, LEFT, bottom);
+
+ BSOD_RECT (bst, True, xoff + col_right, yoff, 2, page_bottom);
+ BSOD_RECT (bst, True, xoff + col_right, yoff + row_top,
+ page_right - col_right, 1);
+ BSOD_RECT (bst, True, xoff + col_right, yoff + row_bottom,
+ page_right - col_right, 1);
+ BSOD_RECT (bst, False, xoff-2, yoff, page_right+4, page_bottom);
+
+ BSOD_LINE_DELAY (bst, 500);
+ BSOD_MOVETO (bst,
+ xoff + col_right + char_width,
+ yoff + body_top + line_height);
+ BSOD_MARGINS (bst, xoff + col_right + char_width, yoff);
+ BSOD_TEXT (bst, LEFT, body);
+
+ BSOD_RECT (bst, False, xoff-2, yoff, page_right+4, page_bottom); /* again */
+
+ BSOD_RECT (bst, False,
+ xoff + col_right + (char_width/2)+2,
+ yoff + row_bottom + 2,
+ 0,
+ page_bottom - row_bottom - 4);
+
+ BSOD_PAUSE (bst, 666666);
+ BSOD_INVERT (bst);
+ BSOD_LOOP (bst, -3);
+
+ XClearWindow (dpy, window);
+ return bst;
+}
+
+
+static struct bsod_state *
+mac1 (Display *dpy, Window window)
+{
+ struct bsod_state *bst = make_bsod_state (dpy, window, "mac1", "Mac1");
+
+ Pixmap pixmap = 0;
+ int pix_w = macbomb_width;
+ int pix_h = macbomb_height;
+ int x, y;
+
+ pixmap = XCreatePixmapFromBitmapData (dpy, window, (char *) macbomb_bits,
+ macbomb_width, macbomb_height,
+ bst->fg, bst->bg, bst->xgwa.depth);
+
+ x = (bst->xgwa.width - pix_w) / 2;
+ y = (bst->xgwa.height - pix_h) / 2;
+ if (y < 0) y = 0;
+
+ XClearWindow (dpy, window);
+ XCopyArea (dpy, pixmap, window, bst->gc, 0, 0, pix_w, pix_h, x, y);
+
+ return bst;
+}
+
+
+/* This is what kernel panics looked like on MacOS X 10.0 through 10.1.5.
+ In later releases, it's a graphic of a power button with text in
+ English, French, German, and Japanese overlayed transparently.
+ */
+static struct bsod_state *
+macx_10_0 (Display *dpy, Window window)
+{
+ struct bsod_state *bst = make_bsod_state (dpy, window, "macx", "MacX");
+
+ XClearWindow (dpy, window);
+ XSetForeground (dpy, bst->gc,
+ get_pixel_resource (dpy, bst->xgwa.colormap,
+ "macx.textForeground",
+ "MacX.TextForeground"));
+ XSetBackground (dpy, bst->gc,
+ get_pixel_resource (dpy, bst->xgwa.colormap,
+ "macx.textBackground",
+ "MacX.TextBackground"));
+
+# ifdef DO_XPM
+ {
+ Pixmap pixmap = 0;
+ Pixmap mask = 0;
+ int x, y, pix_w, pix_h;
+ pixmap = xpm_data_to_pixmap (dpy, window, (char **) happy_mac,
+ &pix_w, &pix_h, &mask);
+
+ x = (bst->xgwa.width - pix_w) / 2;
+ y = (bst->xgwa.height - pix_h) / 2;
+ if (y < 0) y = 0;
+ XSetClipMask (dpy, bst->gc, mask);
+ XSetClipOrigin (dpy, bst->gc, x, y);
+ XCopyArea (dpy, pixmap, window, bst->gc, 0, 0, pix_w, pix_h, x, y);
+ XSetClipMask (dpy, bst->gc, None);
+ XFreePixmap (dpy, pixmap);
+ }
+#endif /* DO_XPM */
+
+ bst->left_margin = 0;
+ bst->right_margin = 0;
+ bst->y = bst->font->ascent;
+ bst->macx_eol_kludge = True;
+ bst->wrap_p = True;
+
+ BSOD_PAUSE (bst, 3000000);
+ BSOD_TEXT (bst, LEFT,
+ "panic(cpu 0): Unable to find driver for this platform: "
+ "\"PowerMac 3,5\".\n"
+ "\n"
+ "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
+ "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
+ "\n"
+ "\n"
+ "\n"
+ "No debugger configured - dumping debug information\n"
+ "\n"
+ "version string : Darwin Kernel Version 1.3:\n"
+ "Thu Mar 1 06:56:40 PST 2001; root:xnu/xnu-123.5.obj~1/RELEASE_PPC\n"
+ "\n"
+ "\n"
+ "\n"
+ "\n"
+ "DBAT0: 00000000 00000000\n"
+ "DBAT1: 00000000 00000000\n"
+ "DBAT2: 80001FFE 8000003A\n"
+ "DBAT3: 90001FFE 9000003A\n"
+ "MSR=00001030\n"
+ "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
+ "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
+ "\n"
+ "panic: We are hanging here...\n");
+
+ return bst;
+}
+
+
+# ifdef DO_XPM
+static struct bsod_state *
+macx_10_2 (Display *dpy, Window window, Bool v10_3_p)
+{
+ struct bsod_state *bst = make_bsod_state (dpy, window, "macx", "MacX");
+
+ Pixmap pixmap = 0;
+ int pix_w = 0, pix_h = 0;
+ int x, y;
+
+ pixmap = xpm_data_to_pixmap (dpy, window,
+ (char **) (v10_3_p ? osx_10_3 : osx_10_2),
+ &pix_w, &pix_h, 0);
+ if (! pixmap) abort();
+
+#if 0
+ if (bst->xgwa.height > 600) /* scale up the bitmap */
+ {
+ pixmap = double_pixmap (dpy, bst->gc, bst->xgwa.visual, bst->xgwa.depth,
+ pixmap, pix_w, pix_h);
+ if (! pixmap) abort();
+ pix_w *= 2;
+ pix_h *= 2;
+ }
+#endif
+
+ BSOD_IMG (bst);
+ BSOD_PAUSE (bst, 2000000);
+
+ bst->pixmap = pixmap;
+
+ x = (bst->xgwa.width - pix_w) / 2;
+ y = ((bst->xgwa.height - pix_h) / 2);
+ BSOD_PIXMAP (bst, 0, 0, pix_w, pix_h, x, y);
+
+ return bst;
+}
+# endif /* DO_XPM */
+
+
+static struct bsod_state *
+macx (Display *dpy, Window window)
+{
+# ifdef DO_XPM
+ switch (random() % 3) {
+ case 0: return macx_10_0 (dpy, window); break;
+ case 1: return macx_10_2 (dpy, window, False); break;
+ case 2: return macx_10_2 (dpy, window, True); break;
+ default: abort();
+ }
+# else /* !DO_XPM */
+ return macx_10_0 (dpy, window);
+# endif /* !DO_XPM */
+}
+
+
+#ifndef HAVE_COCOA /* #### I have no idea how to implement this without
+ real plane-masks. I don't think it would look
+ right if done with alpha-transparency... */
+/* blit damage
+ *
+ * by Martin Pool <mbp@samba.org>, Feb 2000.
+ *
+ * This is meant to look like the preferred failure mode of NCD
+ * Xterms. The parameters for choosing what to copy where might not
+ * be quite right, but it looks about ugly enough.
+ */
+static struct bsod_state *
+blitdamage (Display *dpy, Window window)
+{
+ struct bsod_state *bst =
+ make_bsod_state (dpy, window, "blitdamage", "BlitDamage");
+
+ int i;
+ int delta_x = 0, delta_y = 0;
+ int w, h;
+ int chunk_h, chunk_w;
+ int steps;
+ long gc_mask = 0;
+ int src_x, src_y;
+ int x, y;
+
+ w = bst->xgwa.width;
+ h = bst->xgwa.height;
+
+ gc_mask = GCForeground;
+
+ XSetPlaneMask (dpy, bst->gc, random());
+
+ steps = 50;
+ chunk_w = w / (random() % 1 + 1);
+ chunk_h = h / (random() % 1 + 1);
+ if (random() & 0x1000)
+ delta_y = random() % 600;
+ if (!delta_y || (random() & 0x2000))
+ delta_x = random() % 600;
+ src_x = 0;
+ src_y = 0;
+ x = 0;
+ y = 0;
+
+ BSOD_IMG (bst);
+ for (i = 0; i < steps; i++) {
+ if (x + chunk_w > w)
+ x -= w;
+ else
+ x += delta_x;
+
+ if (y + chunk_h > h)
+ y -= h;
+ else
+ y += delta_y;
+
+ BSOD_COPY (bst, src_x, src_y, chunk_w, chunk_h, x, y);
+ BSOD_PAUSE (bst, 1000);
+ }
+
+ return bst;
+}
+#endif /* !HAVE_COCOA */
+
+
+/*
+ * OS/2 panics, by Knut St. Osmundsen <bird-xscreensaver@anduin.net>
+ *
+ * All but one messages are real ones, some are from my test machines
+ * and system dumps, others are reconstructed from google results.
+ * Please, don't be to hard if the formatting of the earlier systems
+ * aren't 100% correct.
+ */
+static struct bsod_state *
+os2 (Display *dpy, Window window)
+{
+ struct bsod_state *bst = make_bsod_state (dpy, window, "os2", "OS2");
+
+ __extension__
+ static const char * const os2_panics[] =
+ { /* OS/2 2.0 trap - details are bogus (CR0++). */
+ "TRAP 0002 ERRCD=0000 ERACC=**** ERLIM=********\n"
+ "EAX=7d240a58 EBX=ff202fdc ECX=00064423 EDX=00003624\n"
+ "ESI=fff3272c EDI=7d240004 EBP=00004a44 FLG=00003202\n"
+ "CS:EIP=0160:fff702a6 CSACC=c09d CSLIM=ffffffff\n"
+ "SS:ESP=0030:00004a38 SSACC=1097 SSLIM=00003fff\n"
+ "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=fffffffb\n"
+ "ES=0158 ESACC=c0f3 ESLIM=ffffffff CR2=1a060014\n"
+ "FS=0000 FSACC=**** FSLIM=********\n"
+ "GS=0000 GSACC=**** GSLIM=********\n"
+ "\n"
+ "The system detected an internal processing error\n"
+ "at location ##0160:fff6453f - 000d:a53f\n"
+ "60000, 9084\n"
+ "\n"
+ "038600d1\n"
+ "Internal revision 6.307, 92/03/01\n"
+ "\n",
+
+ /* warp 3 (early) */
+ "TRAP 000e ERRCD=0000 ERACC=**** ERLIM=********\n"
+ "EAX=ff050c20 EBX=000000bb ECX=ffff00c1 EDx=fff379b8\n"
+ "ESI=ffe55a3c EDI=00000000 EBP=00004eb8 FLG=00013282\n"
+ "CS:EIP=0160:fff8dbb8 CSACC=c09b CSLIM=ffffffff\n"
+ "SS:EIP=0030:00004eb4 SSACC=1097 SSLIM=00003fff\n"
+ "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=8001001b\n"
+ "ES=0158 DSACC=c0f3 DSLIM=ffffffff CR2=000000c7\n"
+ "FS=0000 FSACC=**** FSLIM=********\n"
+ "GS=0000 GSACC=**** GSLIM=********\n"
+ "\n"
+ "The system detected an internal processing error\n"
+ "at location ##0160:fff66bf0 - 000d:9bf0.\n"
+ "60000, 9084\n"
+ "\n"
+ "048600b4\n"
+ "Internal revision 8.125, 94/02/16\n"
+ "\n"
+ "The system is stopped. Record the location number of the error\n"
+ "and contact your service representative.\n",
+
+ /* warp 3 */
+ "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n"
+ "EAX=00000000 EBX=fdef1e0c ECX=00003824 EDX=0000edf9\n"
+ "ESI=fdf30e80 EDI=fc8b0000 EBP=00005658 FLG=00012246\n"
+ "CS:EIP=0160:fff8ada3 CSACC=c09b CSLIM=ffffffff\n"
+ "SS:ESP=0030:000055d4 SSACC=1097 SSLIM=0000480f\n"
+ "DS=0158 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n"
+ "ES=0158 ESACC=c093 ESLIM=ffffffff CR2=fc8b0000\n"
+ "FS=03b8 FSACC=0093 FSLIM=00000023\n"
+ "GS=0000 GSACC=**** GSLIM=********\n"
+ "\n"
+ "The system detected an internal processing error\n"
+ "at location ##0160:fff5c364 - 000d:a364.\n"
+ "60000, 9084\n"
+ "\n"
+ "05860526\n"
+ "Internal revision 8200,94/11/07\n"
+ "\n"
+ "The system is stopped. Record all of the above information and\n"
+ "contact your service representative.\n",
+
+ /* warp 3 (late) */
+ "TRAP 000d ERRCD=2200 ERACC=1092 ERLIM=00010fff\n"
+ "EAX=0000802e EBX=fff001c8 ECX=9bd80000 EDX=00000000\n"
+ "ESI=fff09bd8 EDI=fdeb001b EBP=00000000 FLG=00012012\n"
+ "CS:EIP=0168:fff480a2 CSACC=c09b CSLIM=ffffffff\n"
+ "SS:ESP=00e8:00001f32 SSACC=0093 SSLIM=00001fff\n"
+ "DS=0940 DSACC=0093 DSLIM=00000397 CR0=8001001b\n"
+ "ES=00e8 ESACC=0093 ESLIM=00001fff CR2=15760008\n"
+ "FS=0000 FSACC=**** FSLIM=****\n"
+ "GS=0000 GSACC=**** GSLIM=****\n"
+ "\n"
+ "The system detected an internal processing error\n"
+ "at location ##0168:fff4b06e - 000e:c06e\n"
+ "60000, 9084\n"
+ "\n"
+ "06860652\n"
+ "Internal revision 8.259_uni,98/01/07\n"
+ "\n"
+ "The system is stopped. Record all of the above information and\n"
+ "contact your service representative.\n",
+
+ /* Warp 4.52+ - the official r0trap.exe from the debugging classes */
+ "Exception in module: OS2KRNL\n"
+ "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n"
+ "EAX=00000001 EBX=80010002 ECX=ffed4638 EDX=0003f17b\n"
+ "ESI=00000001 EDI=00000002 EBP=00005408 FLG=00012202\n"
+ "CS:EIP=0168:fff3cd2e CSACC=c09b CSLIM=ffffffff\n"
+ "SS:ESP=0030:000053ec SSACC=1097 SSLIM=000044ff\n"
+ "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n"
+ "ES=0160 ESACC=c093 ESLIM=ffffffff CR2=00000001\n"
+ "FS=0000 FSACC=**** FSLIM=********\n"
+ "GS=0000 GSACC=**** GSLIM=********\n"
+ "\n"
+ "The system detected an internal processing error at\n"
+ "location ##0168:fff1e3f3 - 000e:c3f3.\n"
+ "60000, 9084\n"
+ "\n"
+ "068606a0\n"
+ "Internal revision 14.097_UNI\n"
+ "\n"
+ "The system is stopped. Record all of the above information and\n"
+ "contact your service representative.\n",
+
+ /* Warp 4.52+, typical JFS problem. */
+ "Exeption in module: JFS\n"
+ "TRAP 0003 ERRCD=0000 ERACC=**** ERLIM=********\n"
+ "EAX=00000000 EBX=ffffff05 ECX=00000001 EDX=f5cd8010\n"
+ "ESI=000000e6 EDI=000000e7 EBP=f9c7378e FLG=00002296\n"
+ "CS:EIP=0168:f8df3250 CSACC=c09b CSLIM=ffffffff\n"
+ "SS:ESP=1550:fdc73778 SSACC=c093 SSLIM=ffffffff\n"
+ "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=80010016\n"
+ "ES=0160 ESACC=c093 DSLIM=ffffffff CR2=05318000\n"
+ "FS=03c0 FSACC=0093 DSLIM=00000023\n"
+ "GS=0160 GSACC=c093 DSLIM=ffffffff\n"
+ "\n"
+ "The system detected an internal processing error\n"
+ "at location ##0168:fff1e2ab - 000e:c2ab.\n"
+ "60000, 9084\n"
+ "\n"
+ "07860695\n"
+ "\n"
+ "Internal revision 14.100c_UNI\n"
+ "\n"
+ "The system is stopped. Record all of the above information and\n"
+ "contact your service representative.\n"
+ };
+
+ BSOD_TEXT (bst, LEFT, os2_panics[random() % countof(os2_panics)]);
+ BSOD_CURSOR (bst, CURSOR_LINE, 240000, 999999);
+
+ XClearWindow (dpy, window);
+ return bst;
+}
+
+
+/* SPARC Solaris panic. Should look pretty authentic on Solaris boxes.
+ * Anton Solovyev <solovam@earthlink.net>
+ */
+static struct bsod_state *
+sparc_solaris (Display *dpy, Window window)
+{
+ struct bsod_state *bst = make_bsod_state (dpy, window, "solaris", "Solaris");
+ int i;
+
+ bst->scroll_p = True;
+ bst->wrap_p = True;
+ bst->left_margin = bst->right_margin = bst->xgwa.width * 0.07;
+ bst->top_margin = bst->bottom_margin = bst->xgwa.height * 0.07;
+ bst->y = bst->top_margin + bst->font->ascent;
+
+ BSOD_IMG (bst);
+ BSOD_PAUSE (bst, 3000000);
+
+ BSOD_INVERT(bst);
+ BSOD_RECT (bst, True,
+ bst->left_margin, bst->top_margin,
+ bst->xgwa.width - bst->left_margin - bst->right_margin,
+ bst->xgwa.height - bst->top_margin - bst->bottom_margin);
+ BSOD_INVERT(bst);
+
+ BSOD_TEXT (bst, LEFT,
+ "BAD TRAP: cpu=0 type=0x31 rp=0x2a10043b5e0 addr=0xf3880 mmu_fsr=0x0\n"
+ "BAD TRAP occurred in module \"unix\" due to an illegal access to a"
+ " user address.\n"
+ "adb: trap type = 0x31\n"
+ "addr=0xf3880\n"
+ "pid=307, pc=0x100306e4, sp=0x2a10043ae81, tstate=0x4480001602,"
+ " context=0x87f\n"
+ "g1-g7: 1045b000, 32f, 10079440, 180, 300000ebde8, 0, 30000953a20\n"
+ "Begin traceback... sp = 2a10043ae81\n"
+ "Called from 100bd060, fp=2a10043af31, args=f3700 300008cc988 f3880 0"
+ " 1 300000ebde0.\n"
+ "Called from 101fe1bc, fp=2a10043b011, args=3000045a240 104465a0"
+ " 300008e47d0 300008e48fa 300008ae350 300008ae410\n"
+ "Called from 1007c520, fp=2a10043b0c1, args=300008e4878 300003596e8 0"
+ " 3000045a320 0 3000045a220\n"
+ "Called from 1007c498, fp=2a10043b171, args=1045a000 300007847f0 20"
+ " 3000045a240 1 0\n"
+ "Called from 1007972c, fp=2a10043b221, args=1 300009517c0 30000951e58 1"
+ " 300007847f0 0\n"
+ "Called from 10031e10, fp=2a10043b2d1, args=3000095b0c8 0 300009396a8"
+ " 30000953a20 0 1\n"
+ "Called from 10000bdd8, fp=ffffffff7ffff1c1, args=0 57 100131480"
+ " 100131480 10012a6e0 0\n"
+ "End traceback...\n"
+ "panic[cpu0]/thread=30000953a20: trap\n"
+ "syncing file systems...");
+
+ BSOD_PAUSE (bst, 3000000);
+
+ BSOD_TEXT (bst, LEFT, " 1 done\n");
+ BSOD_TEXT (bst, LEFT, "dumping to /dev/dsk/c0t0d0s3, offset 26935296\n");
+ BSOD_PAUSE (bst, 2000000);
+
+
+ for (i = 1; i <= 100; ++i)
+ {
+ char buf[100];
+ sprintf (buf, "\b\b\b\b\b\b\b\b\b\b\b%3d%% done", i);
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 100000);
+ }
+
+ BSOD_TEXT (bst, LEFT,
+ ": 2803 pages dumped, compression ratio 2.88, dump succeeded\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ BSOD_TEXT (bst, LEFT,
+ "rebooting...\n"
+ "Resetting ...");
+
+ return bst;
+}
+
+
+/* Linux panic and fsck, by jwz
+ */
+static struct bsod_state *
+linux_fsck (Display *dpy, Window window)
+{
+ struct bsod_state *bst = make_bsod_state (dpy, window, "linux", "Linux");
+
+ int i;
+ const char *sysname;
+ char buf[1024];
+
+ const char *linux_panic[] = {
+ " kernel: Unable to handle kernel paging request at virtual "
+ "address 0000f0ad\n",
+ " kernel: printing eip:\n",
+ " kernel: c01becd7\n",
+ " kernel: *pde = 00000000\n",
+ " kernel: Oops: 0000\n",
+ " kernel: CPU: 0\n",
+ " kernel: EIP: 0010:[<c01becd7>] Tainted: P \n",
+ " kernel: EFLAGS: 00010286\n",
+ " kernel: eax: 0000ff00 ebx: ca6b7e00 ecx: ce1d7a60 edx: ce1d7a60\n",
+ " kernel: esi: ca6b7ebc edi: 00030000 ebp: d3655ca0 esp: ca6b7e5c\n",
+ " kernel: ds: 0018 es: 0018 ss: 0018\n",
+ " kernel: Process crond (pid: 1189, stackpage=ca6b7000)\n",
+ " kernel: Stack: d3655ca0 ca6b7ebc 00030054 ca6b7e7c c01c1e5b "
+ "00000287 00000020 c01c1fbf \n",
+ "",
+ " kernel: 00005a36 000000dc 000001f4 00000000 00000000 "
+ "ce046d40 00000001 00000000 \n",
+ "", "", "",
+ " kernel: ffffffff d3655ca0 d3655b80 00030054 c01bef93 "
+ "d3655ca0 ca6b7ebc 00030054 \n",
+ "", "", "",
+ " kernel: Call Trace: [<c01c1e5b>] [<c01c1fbf>] [<c01bef93>] "
+ "[<c01bf02b>] [<c0134c4f>]\n",
+ "", "", "",
+ " kernel: [<c0142562>] [<c0114f8c>] [<c0134de3>] [<c010891b>]\n",
+ " kernel: \n",
+ " kernel: Code: 2a 00 75 08 8b 44 24 2c 85 c0 74 0c 8b 44 24 58 83 48 18 "
+ "08 \n",
+ 0
+ };
+
+ bst->scroll_p = True;
+ bst->wrap_p = True;
+ bst->left_margin = bst->right_margin = 10;
+ bst->top_margin = bst->bottom_margin = 10;
+
+ sysname = "linux";
+# ifdef HAVE_UNAME
+ {
+ struct utsname uts;
+ char *s;
+ if (uname (&uts) >= 0)
+ sysname = uts.nodename;
+ s = strchr (sysname, '.');
+ if (s) *s = 0;
+ }
+# endif /* !HAVE_UNAME */
+
+
+ BSOD_TEXT (bst, LEFT, "waiting for X server to shut down ");
+ BSOD_PAUSE (bst, 100000);
+ BSOD_TEXT (bst, LEFT,
+ "XIO: fatal IO error 2 (broken pipe) on X server \":0.0\"\n"
+ " after 339471 requests (339471 known processed) "
+ "with 0 events remaining\n");
+ BSOD_CHAR_DELAY (bst, 300000);
+ BSOD_TEXT (bst, LEFT, ".........\n");
+ BSOD_CHAR_DELAY (bst, 0);
+ BSOD_TEXT (bst, LEFT,
+ "xinit: X server slow to shut down, sending KILL signal.\n"
+ "waiting for server to die ");
+ BSOD_CHAR_DELAY (bst, 300000);
+ BSOD_TEXT (bst, LEFT, "...\n");
+ BSOD_CHAR_DELAY (bst, 0);
+ BSOD_TEXT (bst, LEFT, "xinit: Can't kill server\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ sprintf (buf, "\n%s Login: ", sysname);
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 1000000);
+ BSOD_TEXT (bst, LEFT,
+ "\n\n"
+ "Parallelizing fsck version 1.22 (22-Jun-2001)\n"
+ "e2fsck 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09\n"
+ "Warning! /dev/hda1 is mounted.\n"
+ "/dev/hda1 contains a file system with errors, check forced.\n");
+ BSOD_PAUSE (bst, 1000000);
+
+ if (0 == random() % 2)
+ BSOD_TEXT (bst, LEFT,
+ "Couldn't find ext2 superblock, trying backup blocks...\n"
+ "The filesystem size (according to the superblock) is 3644739 blocks\n"
+ "The physical size of the device is 3636706 blocks\n"
+ "Either the superblock or the partition table is likely to be corrupt!\n"
+ "Abort<y>? no\n");
+ BSOD_PAUSE (bst, 1000000);
+
+ AGAIN:
+
+ BSOD_TEXT (bst, LEFT, "Pass 1: Checking inodes, blocks, and sizes\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ i = (random() % 60) - 20;
+ while (--i > 0)
+ {
+ int b = random() % 0xFFFF;
+ sprintf (buf, "Deleted inode %d has zero dtime. Fix<y>? yes\n\n", b);
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 1000);
+ }
+
+ i = (random() % 40) - 10;
+ if (i > 0)
+ {
+ int g = random() % 0xFFFF;
+ int b = random() % 0xFFFFFFF;
+
+ BSOD_PAUSE (bst, 1000000);
+
+ sprintf (buf, "Warning: Group %d's copy of the group descriptors "
+ "has a bad block (%d).\n", g, b);
+ BSOD_TEXT (bst, LEFT, buf);
+
+ b = random() % 0x3FFFFF;
+ while (--i > 0)
+ {
+ b += random() % 0xFFFF;
+ sprintf (buf,
+ "Error reading block %d (Attempt to read block "
+ "from filesystem resulted in short read) while doing "
+ "inode scan. Ignore error<y>?",
+ b);
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 10000);
+ BSOD_TEXT (bst, LEFT, " yes\n\n");
+ }
+ }
+
+ if (0 == (random() % 10))
+ {
+ BSOD_PAUSE (bst, 1000000);
+
+ i = 3 + (random() % 10);
+ while (--i > 0)
+ {
+ BSOD_TEXT (bst, LEFT,
+ "Could not allocate 256 block(s) for inode table: "
+ "No space left on device\n");
+ BSOD_PAUSE (bst, 1000);
+ }
+ BSOD_TEXT (bst, LEFT, "Restarting e2fsck from the beginning...\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ goto AGAIN;
+ }
+
+ i = (random() % 20) - 5;
+
+ if (i > 0)
+ BSOD_PAUSE (bst, 1000000);
+
+ while (--i > 0)
+ {
+ int j = 5 + (random() % 10);
+ int w = random() % 4;
+
+ while (--j > 0)
+ {
+ int b = random() % 0xFFFFF;
+ int g = random() % 0xFFF;
+
+ if (0 == (random() % 10))
+ b = 0;
+ else if (0 == (random() % 10))
+ b = -1;
+
+ if (w == 0)
+ sprintf (buf,
+ "Inode table for group %d not in group. (block %d)\n"
+ "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
+ "Relocate<y>?",
+ g, b);
+ else if (w == 1)
+ sprintf (buf,
+ "Block bitmap for group %d not in group. (block %d)\n"
+ "Relocate<y>?",
+ g, b);
+ else if (w == 2)
+ sprintf (buf,
+ "Inode bitmap %d for group %d not in group.\n"
+ "Continue<y>?",
+ b, g);
+ else /* if (w == 3) */
+ sprintf (buf,
+ "Bad block %d in group %d's inode table.\n"
+ "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
+ "Relocate<y>?",
+ b, g);
+
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_TEXT (bst, LEFT, " yes\n\n");
+ BSOD_PAUSE (bst, 1000);
+ }
+ }
+
+
+ if (0 == random() % 10) goto PANIC;
+ BSOD_TEXT (bst, LEFT, "Pass 2: Checking directory structure\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ i = (random() % 20) - 5;
+ while (--i > 0)
+ {
+ int n = random() % 0xFFFFF;
+ int o = random() % 0xFFF;
+ sprintf (buf, "Directory inode %d, block 0, offset %d: "
+ "directory corrupted\n"
+ "Salvage<y>? ",
+ n, o);
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 1000);
+ BSOD_TEXT (bst, LEFT, " yes\n\n");
+
+ if (0 == (random() % 100))
+ {
+ sprintf (buf, "Missing '.' in directory inode %d.\nFix<y>?", n);
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 1000);
+ BSOD_TEXT (bst, LEFT, " yes\n\n");
+ }
+ }
+
+ if (0 == random() % 10)
+ goto PANIC;
+
+ BSOD_TEXT (bst, LEFT,
+ "Pass 3: Checking directory connectivity\n"
+ "/lost+found not found. Create? yes\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ /* Unconnected directory inode 4949 (/var/spool/squid/06/???)
+ Connect to /lost+found<y>? yes
+
+ '..' in /var/spool/squid/06/08 (20351) is <The NULL inode> (0), should be
+ /var/spool/squid/06 (20350).
+ Fix<y>? yes
+
+ Unconnected directory inode 128337 (/var/spool/squid/06/???)
+ Connect to /lost+found<y>? yes
+ */
+
+
+ if (0 == random() % 10) goto PANIC;
+ BSOD_TEXT (bst, LEFT, "Pass 4: Checking reference counts\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ /* Inode 2 ref count is 19, should be 20. Fix<y>? yes
+
+ Inode 4949 ref count is 3, should be 2. Fix<y>? yes
+
+ ...
+
+ Inode 128336 ref count is 3, should be 2. Fix<y>? yes
+
+ Inode 128337 ref count is 3, should be 2. Fix<y>? yes
+
+ */
+
+
+ if (0 == random() % 10) goto PANIC;
+ BSOD_TEXT (bst, LEFT, "Pass 5: Checking group summary information\n");
+ BSOD_PAUSE (bst, 2000000);
+
+ i = (random() % 200) - 50;
+ if (i > 0)
+ {
+ BSOD_TEXT (bst, LEFT, "Block bitmap differences: ");
+ while (--i > 0)
+ {
+ sprintf (buf, " %d", -(random() % 0xFFF));
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 1000);
+ }
+ BSOD_TEXT (bst, LEFT, "\nFix? yes\n\n");
+ }
+
+
+ i = (random() % 100) - 50;
+ if (i > 0)
+ {
+ BSOD_TEXT (bst, LEFT, "Inode bitmap differences: ");
+ while (--i > 0)
+ {
+ sprintf (buf, " %d", -(random() % 0xFFF));
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 1000);
+ }
+ BSOD_TEXT (bst, LEFT, "\nFix? yes\n\n");
+ }
+
+ i = (random() % 20) - 5;
+ while (--i > 0)
+ {
+ int g = random() % 0xFFFF;
+ int c = random() % 0xFFFF;
+ sprintf (buf,
+ "Free blocks count wrong for group #0 (%d, counted=%d).\nFix? ",
+ g, c);
+ BSOD_TEXT (bst, LEFT, buf);
+ BSOD_PAUSE (bst, 1000);
+ BSOD_TEXT (bst, LEFT, " yes\n\n");
+ }
+
+ PANIC:
+
+ i = 0;
+ BSOD_TEXT (bst, LEFT, "\n\n");
+ while (linux_panic[i])
+ {
+ time_t t = time ((time_t *) 0);
+ struct tm *tm = localtime (&t);
+ char prefix[100];
+
+ if (*linux_panic[i])
+ {
+ strftime (prefix, sizeof(prefix)-1, "%b %d %H:%M:%S ", tm);
+ BSOD_TEXT (bst, LEFT, prefix);
+ BSOD_TEXT (bst, LEFT, sysname);
+ BSOD_TEXT (bst, LEFT, linux_panic[i]);
+ BSOD_PAUSE (bst, 1000);
+ }
+ else
+ BSOD_PAUSE (bst, 300000);
+
+ i++;
+ }
+ BSOD_PAUSE (bst, 4000000);
+