malloc.3: ffix
[man-pages.git] / man3 / pthread_mutexattr_getpshared.3
bloba195434192f68f7b75a796eb430819bef9bcefdc
1 .\" Copyright (c) 2017, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH PTHREAD_MUTEXATTR_GETPSHARED 3 2021-03-22 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set
28 process-shared mutex attribute
29 .SH SYNOPSIS
30 .nf
31 .B #include <pthread.h>
32 .PP
33 .BI "int pthread_mutexattr_getpshared("
34 .BI "                      const pthread_mutexattr_t *restrict " attr ,
35 .BI "                      int *restrict " pshared );
36 .BI "int pthread_mutexattr_setpshared(pthread_mutexattr_t *" attr ,
37 .BI "                      int " pshared );
38 .fi
39 .PP
40 Compile and link with \fI\-pthread\fP.
41 .SH DESCRIPTION
42 These functions get and set the process-shared attribute
43 in a mutex attributes object.
44 This attribute must be appropriately set to ensure correct,
45 efficient operation of a mutex created using this attributes object.
46 .PP
47 The process-shared attribute can have one of the following values:
48 .TP
49 .B PTHREAD_PROCESS_PRIVATE
50 Mutexes created with this attributes object are to be shared
51 only among threads in the same process that initialized the mutex.
52 This is the default value for the process-shared mutex attribute.
53 .TP
54 .B PTHREAD_PROCESS_SHARED
55 Mutexes created with this attributes object can be shared between
56 any threads that have access to the memory containing the object,
57 including threads in different processes.
58 .PP
59 .BR pthread_mutexattr_getpshared ()
60 places the value of the process-shared attribute of
61 the mutex attributes object referred to by
62 .IR attr
63 in the location pointed to by
64 .IR pshared .
65 .PP
66 .BR pthread_mutexattr_setpshared ()
67 sets the value of the process-shared attribute of
68 the mutex attributes object referred to by
69 .IR attr
70 to the value specified in
71 .BR pshared .
72 .PP
74 .I attr
75 does not refer to an initialized mutex attributes object,
76 the behavior is undefined.
77 .SH RETURN VALUE
78 On success, these functions return 0.
79 On error, they return a positive error number.
80 .SH ERRORS
81 .BR pthread_mutexattr_setpshared ()
82 can fail with the following errors:
83 .TP
84 .B EINVAL
85 The value specified in
86 .I pshared
87 is invalid.
88 .TP
89 .B ENOTSUP
90 .I pshared is
91 .BR PTHREAD_PROCESS_SHARED
92 but the implementation does not support process-shared mutexes.
93 .SH CONFORMING TO
94 POSIX.1-2001, POSIX.1-2008.
95 .SH SEE ALSO
96 .ad l
97 .nh
98 .BR pthread_mutexattr_init (3),
99 .BR pthreads (7)