Print this page
12202 noise in example code in some section 3pool man pages
   1 '\" te
   2 .\" Copyright (c) 2005, 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 POOL_GET_POOL 3POOL "Jul 18, 2005"
   7 .SH NAME
   8 pool_get_pool, pool_get_resource, pool_query_components, pool_query_pools,
   9 pool_query_resources \- retrieve resource pool configuration elements
  10 .SH SYNOPSIS
  11 .LP
  12 .nf
  13 cc [ \fIflag\fR]\&.\|.\|.  \fIfile\fR\&.\|.\|. \fB-lpool\fR [ \fIlibrary\fR\&.\|.\|. ]
  14 #include <pool.h>
  15 
  16 \fBpool_t *\fR\fBpool_get_pool\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBconst char *\fR\fIname\fR);
  17 .fi
  18 
  19 .LP
  20 .nf
  21 \fBpool_resource_t *\fR\fBpool_get_resource\fR(\fBpool_conf_t *\fR\fIconf\fR
  22      \fBconst char *\fR\fItype\fR, \fBconst char *\fR\fIname\fR);
  23 .fi
  24 
  25 .LP
  26 .nf
  27 \fBpool_component_t **\fR\fBpool_query_components\fR(\fBpool_conf_t *\fR\fIconf\fR,
  28      \fBuint_t *\fR\fInelem\fR, \fBpool_value_t **\fR\fIprops\fR);
  29 .fi
  30 
  31 .LP
  32 .nf
  33 \fBpool_t **\fR\fBpool_query_pools\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBuint_t *\fR\fInelem\fR,
  34      \fBpool_value_t **\fR\fIprops\fR);
  35 .fi
  36 
  37 .LP
  38 .nf
  39 \fBpool_component_t **\fR\fBpool_query_resources\fR(\fBpool_conf_t *\fR\fIconf\fR,
  40      \fBuint_t *\fR\fInelem\fR, \fBpool_value_t **\fR\fIprops\fR);
  41 .fi
  42 
  43 .SH DESCRIPTION
  44 .sp
  45 .LP
  46 These functions provide a means for querying the contents of the specified
  47 configuration. The \fIconf\fR argument for each function refers to the target
  48 configuration to which the operation applies.
  49 .sp
  50 .LP
  51 The \fBpool_get_pool()\fR function returns the pool with the given name from
  52 the provided configuration.
  53 .sp
  54 .LP
  55 The \fBpool_get_resource()\fR function returns the resource with the given name
  56 and type from the provided configuration.
  57 .sp
  58 .LP
  59 The \fBpool_query_components()\fR function retrieves all resource components
  60 that match the given list of properties. If the list of properties is
  61 \fINULL\fR, all components are returned. The number of elements returned is
  62 stored in the location pointed to by \fInelem\fR. The value returned by
  63 \fBpool_query_components()\fR is allocated with \fBmalloc\fR(3C) and must be
  64 explicitly freed.
  65 .sp
  66 .LP
  67 The \fBpool_query_pools()\fR function behaves similarly to
  68 \fBpool_query_components()\fR and returns the list of pools that match the
  69 given list of properties. The value returned must be freed by the caller.
  70 .sp
  71 .LP
  72 The \fBpool_query_resources()\fR function similarly returns the list of
  73 resources that match the given list of properties. The return value must be
  74 freed by the caller.
  75 .SH RETURN VALUES
  76 .sp
  77 .LP
  78 The \fBpool_get_pool()\fR and \fBpool_get_resource()\fR functions return the
  79 matching pool and resource, respectively. Otherwise, they return \fINULL\fR and
  80 \fBpool_error\fR(3POOL) returns the pool-specific error value.
  81 .sp
  82 .LP
  83 The \fBpool_query_components()\fR, \fBpool_query_pools()\fR, and
  84 \fBpool_query_resources()\fR functions return a null-terminated array of
  85 components, pools, and resources, respectively. If the query was unsuccessful
  86 or there were no matches, \fINULL\fR is returned and \fBpool_error()\fR returns
  87 the pool-specific error value.
  88 .SH ERRORS

  89 .sp
  90 .LP
  91 The \fBpool_get_pool()\fR will fail if:
  92 .sp
  93 .ne 2
  94 .na
  95 \fB\fBPOE_BADPARAM\fR\fR
  96 .ad
  97 .RS 16n
  98 The supplied configuration's status is not \fBPOF_VALID\fR.
  99 .RE
 100 
 101 .sp
 102 .LP
 103 The \fBpool_get_resource()\fR will fail if:
 104 .sp
 105 .ne 2
 106 .na
 107 \fB\fBPOE_BADPARAM\fR\fR
 108 .ad
 109 .RS 16n
 110 The supplied configuration's status is not \fBPOF_VALID\fR.
 111 .RE
 112 
 113 .sp
 114 .ne 2
 115 .na
 116 \fB\fBPOE_SYSTEM\fR\fR
 117 .ad
 118 .RS 16n
 119 There is not enough memory available to allocate working buffers. Check
 120 \fBerrno\fR for the specific system error code.
 121 .RE
 122 
 123 .sp
 124 .LP
 125 The \fBpool_query_components()\fR, \fBpool_query_pools()\fR, and
 126 \fBpool_query_resources()\fR will fail if:
 127 .sp
 128 .ne 2
 129 .na
 130 \fB\fBPOE_BADPARAM\fR\fR
 131 .ad
 132 .RS 20n
 133 The supplied configuration's status is not \fBPOF_VALID\fR.
 134 .RE
 135 
 136 .sp
 137 .ne 2
 138 .na
 139 \fB\fBPOE_INVALID_CONF\fR\fR
 140 .ad
 141 .RS 20n
 142 The query generated results that were not of the correct type. The
 143 configuration is invalid.
 144 .RE
 145 
 146 .sp
 147 .ne 2
 148 .na
 149 \fB\fBPOE_SYSTEM\fR\fR
 150 .ad
 151 .RS 20n
 152 There is not enough memory available to allocate working buffers. Check
 153 \fBerrno\fR for the specific system error code.
 154 .RE
 155 
 156 .SH EXAMPLES
 157 .LP
 158 \fBExample 1 \fRRetrieve the pool named "foo" from a given configuration.
 159 .sp
 160 .in +2
 161 .nf
 162 #include <pool.h>
 163 #include <stdio.h>
 164 
 165 \&...
 166 
 167 pool_conf_t *conf;
 168 pool_t *pool;
 169 
 170 \&...
 171 
 172 if ((pool = pool_get_pool(conf, "foo")) == NULL) {
 173         (void) fprintf(stderr, "Cannot retrieve pool named
 174         'foo'\\B{}n");
 175         ...
 176 }
 177 .fi
 178 .in -2
 179 
 180 .SH ATTRIBUTES
 181 .sp
 182 .LP
 183 See \fBattributes\fR(5) for descriptions of the following attributes:
 184 .sp
 185 
 186 .sp
 187 .TS
 188 box;
 189 c | c
 190 l | l .
 191 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 192 _
 193 CSI     Enabled
 194 _
 195 Interface Stability     Unstable
 196 _
 197 MT-Level        Safe
 198 .TE
 199 
 200 .SH SEE ALSO
 201 .sp
 202 .LP
 203 \fBlibpool\fR(3LIB), \fBpool_error\fR(3POOL), \fBattributes\fR(5)
   1 '\" te
   2 .\" Copyright (c) 2005, 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 POOL_GET_POOL 3POOL "January 18, 2020"
   7 .SH NAME
   8 pool_get_pool, pool_get_resource, pool_query_components, pool_query_pools,
   9 pool_query_resources \- retrieve resource pool configuration elements
  10 .SH SYNOPSIS

  11 .nf
  12 cc [ \fIflag\fR]\&.\|.\|.  \fIfile\fR\&.\|.\|. \fB-lpool\fR [ \fIlibrary\fR\&.\|.\|. ]
  13 #include <pool.h>
  14 
  15 \fBpool_t *\fR\fBpool_get_pool\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBconst char *\fR\fIname\fR);
  16 .fi
  17 
  18 .LP
  19 .nf
  20 \fBpool_resource_t *\fR\fBpool_get_resource\fR(\fBpool_conf_t *\fR\fIconf\fR
  21      \fBconst char *\fR\fItype\fR, \fBconst char *\fR\fIname\fR);
  22 .fi
  23 
  24 .LP
  25 .nf
  26 \fBpool_component_t **\fR\fBpool_query_components\fR(\fBpool_conf_t *\fR\fIconf\fR,
  27      \fBuint_t *\fR\fInelem\fR, \fBpool_value_t **\fR\fIprops\fR);
  28 .fi
  29 
  30 .LP
  31 .nf
  32 \fBpool_t **\fR\fBpool_query_pools\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBuint_t *\fR\fInelem\fR,
  33      \fBpool_value_t **\fR\fIprops\fR);
  34 .fi
  35 
  36 .LP
  37 .nf
  38 \fBpool_component_t **\fR\fBpool_query_resources\fR(\fBpool_conf_t *\fR\fIconf\fR,
  39      \fBuint_t *\fR\fInelem\fR, \fBpool_value_t **\fR\fIprops\fR);
  40 .fi
  41 
  42 .SH DESCRIPTION


  43 These functions provide a means for querying the contents of the specified
  44 configuration. The \fIconf\fR argument for each function refers to the target
  45 configuration to which the operation applies.
  46 .sp
  47 .LP
  48 The \fBpool_get_pool()\fR function returns the pool with the given name from
  49 the provided configuration.
  50 .sp
  51 .LP
  52 The \fBpool_get_resource()\fR function returns the resource with the given name
  53 and type from the provided configuration.
  54 .sp
  55 .LP
  56 The \fBpool_query_components()\fR function retrieves all resource components
  57 that match the given list of properties. If the list of properties is
  58 \fINULL\fR, all components are returned. The number of elements returned is
  59 stored in the location pointed to by \fInelem\fR. The value returned by
  60 \fBpool_query_components()\fR is allocated with \fBmalloc\fR(3C) and must be
  61 explicitly freed.
  62 .sp
  63 .LP
  64 The \fBpool_query_pools()\fR function behaves similarly to
  65 \fBpool_query_components()\fR and returns the list of pools that match the
  66 given list of properties. The value returned must be freed by the caller.
  67 .sp
  68 .LP
  69 The \fBpool_query_resources()\fR function similarly returns the list of
  70 resources that match the given list of properties. The return value must be
  71 freed by the caller.
  72 .SH RETURN VALUES


  73 The \fBpool_get_pool()\fR and \fBpool_get_resource()\fR functions return the
  74 matching pool and resource, respectively. Otherwise, they return \fINULL\fR and
  75 \fBpool_error\fR(3POOL) returns the pool-specific error value.
  76 .sp
  77 .LP
  78 The \fBpool_query_components()\fR, \fBpool_query_pools()\fR, and
  79 \fBpool_query_resources()\fR functions return a null-terminated array of
  80 components, pools, and resources, respectively. If the query was unsuccessful
  81 or there were no matches, \fINULL\fR is returned and \fBpool_error()\fR returns
  82 the pool-specific error value.
  83 .SH ERRORS
  84 The \fBpool_get_pool()\fR function will fail if:
  85 .sp



  86 .ne 2
  87 .na
  88 \fB\fBPOE_BADPARAM\fR\fR
  89 .ad
  90 .RS 16n
  91 The supplied configuration's status is not \fBPOF_VALID\fR.
  92 .RE
  93 
  94 .sp
  95 .LP
  96 The \fBpool_get_resource()\fR function will fail if:
  97 .sp
  98 .ne 2
  99 .na
 100 \fB\fBPOE_BADPARAM\fR\fR
 101 .ad
 102 .RS 16n
 103 The supplied configuration's status is not \fBPOF_VALID\fR.
 104 .RE
 105 
 106 .sp
 107 .ne 2
 108 .na
 109 \fB\fBPOE_SYSTEM\fR\fR
 110 .ad
 111 .RS 16n
 112 There is not enough memory available to allocate working buffers. Check
 113 \fBerrno\fR for the specific system error code.
 114 .RE
 115 
 116 .sp
 117 .LP
 118 The \fBpool_query_components()\fR, \fBpool_query_pools()\fR, and
 119 \fBpool_query_resources()\fR functions will fail if:
 120 .sp
 121 .ne 2
 122 .na
 123 \fB\fBPOE_BADPARAM\fR\fR
 124 .ad
 125 .RS 20n
 126 The supplied configuration's status is not \fBPOF_VALID\fR.
 127 .RE
 128 
 129 .sp
 130 .ne 2
 131 .na
 132 \fB\fBPOE_INVALID_CONF\fR\fR
 133 .ad
 134 .RS 20n
 135 The query generated results that were not of the correct type. The
 136 configuration is invalid.
 137 .RE
 138 
 139 .sp
 140 .ne 2
 141 .na
 142 \fB\fBPOE_SYSTEM\fR\fR
 143 .ad
 144 .RS 20n
 145 There is not enough memory available to allocate working buffers. Check
 146 \fBerrno\fR for the specific system error code.
 147 .RE
 148 
 149 .SH EXAMPLES

 150 \fBExample 1 \fRRetrieve the pool named "foo" from a given configuration.
 151 .sp
 152 .in +2
 153 .nf
 154 #include <pool.h>
 155 #include <stdio.h>
 156 
 157 \&...
 158 
 159 pool_conf_t *conf;
 160 pool_t *pool;
 161 
 162 \&...
 163 
 164 if ((pool = pool_get_pool(conf, "foo")) == NULL) {
 165         (void) fprintf(stderr, "Cannot retrieve pool named
 166         'foo'\\n");
 167         ...
 168 }
 169 .fi
 170 .in -2
 171 
 172 .SH ATTRIBUTES


 173 See \fBattributes\fR(5) for descriptions of the following attributes:
 174 .sp
 175 
 176 .sp
 177 .TS
 178 box;
 179 c | c
 180 l | l .
 181 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 182 _
 183 CSI     Enabled
 184 _
 185 Interface Stability     Unstable
 186 _
 187 MT-Level        Safe
 188 .TE
 189 
 190 .SH SEE ALSO


 191 \fBlibpool\fR(3LIB), \fBpool_error\fR(3POOL), \fBattributes\fR(5)