summaryrefslogtreecommitdiff
path: root/libc-parts/_exit.c
diff options
context:
space:
mode:
authorneal <neal>2008-01-24 12:45:03 +0000
committerneal <neal>2008-01-24 12:45:03 +0000
commit102c941601c8d9a190f4697be23365c3b3166ee7 (patch)
tree79b19c0fd51c59bbcba6217794112da91c6e836d /libc-parts/_exit.c
parentdaf9af1f4dc690cdddc7db6d7093d775a861f18f (diff)
libc-parts/
2008-01-24 Neal H. Walfield <neal@gnu.org> * Makefile.am (ARCH_SOURCES): Rename from this... (ARCH_COMMON_SOURCES): ... to this. (ARCH_USER_SOURCES): New variable. (ARCH_KERNEL_SOURCES): Likewise. (noinst_LIBRARIES): Add libc-kernel.a. (common_sources): New variable. (libc_parts_a_SOURCES): Move most files to common_sources. Add $(ARCH_COMMON_SOURCES), $(ARCH_USER_SOURCES) (libc_parts_a_CPPFLAGS): Add -I$(LIBC)/include. (libc_kernel_a_SOURCES): New variable. (libc_kernel_a_CPPFLAGS): Likewise. (libc_kernel_a_LIBADD): Likewise. * s_printf.c: Move from ../ruth/output.c. (s_putchar) [RM_INTERN || _L4_TEST_ENVIRONMENT]: Add appropriate implementation. * _exit.c: New file. * getpagesize.c: Likewise. * ia32-cmain.c: Copied from ../ruth/ia32-cmain.c. Removed dead code. Don't include "ruth.h". Add prototype for main. (program_name): New variable. (finish): Setup program_name based on ARGV[0]. * ia32-crt0.S: Copied from ../ruth/ia32-crt0.c. * panic.c: Copied from ../ruth/panic.c. (panic_): Call _exit. * startup.c: New file. ruth/ 2008-01-24 Neal H. Walfield <neal@gnu.org> * Makefile.am (ARCH_SOURCES): Remove variable. (ruth_SOURCES): Set to ruth.c. (COMMON_CPPFLAGS): Remove -I$(top_builddir)/newlib/include, add -I$@LIBC@/include. * output.c: Move to ../libc-parts/s_printf.c. * output.h: Remove file. * panic.c: Move to ../libc-parts/panic.c. * ruth.h: Remove file. * malloc.c: Likewise. * malloc-wrap.c: Likewise. * ia32-cmain.c: Move to ../libc-parts/ia32-cmain.c. * ia32-crt0.S: Move to ../libc-parts/ia32-crt0.c. * ruth.c: Include <stdio.h>. Don't include "ruth.h". (output_debug): Declare, don't define. (exit): Remove function. (abort): Likewise. (getpagesize): Likewise. laden/ 2008-01-24 Neal H. Walfield <neal@gnu.org> * Makefile.am (laden_LDADD): Set to ../libc-parts/libc-kernel.a, not ../libc-parts/libc-parts.a. viengoos/ 2008-01-24 Neal H. Walfield <neal@gnu.org> * Makefile.am (viengoos_LDADD): Link with ../libc-parts/libc-kernel.a, not ../libc-parts/libc-parts.a
Diffstat (limited to 'libc-parts/_exit.c')
-rw-r--r--libc-parts/_exit.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/libc-parts/_exit.c b/libc-parts/_exit.c
new file mode 100644
index 0000000..74250fc
--- /dev/null
+++ b/libc-parts/_exit.c
@@ -0,0 +1,60 @@
+/* _exit.c - Exit implementation.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Written by Neal H. Walfield <neal@gnu.org>.
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ The GNU Hurd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
+
+#include <hurd/stddef.h>
+#include <hurd/startup.h>
+#include <hurd/folio.h>
+
+int __global_zero;
+
+void
+_exit (int ret)
+{
+#if defined (RM_INTERN)
+# if defined (__i386__)
+ /* Try to invoke the debugger. */
+ asm ("int $3");
+# endif
+#else
+ extern struct hurd_startup_data *__hurd_startup_data;
+
+ addr_t folio = addr_chop (__hurd_startup_data->activity,
+ FOLIO_OBJECTS_LOG2);
+ int index = addr_extract (__hurd_startup_data->activity,
+ FOLIO_OBJECTS_LOG2);
+
+ error_t err;
+ err = rm_folio_object_alloc (ADDR_VOID, folio, index,
+ cap_void, OBJECT_POLICY_VOID,
+ (uintptr_t) ret,
+ ADDR_VOID, ADDR_VOID);
+
+ assert_perror (err);
+#endif
+
+ debug (0, "Failed to die gracefully; doing the ultra-violent.");
+
+ volatile int j = ret / __global_zero;
+ for (;;)
+ {
+ j --;
+ l4_yield ();
+ }
+}