1
1
/*
2
2
* Copyright © 2009 CNRS
3
- * Copyright © 2009-2022 Inria. All rights reserved.
3
+ * Copyright © 2009-2023 Inria. All rights reserved.
4
4
* Copyright © 2009-2012 Université Bordeaux
5
5
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
6
6
* See COPYING in top-level directory.
@@ -83,7 +83,13 @@ typedef const struct hwloc_bitmap_s * hwloc_const_bitmap_t;
83
83
*/
84
84
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc (void ) __hwloc_attribute_malloc ;
85
85
86
- /** \brief Allocate a new full bitmap. */
86
+ /** \brief Allocate a new full bitmap.
87
+ *
88
+ * \returns A valid bitmap or \c NULL.
89
+ *
90
+ * The bitmap should be freed by a corresponding call to
91
+ * hwloc_bitmap_free().
92
+ */
87
93
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc_full (void ) __hwloc_attribute_malloc ;
88
94
89
95
/** \brief Free bitmap \p bitmap.
@@ -119,11 +125,13 @@ HWLOC_DECLSPEC int hwloc_bitmap_snprintf(char * __hwloc_restrict buf, size_t buf
119
125
120
126
/** \brief Stringify a bitmap into a newly allocated string.
121
127
*
122
- * \return -1 on error.
128
+ * \return 0 on success, -1 on error.
123
129
*/
124
130
HWLOC_DECLSPEC int hwloc_bitmap_asprintf (char * * strp , hwloc_const_bitmap_t bitmap );
125
131
126
132
/** \brief Parse a bitmap string and stores it in bitmap \p bitmap.
133
+ *
134
+ * \return 0 on success, -1 on error.
127
135
*/
128
136
HWLOC_DECLSPEC int hwloc_bitmap_sscanf (hwloc_bitmap_t bitmap , const char * __hwloc_restrict string );
129
137
@@ -144,11 +152,13 @@ HWLOC_DECLSPEC int hwloc_bitmap_list_snprintf(char * __hwloc_restrict buf, size_
144
152
145
153
/** \brief Stringify a bitmap into a newly allocated list string.
146
154
*
147
- * \return -1 on error.
155
+ * \return 0 on success, -1 on error.
148
156
*/
149
157
HWLOC_DECLSPEC int hwloc_bitmap_list_asprintf (char * * strp , hwloc_const_bitmap_t bitmap );
150
158
151
159
/** \brief Parse a list string and stores it in bitmap \p bitmap.
160
+ *
161
+ * \return 0 on success, -1 on error.
152
162
*/
153
163
HWLOC_DECLSPEC int hwloc_bitmap_list_sscanf (hwloc_bitmap_t bitmap , const char * __hwloc_restrict string );
154
164
@@ -168,11 +178,13 @@ HWLOC_DECLSPEC int hwloc_bitmap_taskset_snprintf(char * __hwloc_restrict buf, si
168
178
169
179
/** \brief Stringify a bitmap into a newly allocated taskset-specific string.
170
180
*
171
- * \return -1 on error.
181
+ * \return 0 on success, -1 on error.
172
182
*/
173
183
HWLOC_DECLSPEC int hwloc_bitmap_taskset_asprintf (char * * strp , hwloc_const_bitmap_t bitmap );
174
184
175
185
/** \brief Parse a taskset-specific bitmap string and stores it in bitmap \p bitmap.
186
+ *
187
+ * \return 0 on success, -1 on error.
176
188
*/
177
189
HWLOC_DECLSPEC int hwloc_bitmap_taskset_sscanf (hwloc_bitmap_t bitmap , const char * __hwloc_restrict string );
178
190
@@ -279,6 +291,7 @@ HWLOC_DECLSPEC int hwloc_bitmap_to_ulongs(hwloc_const_bitmap_t bitmap, unsigned
279
291
* When called on the output of hwloc_topology_get_topology_cpuset(),
280
292
* the returned number is large enough for all cpusets of the topology.
281
293
*
294
+ * \return the number of unsigned longs required.
282
295
* \return -1 if \p bitmap is infinite.
283
296
*/
284
297
HWLOC_DECLSPEC int hwloc_bitmap_nr_ulongs (hwloc_const_bitmap_t bitmap ) __hwloc_attribute_pure ;
@@ -305,50 +318,53 @@ HWLOC_DECLSPEC int hwloc_bitmap_isfull(hwloc_const_bitmap_t bitmap) __hwloc_attr
305
318
306
319
/** \brief Compute the first index (least significant bit) in bitmap \p bitmap
307
320
*
308
- * \return -1 if no index is set in \p bitmap.
321
+ * \return the first index set in \p bitmap.
322
+ * \return -1 if \p bitmap is empty.
309
323
*/
310
324
HWLOC_DECLSPEC int hwloc_bitmap_first (hwloc_const_bitmap_t bitmap ) __hwloc_attribute_pure ;
311
325
312
326
/** \brief Compute the next index in bitmap \p bitmap which is after index \p prev
313
327
*
314
- * If \p prev is -1, the first index is returned .
315
- *
328
+ * \return the first index set in \p bitmap if \p prev is \c -1 .
329
+ * \return the next index set in \p bitmap if \p prev is not \c -1.
316
330
* \return -1 if no index with higher index is set in \p bitmap.
317
331
*/
318
332
HWLOC_DECLSPEC int hwloc_bitmap_next (hwloc_const_bitmap_t bitmap , int prev ) __hwloc_attribute_pure ;
319
333
320
334
/** \brief Compute the last index (most significant bit) in bitmap \p bitmap
321
335
*
322
- * \return -1 if no index is set in \p bitmap, or if \p bitmap is infinitely set.
336
+ * \return the last index set in \p bitmap.
337
+ * \return -1 if \p bitmap is empty, or if \p bitmap is infinitely set.
323
338
*/
324
339
HWLOC_DECLSPEC int hwloc_bitmap_last (hwloc_const_bitmap_t bitmap ) __hwloc_attribute_pure ;
325
340
326
341
/** \brief Compute the "weight" of bitmap \p bitmap (i.e., number of
327
342
* indexes that are in the bitmap).
328
343
*
329
344
* \return the number of indexes that are in the bitmap.
330
- *
331
345
* \return -1 if \p bitmap is infinitely set.
332
346
*/
333
347
HWLOC_DECLSPEC int hwloc_bitmap_weight (hwloc_const_bitmap_t bitmap ) __hwloc_attribute_pure ;
334
348
335
349
/** \brief Compute the first unset index (least significant bit) in bitmap \p bitmap
336
350
*
337
- * \return -1 if no index is unset in \p bitmap.
351
+ * \return the first unset index in \p bitmap.
352
+ * \return -1 if \p bitmap is full.
338
353
*/
339
354
HWLOC_DECLSPEC int hwloc_bitmap_first_unset (hwloc_const_bitmap_t bitmap ) __hwloc_attribute_pure ;
340
355
341
356
/** \brief Compute the next unset index in bitmap \p bitmap which is after index \p prev
342
357
*
343
- * If \p prev is -1, the first unset index is returned .
344
- *
358
+ * \return the first index unset in \p bitmap if \p prev is \c -1 .
359
+ * \return the next index unset in \p bitmap if \p prev is not \c -1.
345
360
* \return -1 if no index with higher index is unset in \p bitmap.
346
361
*/
347
362
HWLOC_DECLSPEC int hwloc_bitmap_next_unset (hwloc_const_bitmap_t bitmap , int prev ) __hwloc_attribute_pure ;
348
363
349
364
/** \brief Compute the last unset index (most significant bit) in bitmap \p bitmap
350
365
*
351
- * \return -1 if no index is unset in \p bitmap, or if \p bitmap is infinitely set.
366
+ * \return the last index unset in \p bitmap.
367
+ * \return -1 if \p bitmap is full, or if \p bitmap is not infinitely set.
352
368
*/
353
369
HWLOC_DECLSPEC int hwloc_bitmap_last_unset (hwloc_const_bitmap_t bitmap ) __hwloc_attribute_pure ;
354
370
0 commit comments