summaryrefslogtreecommitdiff
path: root/rts/hooks
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2014-06-09 09:18:12 +0100
committerSimon Marlow <marlowsd@gmail.com>2015-04-07 09:57:49 +0100
commita7ab161602aa0b5833d22c66e64eebb1d9275235 (patch)
tree22db09216cbd2165359d8add08b5cf4cdbf5041f /rts/hooks
parent72092904e0ac1725c05c0447e1efe7ab541faa95 (diff)
downloadhaskell-a7ab161602aa0b5833d22c66e64eebb1d9275235.tar.gz
Replace hooks by callbacks in RtsConfig (#8785)
Summary: Hooks rely on static linking semantics, and are broken by -Bsymbolic which we need when using dynamic linking. Test Plan: Built it Reviewers: austin, hvr, tibbe Differential Revision: https://phabricator.haskell.org/D8
Diffstat (limited to 'rts/hooks')
-rw-r--r--rts/hooks/FlagDefaults.c5
-rw-r--r--rts/hooks/Hooks.h29
-rw-r--r--rts/hooks/MallocFail.c1
-rw-r--r--rts/hooks/OnExit.c1
-rw-r--r--rts/hooks/OutOfHeap.c1
-rw-r--r--rts/hooks/StackOverflow.c2
6 files changed, 36 insertions, 3 deletions
diff --git a/rts/hooks/FlagDefaults.c b/rts/hooks/FlagDefaults.c
index ce1666f06d..1307fa0239 100644
--- a/rts/hooks/FlagDefaults.c
+++ b/rts/hooks/FlagDefaults.c
@@ -6,10 +6,11 @@
#include "PosixSource.h"
#include "Rts.h"
+#include "Hooks.h"
void
-defaultsHook (void)
-{ /* this is called *after* RTSflags has had
+FlagDefaultsHook (void)
+{ /* this is called *after* RtsFlags has had
its defaults set, but *before* we start
processing the RTS command-line options.
diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h
new file mode 100644
index 0000000000..35a6011aaa
--- /dev/null
+++ b/rts/hooks/Hooks.h
@@ -0,0 +1,29 @@
+/* -----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 1998-2009
+ *
+ * User-overridable RTS hooks.
+ *
+ * Do not #include this file directly: #include "Rts.h" instead.
+ *
+ * To understand the structure of the RTS headers, see the wiki:
+ * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
+ *
+ * ---------------------------------------------------------------------------*/
+
+#ifndef RTS_HOOKS_H
+#define RTS_HOOKS_H
+
+#include "BeginPrivate.h"
+
+extern char *ghc_rts_opts;
+
+extern void OnExitHook (void);
+extern void StackOverflowHook (W_ stack_size);
+extern void OutOfHeapHook (W_ request_size, W_ heap_size);
+extern void MallocFailHook (W_ request_size /* in bytes */, char *msg);
+extern void FlagDefaultsHook (void);
+
+#include "EndPrivate.h"
+
+#endif /* RTS_HOOKS_H */
diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c
index 6c3a1a0faf..63343a770c 100644
--- a/rts/hooks/MallocFail.c
+++ b/rts/hooks/MallocFail.c
@@ -6,6 +6,7 @@
#include "PosixSource.h"
#include "Rts.h"
+#include "Hooks.h"
#include <stdio.h>
diff --git a/rts/hooks/OnExit.c b/rts/hooks/OnExit.c
index 30764acba2..e5e85f5dd3 100644
--- a/rts/hooks/OnExit.c
+++ b/rts/hooks/OnExit.c
@@ -6,6 +6,7 @@
#include "PosixSource.h"
#include "Rts.h"
+#include "Hooks.h"
/* Note: by the time this hook has been called, Haskell land
* will have been shut down completely.
diff --git a/rts/hooks/OutOfHeap.c b/rts/hooks/OutOfHeap.c
index ec4697b547..501bccddb7 100644
--- a/rts/hooks/OutOfHeap.c
+++ b/rts/hooks/OutOfHeap.c
@@ -6,6 +6,7 @@
#include "PosixSource.h"
#include "Rts.h"
+#include "Hooks.h"
#include <stdio.h>
void
diff --git a/rts/hooks/StackOverflow.c b/rts/hooks/StackOverflow.c
index 407293902d..1095b1b81d 100644
--- a/rts/hooks/StackOverflow.c
+++ b/rts/hooks/StackOverflow.c
@@ -6,6 +6,7 @@
#include "PosixSource.h"
#include "Rts.h"
+#include "Hooks.h"
#include <stdio.h>
@@ -14,4 +15,3 @@ StackOverflowHook (W_ stack_size) /* in bytes */
{
fprintf(stderr, "Stack space overflow: current size %" FMT_Word " bytes.\nUse `+RTS -Ksize -RTS' to increase it.\n", stack_size);
}
-