8999 SMBIOS: cleanup 32-bit specific code
[unleashed.git] / usr / src / man / man3c / pthread_mutexattr_getpshared.3c
blob469b6142ae0529b582762f7821a976aed80e28c5
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved.
4 .\" Copyright 1991, 1992, 1994, The X/Open Company Ltd.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\"  This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH PTHREAD_MUTEXATTR_GETPSHARED 3C "Mar 23, 2005"
13 .SH NAME
14 pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get or set
15 process-shared attribute
16 .SH SYNOPSIS
17 .LP
18 .nf
19 cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ]
20 #include <pthread.h>
22 \fBint\fR \fBpthread_mutexattr_getpshared\fR(
23      \fBconst pthread_mutexattr_t *restrict\fR \fIattr\fR,
24      \fBint *restrict\fR \fIpshared\fR);
25 .fi
27 .LP
28 .nf
29 \fBint\fR \fBpthread_mutexattr_setpshared\fR(\fBpthread_mutexattr_t *\fR\fIattr\fR,
30      \fBint\fR \fIpshared\fR);
31 .fi
33 .SH DESCRIPTION
34 .sp
35 .LP
36 The \fBpthread_mutexattr_getpshared()\fR function obtains the value of the
37 \fIprocess-shared\fR attribute from the attributes object referenced by
38 \fIattr\fR. The \fBpthread_mutexattr_setpshared()\fR function is used to set
39 the \fIprocess-shared\fR attribute in an initialized attributes object
40 referenced by \fIattr\fR.
41 .sp
42 .LP
43 The \fIprocess-shared\fR attribute is set to  \fBPTHREAD_PROCESS_SHARED\fR to
44 permit a mutex to be operated upon by any thread that has access to the memory
45 where the mutex is allocated, even if the mutex is allocated in memory that is
46 shared by multiple processes. If the \fIprocess-shared\fR attribute is
47 \fBPTHREAD_PROCESS_PRIVATE\fR, the mutex will only be operated upon by threads
48 created within the same process as the thread that initialized the mutex; if
49 threads of differing processes attempt to operate on such a mutex, the behavior
50 is undefined. The default value of the attribute is
51 \fBPTHREAD_PROCESS_PRIVATE\fR.
52 .SH RETURN VALUES
53 .sp
54 .LP
55 Upon successful completion, \fBpthread_mutexattr_getpshared()\fR returns
56 \fB0\fR and stores the value of the \fIprocess-shared\fR attribute of
57 \fIattr\fR into the object referenced by the \fIpshared\fR parameter.
58 Otherwise, an error number is returned to indicate the error.
59 .sp
60 .LP
61 Upon successful completion, \fBpthread_mutexattr_setpshared()\fR returns
62 \fB0\fR. Otherwise, an error number is returned to indicate the error.
63 .SH ERRORS
64 .sp
65 .LP
66 The \fBpthread_mutexattr_getpshared()\fR and
67 \fBpthread_mutexattr_setpshared()\fR functions may fail if:
68 .sp
69 .ne 2
70 .na
71 \fB\fBEINVAL\fR\fR
72 .ad
73 .RS 10n
74 The value specified by \fIattr\fR is invalid.
75 .RE
77 .sp
78 .LP
79 The \fBpthread_mutexattr_setpshared()\fR function may fail if:
80 .sp
81 .ne 2
82 .na
83 \fB\fBEINVAL\fR\fR
84 .ad
85 .RS 10n
86 The new value specified for the attribute is outside the range of legal values
87 for that attribute.
88 .RE
90 .SH ATTRIBUTES
91 .sp
92 .LP
93 See \fBattributes\fR(5) for descriptions of the following attributes:
94 .sp
96 .sp
97 .TS
98 box;
99 c | c
100 l | l .
101 ATTRIBUTE TYPE  ATTRIBUTE VALUE
103 Interface Stability     Standard
105 MT-Level        MT-Safe
108 .SH SEE ALSO
111 \fBpthread_create\fR(3C), \fBpthread_mutex_init\fR(3C),
112 \fBpthread_mutexattr_init\fR(3C), \fBpthread_cond_init\fR(3C),
113 \fBattributes\fR(5), \fBstandards\fR(5)