4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: FreeBSD 4.x: When compiled with the pthread library (Python) a
12 complicated pattern may cause Vim to crash. Catching the signal
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,
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
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
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
36 cat > conftest.$ac_ext <<EOF
37 ! #line 5579 "configure"
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
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
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
59 cat > conftest.$ac_ext <<EOF
60 ! #line 5660 "configure"
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
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
77 + #undef HAVE_PTHREAD_NP_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
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)
91 dnl On Mac OS X strings.h exists but produces a warning message :-(
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)
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
105 #if defined(HAVE_GETRLIMIT) || defined(PROTO)
106 static char *stack_limit = NULL;
108 + #if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H)
109 + # include <pthread.h>
110 + # include <pthread_np.h>
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
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"). */
131 if (stack_grows_downwards)
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);
140 ! stack_limit = (char *)((long)&i + ((long)rlp.rlim_cur / 16L * 15L));
141 if (stack_limit <= (char *)&i)
142 stack_limit = NULL; /* overflow */
148 + lim = (long)rlp.rlim_cur;
149 + #if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H)
151 + pthread_attr_t attr;
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)
159 + pthread_attr_getstacksize(&attr, &size);
160 + if (lim > (long)size)
163 + pthread_attr_destroy(&attr);
166 if (stack_grows_downwards)
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);
175 ! stack_limit = (char *)((long)&i + (lim / 16L * 15L));
176 if (stack_limit <= (char *)&i)
177 stack_limit = NULL; /* overflow */
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
184 { /* Add new patch number below this line */
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"
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 ///