summaryrefslogtreecommitdiffstats
path: root/lib/libkse/thread/thr_attr_setguardsize.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-05-13 07:58:15 +0000
committeralfred <alfred@FreeBSD.org>2002-05-13 07:58:15 +0000
commit135bb8bda20243a1d25ec3f1957340e0ad3adb78 (patch)
tree560dda98ad29714a8b86e7627eb2c047ba236df3 /lib/libkse/thread/thr_attr_setguardsize.c
parent796d01e2a84d0cd774be8511d13ebf2076c43f66 (diff)
downloadFreeBSD-src-135bb8bda20243a1d25ec3f1957340e0ad3adb78.zip
FreeBSD-src-135bb8bda20243a1d25ec3f1957340e0ad3adb78.tar.gz
Don't use PAGE_SIZE in userland, instead use getpagesize(), this is to
allow running on other arches when the instructions are supported but the page size granularity is not. Glanced at by: peter
Diffstat (limited to 'lib/libkse/thread/thr_attr_setguardsize.c')
-rw-r--r--lib/libkse/thread/thr_attr_setguardsize.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libkse/thread/thr_attr_setguardsize.c b/lib/libkse/thread/thr_attr_setguardsize.c
index 0c3de14..8dc7938 100644
--- a/lib/libkse/thread/thr_attr_setguardsize.c
+++ b/lib/libkse/thread/thr_attr_setguardsize.c
@@ -45,9 +45,13 @@ _pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
if (attr == NULL || *attr == NULL)
ret = EINVAL;
else {
- /* Round guardsize up to the nearest multiple of PAGE_SIZE. */
- if (guardsize % PAGE_SIZE != 0)
- guardsize = ((guardsize / PAGE_SIZE) + 1) * PAGE_SIZE;
+ /*
+ * Round guardsize up to the nearest multiple of
+ * pthread_page_size.
+ */
+ if (guardsize % pthread_page_size != 0)
+ guardsize = ((guardsize / pthread_page_size) + 1) *
+ pthread_page_size;
/* Save the stack size. */
(*attr)->guardsize_attr = guardsize;
OpenPOWER on IntegriCloud