]>
Commit | Line | Data |
---|---|---|
2bb96920 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.496 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.496 | |
11 | Problem: FreeBSD 4.x: When compiled with the pthread library (Python) a | |
12 | complicated pattern may cause Vim to crash. Catching the signal | |
13 | doesn't work. | |
14 | Solution: When compiled with threads, instead of using the normal stacksize | |
15 | limit, use the size of the initial stack. | |
16 | Files: src/auto/configure, src/config.h.in, src/configure.in, | |
17 | src/os_unix.c | |
18 | ||
19 | ||
20 | *** ../vim-6.2.495/src/auto/configure Wed Apr 14 22:12:42 2004 | |
21 | --- src/auto/configure Sun Apr 25 13:22:47 2004 | |
22 | *************** | |
23 | *** 5642,5663 **** | |
24 | sys/resource.h sys/systeminfo.h locale.h \ | |
25 | sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \ | |
26 | poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \ | |
27 | ! libgen.h util/debug.h util/msg18n.h frame.h \ | |
28 | sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h | |
29 | do | |
30 | ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` | |
31 | echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 | |
32 | ! echo "configure:5574: checking for $ac_hdr" >&5 | |
33 | if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then | |
34 | echo $ac_n "(cached) $ac_c" 1>&6 | |
35 | else | |
36 | cat > conftest.$ac_ext <<EOF | |
37 | ! #line 5579 "configure" | |
38 | #include "confdefs.h" | |
39 | #include <$ac_hdr> | |
40 | EOF | |
41 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
42 | ! { (eval echo configure:5584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
43 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
44 | if test -z "$ac_err"; then | |
45 | rm -rf conftest* | |
46 | --- 5646,5667 ---- | |
47 | sys/resource.h sys/systeminfo.h locale.h \ | |
48 | sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \ | |
49 | poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \ | |
50 | ! libgen.h util/debug.h util/msg18n.h frame.h pthread_np.h \ | |
51 | sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h | |
52 | do | |
53 | ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` | |
54 | echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 | |
55 | ! echo "configure:5655: checking for $ac_hdr" >&5 | |
56 | if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then | |
57 | echo $ac_n "(cached) $ac_c" 1>&6 | |
58 | else | |
59 | cat > conftest.$ac_ext <<EOF | |
60 | ! #line 5660 "configure" | |
61 | #include "confdefs.h" | |
62 | #include <$ac_hdr> | |
63 | EOF | |
64 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
65 | ! { (eval echo configure:5665: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
66 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
67 | if test -z "$ac_err"; then | |
68 | rm -rf conftest* | |
69 | *** ../vim-6.2.495/src/config.h.in Fri Mar 26 14:25:07 2004 | |
70 | --- src/config.h.in Sun Apr 25 13:23:10 2004 | |
71 | *************** | |
72 | *** 200,205 **** | |
73 | --- 200,206 ---- | |
74 | #undef HAVE_LOCALE_H | |
75 | #undef HAVE_NDIR_H | |
76 | #undef HAVE_POLL_H | |
77 | + #undef HAVE_PTHREAD_NP_H | |
78 | #undef HAVE_PWD_H | |
79 | #undef HAVE_SETJMP_H | |
80 | #undef HAVE_SGTTY_H | |
81 | *** ../vim-6.2.495/src/configure.in Wed Apr 14 22:12:42 2004 | |
82 | --- src/configure.in Sun Apr 25 13:22:43 2004 | |
83 | *************** | |
84 | *** 1835,1841 **** | |
85 | sys/resource.h sys/systeminfo.h locale.h \ | |
86 | sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \ | |
87 | poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \ | |
88 | ! libgen.h util/debug.h util/msg18n.h frame.h \ | |
89 | sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h) | |
90 | ||
91 | dnl On Mac OS X strings.h exists but produces a warning message :-( | |
92 | --- 1835,1841 ---- | |
93 | sys/resource.h sys/systeminfo.h locale.h \ | |
94 | sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \ | |
95 | poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \ | |
96 | ! libgen.h util/debug.h util/msg18n.h frame.h pthread_np.h \ | |
97 | sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h) | |
98 | ||
99 | dnl On Mac OS X strings.h exists but produces a warning message :-( | |
100 | *** ../vim-6.2.495/src/os_unix.c Wed Apr 14 11:08:53 2004 | |
101 | --- src/os_unix.c Sun Apr 25 13:27:36 2004 | |
102 | *************** | |
103 | *** 610,615 **** | |
104 | --- 610,620 ---- | |
105 | #if defined(HAVE_GETRLIMIT) || defined(PROTO) | |
106 | static char *stack_limit = NULL; | |
107 | ||
108 | + #if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H) | |
109 | + # include <pthread.h> | |
110 | + # include <pthread_np.h> | |
111 | + #endif | |
112 | + | |
113 | /* | |
114 | * Find out until how var the stack can grow without getting into trouble. | |
115 | * Called when starting up and when switching to the signal stack in | |
116 | *************** | |
117 | *** 620,625 **** | |
118 | --- 625,631 ---- | |
119 | { | |
120 | struct rlimit rlp; | |
121 | int i; | |
122 | + long lim; | |
123 | ||
124 | /* Set the stack limit to 15/16 of the allowable size. Skip this when the | |
125 | * limit doesn't fit in a long (rlim_cur might be "long long"). */ | |
126 | *************** | |
127 | *** 630,645 **** | |
128 | # endif | |
129 | ) | |
130 | { | |
131 | if (stack_grows_downwards) | |
132 | { | |
133 | ! stack_limit = (char *)((long)&i - ((long)rlp.rlim_cur / 16L * 15L)); | |
134 | if (stack_limit >= (char *)&i) | |
135 | /* overflow, set to 1/16 of current stack position */ | |
136 | stack_limit = (char *)((long)&i / 16L); | |
137 | } | |
138 | else | |
139 | { | |
140 | ! stack_limit = (char *)((long)&i + ((long)rlp.rlim_cur / 16L * 15L)); | |
141 | if (stack_limit <= (char *)&i) | |
142 | stack_limit = NULL; /* overflow */ | |
143 | } | |
144 | --- 636,669 ---- | |
145 | # endif | |
146 | ) | |
147 | { | |
148 | + lim = (long)rlp.rlim_cur; | |
149 | + #if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H) | |
150 | + { | |
151 | + pthread_attr_t attr; | |
152 | + size_t size; | |
153 | + | |
154 | + /* On FreeBSD the initial thread always has a fixed stack size, no | |
155 | + * matter what the limits are set to. Normally it's 1 Mbyte. */ | |
156 | + pthread_attr_init(&attr); | |
157 | + if (pthread_attr_get_np(pthread_self(), &attr) == 0) | |
158 | + { | |
159 | + pthread_attr_getstacksize(&attr, &size); | |
160 | + if (lim > (long)size) | |
161 | + lim = (long)size; | |
162 | + } | |
163 | + pthread_attr_destroy(&attr); | |
164 | + } | |
165 | + #endif | |
166 | if (stack_grows_downwards) | |
167 | { | |
168 | ! stack_limit = (char *)((long)&i - (lim / 16L * 15L)); | |
169 | if (stack_limit >= (char *)&i) | |
170 | /* overflow, set to 1/16 of current stack position */ | |
171 | stack_limit = (char *)((long)&i / 16L); | |
172 | } | |
173 | else | |
174 | { | |
175 | ! stack_limit = (char *)((long)&i + (lim / 16L * 15L)); | |
176 | if (stack_limit <= (char *)&i) | |
177 | stack_limit = NULL; /* overflow */ | |
178 | } | |
179 | *** ../vim-6.2.495/src/version.c Sun Apr 25 13:07:13 2004 | |
180 | --- src/version.c Sun Apr 25 13:38:12 2004 | |
181 | *************** | |
182 | *** 639,640 **** | |
183 | --- 639,642 ---- | |
184 | { /* Add new patch number below this line */ | |
185 | + /**/ | |
186 | + 496, | |
187 | /**/ | |
188 | ||
189 | -- | |
190 | Anyone who is capable of getting themselves made President should on no | |
191 | account be allowed to do the job. | |
192 | -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" | |
193 | ||
194 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
195 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
196 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
197 | \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html /// |