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