.I attr
to the value specified in
.IR guardsize .
-
+.PP
If
.I guardsize
is greater than 0,
.I guardsize
bytes at the end of the thread's stack to act as the guard area
for the stack (but see BUGS).
-
+.PP
If
.I guardsize
is 0, then new threads created with
.I attr
will not have a guard area.
-
+.PP
The default guard size is the same as the system page size.
-
+.PP
If the stack address attribute has been set in
.I attr
(using
.BR mprotect (2)
to manually define a guard area at the end of the stack
that it has allocated).
-
+.PP
The
.BR pthread_attr_getguardsize ()
function returns the guard size attribute of the
.BR pthread_attr_getguardsize ()
returns the guard size that was set by
.BR pthread_attr_setguardsize ().)
-
+.PP
Setting a guard size of 0 may be useful to save memory
in an application that creates many threads
and knows that stack overflow can never occur.
-
+.PP
Choosing a guard size larger than the default size
may be necessary for detecting stack overflows
if a thread allocates large data structures on the stack.
.BR pthread_create (3)
if the guard size value is too large,
leaving no space for the actual stack.)
-
+.PP
The obsolete LinuxThreads implementation did the right thing,
allocating extra space at the end of the stack for the guard area.
.\" glibc includes the guardsize within the allocated stack size,