summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-09-01 20:47:10 +0000
committerRichard M. Stallman <rms@gnu.org>1996-09-01 20:47:10 +0000
commit53c58b5d489f21fdeb5f3d011e34638f8124fb91 (patch)
tree336ec5895d85833b5c7046e28a0c317c2893bcd9 /src/emacs.c
parent149d4fe55c72f75c66257514ea3e0707592b479b (diff)
downloademacs-53c58b5d489f21fdeb5f3d011e34638f8124fb91.tar.gz
[HAVE_SETRLIMIT]: Include time.h and resource.h.
(main) [HAVE_SETRLIMIT]: Call setrlimit to extend the stack limit. New local `rlim'.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 2934750130f..57e581d142d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -45,6 +45,11 @@ Boston, MA 02111-1307, USA. */
#include "syssignal.h"
#include "process.h"
+#ifdef HAVE_SETRLIMIT
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
+
#ifndef O_RDWR
#define O_RDWR 2
#endif
@@ -429,6 +434,9 @@ main (argc, argv, envp)
int skip_args = 0;
extern int errno;
extern sys_nerr;
+#ifdef HAVE_SETRLIMIT
+ struct rlimit rlim;
+#endif
#ifdef LINUX_SBRK_BUG
__sbrk (1);
@@ -501,6 +509,15 @@ main (argc, argv, envp)
#endif /* LINK_CRTL_SHARE */
#endif /* VMS */
+#ifdef HAVE_SETRLIMIT
+ /* Extend the stack space available. */
+ if (!getrlimit (RLIMIT_STACK, &rlim))
+ {
+ rlim.rlim_cur = rlim.rlim_max;
+ setrlimit (RLIMIT_STACK, &rlim);
+ }
+#endif
+
/* Record (approximately) where the stack begins. */
stack_bottom = &stack_bottom_variable;