Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: libiberty/stack-limit.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « libiberty/pex-unix.c ('k') | libiberty/testsuite/demangle-expected » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Increase stack size limit if possible. 1 /* Increase stack size limit if possible.
2 Copyright (C) 2011 Free Software Foundation, Inc. 2 Copyright (C) 2011 Free Software Foundation, Inc.
3 3
4 This file is part of the libiberty library. This library is free 4 This file is part of the libiberty library. This library is free
5 software; you can redistribute it and/or modify it under the 5 software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the 6 terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) 7 Free Software Foundation; either version 2, or (at your option)
8 any later version. 8 any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
(...skipping 16 matching lines...) Expand all
27 27
28 @deftypefn Extension void stack_limit_increase (unsigned long @var{pref}) 28 @deftypefn Extension void stack_limit_increase (unsigned long @var{pref})
29 29
30 Attempt to increase stack size limit to @var{pref} bytes if possible. 30 Attempt to increase stack size limit to @var{pref} bytes if possible.
31 31
32 @end deftypefn 32 @end deftypefn
33 33
34 */ 34 */
35 35
36 #include "config.h" 36 #include "config.h"
37 #include "ansidecl.h"
37 38
38 #ifdef HAVE_STDINT_H 39 #ifdef HAVE_STDINT_H
39 #include <stdint.h> 40 #include <stdint.h>
40 #endif 41 #endif
41 #ifdef HAVE_SYS_RESOURCE_H 42 #ifdef HAVE_SYS_RESOURCE_H
42 #include <sys/resource.h> 43 #include <sys/resource.h>
43 #endif 44 #endif
44 45
45 void 46 void
46 stack_limit_increase (unsigned long pref) 47 stack_limit_increase (unsigned long pref ATTRIBUTE_UNUSED)
47 { 48 {
48 #if defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT) \ 49 #if defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT) \
49 && defined(RLIMIT_STACK) && defined(RLIM_INFINITY) 50 && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
50 struct rlimit rlim; 51 struct rlimit rlim;
51 if (getrlimit (RLIMIT_STACK, &rlim) == 0 52 if (getrlimit (RLIMIT_STACK, &rlim) == 0
52 && rlim.rlim_cur != RLIM_INFINITY 53 && rlim.rlim_cur != RLIM_INFINITY
53 && rlim.rlim_cur < pref 54 && rlim.rlim_cur < pref
54 && (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max)) 55 && (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max))
55 { 56 {
56 rlim.rlim_cur = pref; 57 rlim.rlim_cur = pref;
57 if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_cur > rlim.rlim_max) 58 if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_cur > rlim.rlim_max)
58 rlim.rlim_cur = rlim.rlim_max; 59 rlim.rlim_cur = rlim.rlim_max;
59 setrlimit (RLIMIT_STACK, &rlim); 60 setrlimit (RLIMIT_STACK, &rlim);
60 } 61 }
61 #endif 62 #endif
62 } 63 }
OLDNEW
« no previous file with comments | « libiberty/pex-unix.c ('k') | libiberty/testsuite/demangle-expected » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698