.I attr
so that it contains actual attribute values describing the running thread
.IR thread .
-
+.PP
The returned attribute values may differ from
the corresponding attribute values passed in the
.I attr
in the thread attributes object used to create the thread,
then the returned thread attributes object will report the actual
stack address that the implementation selected for the thread.
-
+.PP
When the thread attributes object returned by
.BR pthread_getattr_np ()
is no longer required, it should be destroyed using
Command-line arguments can be used to set these attributes
to values other than the default when creating the thread.
The shell sessions below demonstrate the use of the program.
-
+.PP
In the first run, on an x86-32 system,
a thread is created using default attributes:
-
+.PP
.in +4n
.nf
.RB "$" " ulimit \-s" " # No stack limit ==> default stack size is 2MB"
Stack size = 0x201000 (2101248) bytes
.fi
.in
-
+.PP
In the following run, we see that if a guard size is specified,
it is rounded up to the next multiple of the system page size
(4096 bytes on x86-32):
-
+.PP
.in +4n
.nf
.RB "$" " ./a.out \-g 4097"
.\" Stack size = 0x8000 (32768) bytes
.\".fi
.\".in
-
+.PP
In the last run, the program manually allocates a stack for the thread.
In this case, the guard size attribute is ignored.
-
+.PP
.in +4n
.nf
.RB "$" " ./a.out \-g 4096 \-s 0x8000 \-a"