jcs's openbsd hax
openbsd
at jcs 83 lines 2.0 kB view raw
1.\" $OpenBSD: pthread_attr_setstackaddr.3,v 1.14 2025/06/07 00:16:52 schwarze Exp $ 2.\" Manual page derived from TOG's UNIX98 documentation. 3.\" 4.\" David Leonard, 2000. Public Domain. 5.\" 6.Dd $Mdocdate: June 7 2025 $ 7.Dt PTHREAD_ATTR_SETSTACKADDR 3 8.Os 9.Sh NAME 10.Nm pthread_attr_setstackaddr , 11.Nm pthread_attr_getstackaddr 12.Nd set and get stackaddr attribute 13.Sh SYNOPSIS 14.Lb libpthread 15.In pthread.h 16.Ft int 17.Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr" 18.Ft int 19.Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr" 20.Sh DESCRIPTION 21The functions 22.Fn pthread_attr_setstackaddr 23and 24.Fn pthread_attr_getstackaddr , 25respectively, set and get the thread 26creation 27.Va stackaddr 28attribute in the 29.Fa attr 30object. 31.Pp 32The 33.Va stackaddr 34attribute specifies the location of storage to be 35used for the created thread's stack. 36The size of the storage is at least 37.Dv PTHREAD_STACK_MIN . 38.Pp 39On 40.Ox 41the stack must have been allocated using 42.Xr mmap 2 43with the 44.Va MAP_STACK 45attribute. 46Otherwise, use of the stack will cause SIGABRT faults. 47.Xr pthread_attr_setstack 3 48can avoid this problem because it knows the size of the stack to remap. 49.Sh RETURN VALUES 50Upon successful completion, 51.Fn pthread_attr_setstackaddr 52and 53.Fn pthread_attr_getstackaddr 54return a value of 0. 55Otherwise, an error number is returned to indicate the error. 56.Pp 57The 58.Fn pthread_attr_getstackaddr 59function stores the 60.Va stackaddr 61attribute value in 62.Fa stackaddr 63if successful. 64.Sh ERRORS 65No errors are defined. 66.Pp 67These functions will not return an error code of 68.Bq Er EINTR . 69.Sh SEE ALSO 70.Xr pthread_attr_init 3 , 71.Xr pthread_attr_setdetachstate 3 , 72.Xr pthread_attr_setguardsize 3 , 73.Xr pthread_attr_setstack 3 , 74.Xr pthread_attr_setstacksize 3 , 75.Xr pthread_create 3 , 76.Xr pthreads 3 77.Sh STANDARDS 78.Fn pthread_attr_setstackaddr 79and 80.Fn pthread_attr_getstackaddr 81conform to ISO/IEC 9945-1 ANSI/IEEE 82.Pq Dq Tn POSIX 83Std 1003.1 Second Edition 1996-07-12.