]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/cpu-set-util.h
4c1c81fc59392295dd8572f91873161530971320
1 /* SPDX-License-Identifier: LGPL-2.1+ */
8 DEFINE_TRIVIAL_CLEANUP_FUNC(cpu_set_t
*, CPU_FREE
);
9 #define _cleanup_cpu_free_ _cleanup_(CPU_FREEp)
11 cpu_set_t
* cpu_set_malloc(unsigned *ncpus
);
13 /* This wraps the libc interface with a variable to keep the allocated size. */
14 typedef struct CPUSet
{
16 size_t allocated
; /* in bytes */
19 static inline void cpu_set_reset(CPUSet
*a
) {
20 assert((a
->allocated
> 0) == !!a
->set
);
26 int cpu_set_add_all(CPUSet
*a
, const CPUSet
*b
);
28 char* cpu_set_to_string(const CPUSet
*a
);
29 int parse_cpu_set_full(
34 const char *filename
, unsigned line
,
36 int parse_cpu_set_extend(
45 static inline int parse_cpu_set(const char *rvalue
, CPUSet
*cpu_set
){
46 return parse_cpu_set_full(rvalue
, cpu_set
, false, NULL
, NULL
, 0, NULL
);