]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/cpu-set-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
9 #define CPU_SIZE_TO_NUM(n) ((n) * __NCPUBITS)
11 #define CPU_SIZE_TO_NUM(n) ((n) * sizeof(cpu_set_t) * 8)
14 DEFINE_TRIVIAL_CLEANUP_FUNC(cpu_set_t
*, CPU_FREE
);
15 #define _cleanup_cpu_free_ _cleanup_(CPU_FREEp)
17 static inline cpu_set_t
* cpu_set_mfree(cpu_set_t
*p
) {
23 cpu_set_t
* cpu_set_malloc(unsigned *ncpus
);
25 int parse_cpu_set_internal(const char *rvalue
, cpu_set_t
**cpu_set
, bool warn
, const char *unit
, const char *filename
, unsigned line
, const char *lvalue
);
27 static inline int parse_cpu_set_and_warn(const char *rvalue
, cpu_set_t
**cpu_set
, const char *unit
, const char *filename
, unsigned line
, const char *lvalue
) {
30 return parse_cpu_set_internal(rvalue
, cpu_set
, true, unit
, filename
, line
, lvalue
);
33 static inline int parse_cpu_set(const char *rvalue
, cpu_set_t
**cpu_set
){
34 return parse_cpu_set_internal(rvalue
, cpu_set
, false, NULL
, NULL
, 0, NULL
);