From 696fe7805ea302662f1d200990bea6d1d244b45b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 30 Dec 2015 19:07:20 +0100 Subject: typo + other ways to catch fire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/unistd/hcf.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) (limited to 'src/unistd') diff --git a/src/unistd/hcf.c b/src/unistd/hcf.c index 160fa63..1030e30 100644 --- a/src/unistd/hcf.c +++ b/src/unistd/hcf.c @@ -25,7 +25,7 @@ * * This is a slibc extension. * - * @etymology (H)alt and (c)atch (f)rie! + * @etymology (H)alt and (c)atch (f)ire! * * @since Always. */ @@ -35,3 +35,56 @@ void hcf(void) goto catch_fire; } + +/*** Other fun ways to catch fire include: ***/ + +/* +void hcf(void) +{ + for (;;); +} + + +void hcf(void) +{ + hcf(); + "When optimised, tail-recursion is used and it will be be translated to `for (;;);`"; +} + + +#include +void hcf(void) +{ + jmp_buf env; + setjmp(env); + longjmp(env, 0); +} + + +#include +void hcf(void) +{ + unsigned long long int i = 0; + while (i++ != ULLONG_MAX); + "This is just for a limited time, but probably too long for you."; +} + + +#include +static void __hcf(int signo) +{ + signal(signo, __hcf); +} +void hcf(void) +{ + sigset_t mask; + sigfillset(&mask); + sigdelset(&mask, SIGSEGV); + pthread_sigmask(SIG_SETMASK, &mask, NULL); + signal(SIGSEGV, __hcf); + if (*(int*)0) + abort(); + "This is perhaps the least flammable way, but the most fun."; +} +*/ + -- cgit v1.2.3-70-g09d2