summaryrefslogtreecommitdiff
path: root/sys/src/libc/port/exits.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-10-20 20:58:38 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2017-10-20 20:58:38 +0200
commite3d8fe9d4a1085cbf7237411bcd1996613334994 (patch)
tree0e04341f5ab79efed8865810d3fb4954b1a026e3 /sys/src/libc/port/exits.c
parent67d9c6b2f98888dc81154b0499bbd26171f908a6 (diff)
libc: cleanup atexit and put exits() in its own compilation unit
this avoids having to pull in atexit() and its dependencies (lock(), unlock()) into every program. (as exits() is called by _main() from main9.s).
Diffstat (limited to 'sys/src/libc/port/exits.c')
-rw-r--r--sys/src/libc/port/exits.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/src/libc/port/exits.c b/sys/src/libc/port/exits.c
new file mode 100644
index 000000000..f4d76a6c6
--- /dev/null
+++ b/sys/src/libc/port/exits.c
@@ -0,0 +1,13 @@
+#include <u.h>
+#include <libc.h>
+
+void (*_onexit)(void);
+
+#pragma profile off
+
+void
+exits(char *s)
+{
+ if(_onexit != nil) (*_onexit)();
+ _exits(s);
+}