1
1
/*
2
2
* Copyright © 2009 CNRS
3
- * Copyright © 2009-2020 Inria. All rights reserved.
3
+ * Copyright © 2009-2023 Inria. All rights reserved.
4
4
* Copyright © 2009-2011 Université Bordeaux
5
5
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
6
6
* See COPYING in top-level directory.
@@ -52,6 +52,8 @@ extern "C" {
52
52
* that takes a cpu_set_t as input parameter.
53
53
*
54
54
* \p schedsetsize should be sizeof(cpu_set_t) unless \p schedset was dynamically allocated with CPU_ALLOC
55
+ *
56
+ * \return 0.
55
57
*/
56
58
static __hwloc_inline int
57
59
hwloc_cpuset_to_glibc_sched_affinity (hwloc_topology_t topology __hwloc_attribute_unused , hwloc_const_cpuset_t hwlocset ,
@@ -80,6 +82,9 @@ hwloc_cpuset_to_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribute
80
82
* that takes a cpu_set_t as input parameter.
81
83
*
82
84
* \p schedsetsize should be sizeof(cpu_set_t) unless \p schedset was dynamically allocated with CPU_ALLOC
85
+ *
86
+ * \return 0 on success.
87
+ * \return -1 with errno set to \c ENOMEM if some internal reallocation failed.
83
88
*/
84
89
static __hwloc_inline int
85
90
hwloc_cpuset_from_glibc_sched_affinity (hwloc_topology_t topology __hwloc_attribute_unused , hwloc_cpuset_t hwlocset ,
@@ -95,7 +100,8 @@ hwloc_cpuset_from_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribu
95
100
cpu = 0 ;
96
101
while (count ) {
97
102
if (CPU_ISSET_S (cpu , schedsetsize , schedset )) {
98
- hwloc_bitmap_set (hwlocset , cpu );
103
+ if (hwloc_bitmap_set (hwlocset , cpu ) < 0 )
104
+ return -1 ;
99
105
count -- ;
100
106
}
101
107
cpu ++ ;
@@ -107,7 +113,8 @@ hwloc_cpuset_from_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribu
107
113
assert (schedsetsize == sizeof (cpu_set_t ));
108
114
for (cpu = 0 ; cpu < CPU_SETSIZE ; cpu ++ )
109
115
if (CPU_ISSET (cpu , schedset ))
110
- hwloc_bitmap_set (hwlocset , cpu );
116
+ if (hwloc_bitmap_set (hwlocset , cpu ) < 0 )
117
+ return -1 ;
111
118
#endif /* !CPU_ZERO_S */
112
119
return 0 ;
113
120
}
0 commit comments