8999 SMBIOS: cleanup 32-bit specific code
[unleashed.git] / usr / src / man / man3scf / scf_handle_create.3scf
blobd751808b4069fbb31ca631e17c51af25d02a295c
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH SCF_HANDLE_CREATE 3SCF "Aug 17, 2007"
7 .SH NAME
8 scf_handle_create, scf_handle_destroy, scf_handle_decorate, scf_handle_bind,
9 scf_handle_unbind, scf_myname \- Service Configuration Facility handle
10 functions
11 .SH SYNOPSIS
12 .LP
13 .nf
14 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ]
15 #include <libscf.h>
17 \fBscf_handle_t *\fR\fBscf_handle_create\fR(\fBscf_version_t\fR \fIversion\fR);
18 .fi
20 .LP
21 .nf
22 \fBvoid\fR \fBscf_handle_destroy\fR(\fBscf_handle_t *\fR\fIhandle\fR);
23 .fi
25 .LP
26 .nf
27 \fBint\fR \fBscf_handle_decorate\fR(\fBscf_handle_t *\fR\fIhandle\fR, \fBconst char *\fR\fIparam\fR,
28      \fBscf_value_t *\fR\fIvalue\fR);
29 .fi
31 .LP
32 .nf
33 \fBint\fR \fBscf_handle_bind\fR(\fBscf_handle_t *\fR\fIhandle\fR);
34 .fi
36 .LP
37 .nf
38 \fBint\fR \fBscf_handle_unbind\fR(\fBscf_handle_t *\fR\fIhandle\fR);
39 .fi
41 .LP
42 .nf
43 \fBssize_t\fR \fBscf_myname\fR(\fBscf_handle_t *\fR\fIhandle\fR, \fBchar *\fR\fIout\fR, \fBsize_t\fR \fIsz\fR);
44 .fi
46 .SH DESCRIPTION
47 .sp
48 .LP
49 The \fBscf_handle_create()\fR function creates a new Service Configuration
50 Facility handle that is used as the base for all communication with the
51 configuration repository. The version argument must be \fBSCF_VERSION\fR.
52 .sp
53 .LP
54 The \fBscf_handle_decorate()\fR function sets a single connection-level
55 parameter, \fIparam\fR, to the supplied value. If \fIvalue\fR is
56 \fBSCF_DECORATE_CLEAR\fR, \fIparam\fR is reset to its default state. Values
57 passed to \fBscf_handle_decorate()\fR can be reset, reused, or destroyed. The
58 values set do not take effect until \fBscf_handle_bind()\fR is called. Any
59 invalid values will not cause errors prior to the call to
60 \fBscf_handle_bind()\fR. The only available decorations is:
61 .sp
62 .ne 2
63 .na
64 \fBdebug\fR
65 .ad
66 .RS 9n
67 (count) Set the debugging flags.
68 .RE
70 .sp
71 .LP
72 The \fBscf_handle_bind()\fR function binds the handle to a running
73 \fBsvc.configd\fR(1M) daemon, using the current decorations to modify the
74 connection. All states derived from the handle are reset immediately after a
75 successful binding.
76 .sp
77 .LP
78 The \fBscf_handle_unbind()\fR function severs an existing repository connection
79 or clears the in-client state for a broken connection.
80 .sp
81 .LP
82 The \fBscf_handle_destroy()\fR function destroys and frees an SCF handle. It is
83 illegal to use the handle after calling \fBscf_handle_destroy()\fR. Actions on
84 subordinate objects act as if the handle is unbound.
85 .sp
86 .LP
87 The \fBscf_myname()\fR function retrieves the FMRI for the service of which the
88 connecting process is a part. If the full FMRI does not fit in the provided
89 buffer, it is truncated and, if \fIsz\fR > 0, zero-terminated.
90 .SH RETURN VALUES
91 .sp
92 .LP
93 Upon successful completion, \fBscf_handle_create()\fR returns the new handle.
94 Otherwise, it returns \fINULL\fR.
95 .sp
96 .LP
97 Upon successful completion, \fBscf_handle_decorate()\fR,
98 \fBscf_handle_bind()\fR, and \fBscf_handle_unbind()\fR return 0. Otherwise,
99 they return -1.
102 The \fBscf_myname()\fR function returns the length of the full FMRI. Otherwise,
103 it returns -1.
104 .SH ERRORS
107 The \fBscf_handle_create()\fR function will fail if:
109 .ne 2
111 \fB\fBSCF_ERROR_NO_MEMORY\fR\fR
113 .RS 30n
114 There is no memory available.
118 .ne 2
120 \fB\fBSCF_ERROR_VERSION_MISMATCH\fR\fR
122 .RS 30n
123 The version is invalid, or the application was compiled against a version of
124 the library that is more recent than the one on the system.
129 The \fBscf_handle_decorate()\fR function will fail if:
131 .ne 2
133 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
135 .RS 30n
136 The \fIparam\fR argument is not a recognized parameter.
140 .ne 2
142 \fB\fBSCF_ERROR_TYPE_MISMATCH\fR\fR
144 .RS 30n
145 The \fIvalue\fR argument does not match the expected type for param.
149 .ne 2
151 \fB\fBSCF_ERROR_NOT_SET\fR\fR
153 .RS 30n
154 The \fIvalue\fR argument is not set.
158 .ne 2
160 \fB\fBSCF_ERROR_IN_USE\fR\fR
162 .RS 30n
163 The handle is currently bound.
167 .ne 2
169 \fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR
171 .RS 30n
172 The \fIvalue\fR argument is not derived from \fIhandle\fR.
177 The \fBscf_handle_bind()\fR function will fail if:
179 .ne 2
181 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
183 .RS 30n
184 One of the decorations was invalid.
188 .ne 2
190 \fB\fBSCF_ERROR_NO_SERVER\fR\fR
192 .RS 30n
193 The repository server is not running.
197 .ne 2
199 \fB\fBSCF_ERROR_NO_RESOURCES\fR\fR
201 .RS 30n
202 The server does not have adequate resources for a new connection.
206 .ne 2
208 \fB\fBSCF_ERROR_IN_USE\fR\fR
210 .RS 30n
211 The handle is already bound.
216 The \fBscf_handle_unbind()\fR function will fail if:
218 .ne 2
220 \fB\fBSCF_ERROR_NOT_BOUND\fR\fR
222 .RS 23n
223 The handle is not bound.
228 The \fBscf_handle_myname()\fR function will fail if:
230 .ne 2
232 \fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR
234 .sp .6
235 .RS 4n
236 The connection to the repository was lost.
240 .ne 2
242 \fB\fBSCF_ERROR_NOT_BOUND\fR\fR
244 .sp .6
245 .RS 4n
246 The handle is not bound.
250 .ne 2
252 \fB\fBSCF_ERROR_NOT_SET\fR\fR
254 .sp .6
255 .RS 4n
256 This process is not marked as a SMF service.
261 The \fBscf_error\fR(3SCF) function can be used to retrieve the error value.
262 .SH ATTRIBUTES
265 See \fBattributes\fR(5) for descriptions of the following attributes:
270 box;
271 c | c
272 l | l .
273 ATTRIBUTE TYPE  ATTRIBUTE VALUE
275 Interface Stability     Committed
277 MT-Level        See below.
282 Operations on a single handle (and the objects associated with it) are Safe.
283 Operations on different handles are MT-Safe. Objects associated with different
284 handles cannot be mixed, as this will lead to an
285 \fBSCF_ERROR_HANDLE_MISMATCH\fR error.
286 .SH SEE ALSO
289 \fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBattributes\fR(5)