summaryrefslogtreecommitdiffstats
path: root/tools/checkstack.c
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2002-08-01 13:51:34 +0000
committerDamien Doligez <damien.doligez-inria.fr>2002-08-01 13:51:34 +0000
commit9ff16b672c8037c3a0e718334829dc31bcb7c441 (patch)
tree3e2b71ca0ff87c8c0ba4853f4854cac04bc9d170 /tools/checkstack.c
parentfe2626f7a5f3f54057e9a47c4cb6a4135b9de41b (diff)
verifier la taille de pile avant de compiler opt.opt
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5061 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools/checkstack.c')
-rw-r--r--tools/checkstack.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/checkstack.c b/tools/checkstack.c
new file mode 100644
index 000000000..23f0a922e
--- /dev/null
+++ b/tools/checkstack.c
@@ -0,0 +1,41 @@
+/***********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Damien Doligez, projet Moscova, INRIA Rocquencourt */
+/* */
+/* Copyright 2002 Institut National de Recherche en Informatique et */
+/* en Automatique. All rights reserved. This file is distributed */
+/* under the terms of the GNU Library General Public License, with */
+/* the special exception on linking described in file ../../LICENSE. */
+/* */
+/***********************************************************************/
+
+/* $Id$ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#define MINSTACKBYTES (512 * 1024 * sizeof (long))
+
+int main(int argc, char ** argv)
+{
+ struct rlimit limit;
+ int rc;
+
+ rc = getrlimit (RLIMIT_STACK, &limit);
+ if (rc != 0) exit (0);
+ if (limit.rlim_cur < MINSTACKBYTES){
+ fprintf (stderr,
+ "\nThe current stack size limit is too low (%luk)\n"
+ "You must increase it with one of the following commands:\n"
+ "Under sh, bash, zsh: ulimit -s %lu\n"
+ "Under csh, tcsh: limit stacksize %lu\n\n",
+ (unsigned long) (limit.rlim_cur / 1024),
+ MINSTACKBYTES / 1024, MINSTACKBYTES / 1024);
+ exit (3);
+ }
+ exit (0);
+}