summaryrefslogtreecommitdiffstats
path: root/man3/pthread_getattr_np.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/pthread_getattr_np.3')
-rw-r--r--man3/pthread_getattr_np.331
1 files changed, 15 insertions, 16 deletions
diff --git a/man3/pthread_getattr_np.3 b/man3/pthread_getattr_np.3
index be1fb19..02a621f 100644
--- a/man3/pthread_getattr_np.3
+++ b/man3/pthread_getattr_np.3
@@ -4,7 +4,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH pthread_getattr_np 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH pthread_getattr_np 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
pthread_getattr_np \- get attributes of created thread
.SH LIBRARY
@@ -14,7 +14,7 @@ POSIX threads library
.nf
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <pthread.h>
-.PP
+.P
.BI "int pthread_getattr_np(pthread_t " thread ", pthread_attr_t *" attr );
.fi
.SH DESCRIPTION
@@ -24,7 +24,7 @@ function initializes the thread attributes object referred to by
.I attr
so that it contains actual attribute values describing the running thread
.IR thread .
-.PP
+.P
The returned attribute values may differ from
the corresponding attribute values passed in the
.I attr
@@ -42,12 +42,12 @@ and the guard size,
which the implementation may round upward to a multiple of the page size,
or ignore (i.e., treat as 0),
if the application is allocating its own stack.
-.PP
+.P
Furthermore, if the stack address attribute was not set
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
+.P
When the thread attributes object returned by
.BR pthread_getattr_np ()
is no longer required, it should be destroyed using
@@ -60,7 +60,7 @@ on error, it returns a nonzero error number.
.B ENOMEM
.\" Can happen (but unlikely) while trying to allocate memory for cpuset
Insufficient memory.
-.PP
+.P
In addition, if
.I thread
refers to the main thread, then
@@ -89,7 +89,6 @@ T{
.BR pthread_getattr_np ()
T} Thread safety MT-Safe
.TE
-.sp 1
.SH STANDARDS
GNU;
hence the suffix "_np" (nonportable) in the name.
@@ -105,10 +104,10 @@ and stack size attributes.
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
+.P
In the first run, on an x86-32 system,
a thread is created using default attributes:
-.PP
+.P
.in +4n
.EX
.RB "$" " ulimit \-s" " # No stack limit ==> default stack size is 2 MB"
@@ -120,11 +119,11 @@ Attributes of created thread:
Stack size = 0x201000 (2101248) bytes
.EE
.in
-.PP
+.P
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
+.P
.in +4n
.EX
.RB "$" " ./a.out \-g 4097"
@@ -153,10 +152,10 @@ Attributes of created thread:
.\" Stack size = 0x8000 (32768) bytes
.\".fi
.\".in
-.PP
+.P
In the last run, the program manually allocates a stack for the thread.
In this case, the guard size attribute is ignored.
-.PP
+.P
.in +4n
.EX
.RB "$" " ./a.out \-g 4096 \-s 0x8000 \-a"
@@ -273,7 +272,7 @@ get_thread_attributes_from_cl(int argc, char *argv[],
if (argc > optind)
usage(argv[0], "Extraneous command\-line arguments\en");
\&
- if (stack_size >= 0 || guard_size > 0) {
+ if (stack_size != -1 || guard_size > 0) {
ret_attrp = attrp;
\&
s = pthread_attr_init(attrp);
@@ -281,7 +280,7 @@ get_thread_attributes_from_cl(int argc, char *argv[],
errc(EXIT_FAILURE, s, "pthread_attr_init");
}
\&
- if (stack_size >= 0) {
+ if (stack_size != -1) {
if (!allocate_stack) {
s = pthread_attr_setstacksize(attrp, stack_size);
if (s != 0)
@@ -299,7 +298,7 @@ get_thread_attributes_from_cl(int argc, char *argv[],
}
}
\&
- if (guard_size >= 0) {
+ if (guard_size != -1) {
s = pthread_attr_setguardsize(attrp, guard_size);
if (s != 0)
errc(EXIT_FAILURE, s, "pthread_attr_setstacksize");