]> git.proxmox.com Git - mirror_zfs-debian.git/blame - config/user-nptl_guard_within_stack.m4
Update SAs when an inode is dirtied
[mirror_zfs-debian.git] / config / user-nptl_guard_within_stack.m4
CommitLineData
c9c0d073
BB
1dnl #
2dnl # Check if the glibc NPTL threading implementation includes the guard area
3dnl # within the stack size allocation, rather than allocating extra space at
4dnl # the end of the stack, as POSIX.1 requires.
5dnl #
6AC_DEFUN([ZFS_AC_CONFIG_USER_STACK_GUARD], [
7
8 AC_MSG_CHECKING([whether pthread stack includes guard])
9
10 saved_CFLAGS="$CFLAGS"
11 CFLAGS="-fstack-check"
12 saved_LDFLAGS="$LDFLAGS"
13 LDFLAGS="-lpthread"
14
e89236fd 15 AC_RUN_IFELSE([AC_LANG_PROGRAM(
c9c0d073
BB
16 [
17 #include <pthread.h>
18 #include <sys/resource.h>
19 #include <unistd.h>
20 #include <bits/local_lim.h>
21
22 #define PAGESIZE (sysconf(_SC_PAGESIZE))
23 #define STACK_SIZE 8192
24 #define BUFSIZE 4096
25
26 void * func(void *arg)
27 {
e89236fd 28 char buf[[BUFSIZE]];
c9c0d073
BB
29 }
30 ],
31 [
32 pthread_t tid;
33 pthread_attr_t attr;
34 struct rlimit l;
35
36 l.rlim_cur = 0;
37 l.rlim_max = 0;
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);
e89236fd 44 ])],
c9c0d073
BB
45 [
46 AC_MSG_RESULT([no])
47 ],
48 [
49 AC_DEFINE([NPTL_GUARD_WITHIN_STACK], 1,
50 [Define to 1 if NPTL threading implementation includes
51 guard area in stack allocation])
52 AC_MSG_RESULT([yes])
53 ])
54 CFLAGS="$saved_CFLAGS"
55 LDFLAGS="$saved_LDFLAGS"
56])