2 dnl # Check if the glibc NPTL threading implementation includes the guard area
3 dnl # within the stack size allocation, rather than allocating extra space at
4 dnl # the end of the stack, as POSIX.1 requires.
6 AC_DEFUN([ZFS_AC_CONFIG_USER_STACK_GUARD], [
8 AC_MSG_CHECKING([whether pthread stack includes guard])
10 saved_CFLAGS="$CFLAGS"
11 CFLAGS="-fstack-check"
12 saved_LDFLAGS="$LDFLAGS"
15 AC_RUN_IFELSE([AC_LANG_PROGRAM(
18 #include <sys/resource.h>
20 #include <bits/local_lim.h>
22 #define PAGESIZE (sysconf(_SC_PAGESIZE))
23 #define STACK_SIZE 8192
26 void * func(void *arg)
38 setrlimit(RLIMIT_CORE, &l);
39 pthread_attr_init(&attr);
40 pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN + STACK_SIZE);
41 pthread_attr_setguardsize(&attr, PAGESIZE);
42 pthread_create(&tid, &attr, func, NULL);
43 pthread_join(tid, NULL);
49 AC_DEFINE([NPTL_GUARD_WITHIN_STACK], 1,
50 [Define to 1 if NPTL threading implementation includes
51 guard area in stack allocation])
54 CFLAGS="$saved_CFLAGS"
55 LDFLAGS="$saved_LDFLAGS"