aboutsummaryrefslogtreecommitdiffstats
path: root/man3
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2008-11-05 09:43:20 -0500
committerMichael Kerrisk <mtk.manpages@gmail.com>2008-11-06 16:49:05 -0500
commitc2befb6a938e979a964a141a55cea2b5f80e802e (patch)
tree6d61bbaa32934eeac41a012def19a46f6d2dad86 /man3
parent061f742a28799eef8e7fe204fe3f7b0541b7f6c9 (diff)
downloadman-pages-c2befb6a938e979a964a141a55cea2b5f80e802e.tar.gz
pthread_attr_setstacksize.3: EINVAL occurs on some systems if stacksize != page-size
On MacOS X at least, pthread_attr_setstacksize(3) can fail with EINVAL if 'stacksize' is not a multiple of the system page size. Best to mention this so as to aid people writing portable programs. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com> Reported-by: Karsten Weiss <knweiss@gmail.com> == From: Karsten Weiss <knweiss@gmail.com> Date: Fri, Oct 31, 2008 at 3:46 PM Subject: pthread_create(3) - example bug + problems [...] A look in the pthread_set_stacksize man page on Mac revealed that on Mac the stack size must not only be at least PTHREAD_STACK_MIN... [...] ...but the new stack size must also be a multiple of the system page size! From pthread_attr_setstacksize(3): pthread_attr_setstacksize() will fail if: [EINVAL] Invalid value for attr. [EINVAL] stacksize is less than PTHREAD_STACK_MIN. !!! [EINVAL] stacksize is not a multiple of the system page size. See for yourself (PTHREAD_STACK_MIN==8192 on Mac OS X): $ ./pthread_test -s $((8192*10-1)) a pthread_attr_setstacksize: Invalid argument $ ./pthread_test -s $((8192*10)) a Thread 1: top of stack near 0xb0014f6c; argv_string=a Joined with thread 1; returned value was A $ ./pthread_test -s $((8192*10+1)) a pthread_attr_setstacksize: Invalid argument
Diffstat (limited to 'man3')
-rw-r--r--man3/pthread_attr_setstacksize.311
1 files changed, 10 insertions, 1 deletions
diff --git a/man3/pthread_attr_setstacksize.3 b/man3/pthread_attr_setstacksize.3
index 8767c485fe..86ca677716 100644
--- a/man3/pthread_attr_setstacksize.3
+++ b/man3/pthread_attr_setstacksize.3
@@ -21,7 +21,7 @@
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
-.TH PTHREAD_ATTR_SETSTACKSIZE 3 2008-10-24 "Linux" "Linux Programmer's Manual"
+.TH PTHREAD_ATTR_SETSTACKSIZE 3 2008-11-05 "Linux" "Linux Programmer's Manual"
.SH NAME
pthread_attr_setstacksize, pthread_attr_getstacksize \- set/get stack size
attribute in thread attributes object
@@ -66,6 +66,15 @@ can fail with the following error:
The stack size is less than
.BR PTHREAD_STACK_MIN
(16384) bytes.
+.PP
+On some systems,
+.\" e.g., MacOS
+.BR pthread_attr_setstacksize ()
+can fail with the error
+.B EINVAL
+if
+.I stacksize
+is not a multiple of the system page size.
.SH VERSIONS
These functions are provided by glibc since version 2.1.
.SH CONFORMING TO