summaryrefslogtreecommitdiff
path: root/lib/libpthread/man/pthread_attr_setguardsize.3
blob: 021971170b87f699b2923996ea178a4e8fb82bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
.\" $OpenBSD: pthread_attr_setguardsize.3,v 1.3 2022/03/31 17:27:17 naddy Exp $
.\" Manual page derived from TOG's XPG6 documentation.
.\"
.\"  David Leonard, 2000. Public Domain.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dt PTHREAD_ATTR_SETGUARDSIZE 3
.Os
.Sh NAME
.Nm pthread_attr_setguardsize ,
.Nm pthread_attr_getguardsize
.Nd set and get guardsize attribute
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize"
.Ft int
.Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize"
.Sh DESCRIPTION
The functions
.Fn pthread_attr_setguardsize
and
.Fn pthread_attr_getguardsize ,
respectively, set and get the thread
creation
.Va guardsize
attribute in the
.Fa attr
object.
If
.Va guardsize
is zero,
a guard area shall not be provided for threads created with
.Fa attr .
If
.Va guardsize
is greater than zero,
a guard area of at least size
.Va guardsize
bytes shall be provided for each thread created with
.Fa attr .
.Pp
The
.Va guardsize
attribute controls the size of the guard area for the created
thread's stack.
The
.Va guardsize
attribute provides protection against overflow of the stack pointer.
If a thread's stack is created with guard protection,
the implementation allocates extra memory at the overflow end of
the stack as a buffer against stack overflow of the stack pointer.
If an application overflows into this buffer, an error shall result
(possibly in a SIGSEGV signal being delivered to the thread).
.Sh RETURN VALUES
Upon successful completion,
.Fn pthread_attr_setguardsize
and
.Fn pthread_attr_getguardsize
return a value of 0.
Otherwise, an error number is returned to indicate the error.
.Pp
The
.Fn pthread_attr_getguardsize
function stores the
.Va guardsize
attribute value in
.Fa guardsize
if successful.
.Sh ERRORS
No errors are defined.
.Pp
These functions will not return an error code of
.Bq Er EINTR .
.Sh SEE ALSO
.Xr pthread_attr_init 3 ,
.Xr pthread_attr_setdetachstate 3 ,
.Xr pthread_attr_setstack 3 ,
.Xr pthread_attr_setstackaddr 3 ,
.Xr pthread_attr_setstacksize 3 ,
.Xr pthread_create 3 ,
.Xr pthreads 3
.Sh STANDARDS
.Fn pthread_attr_setguardsize
and
.Fn pthread_attr_getguardsize
conform to ISO/IEC 9945-1 ANSI/IEEE
.Pq Dq Tn POSIX
Std 1003.1, 2004 Edition.