xref: /freebsd/lib/libutil/cpuset.3 (revision f1c4c3daccbaf3820f0e2224de53df12fc952fcc)
1.\" Copyright (c) 2017 Baptiste Daroussin <bapt@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd June 24, 2025
26.Dt CPUSET 3
27.Os
28.Sh NAME
29.Nm cpuset_parselist ,
30.Nm domainset_parselist
31.Nd utility functions for cpuset(2) handling
32.Sh LIBRARY
33.Lb libutil
34.Sh SYNOPSIS
35.In sys/cpuset.h
36.In libutil.h
37.Ft int
38.Fn cpuset_parselist "const char *cpu_list" "cpuset_t *mask"
39.Ft int
40.Fn domainset_parselist "const char *domain_policy" "domainset_t *domain_mask" "int *policyp"
41.Sh DESCRIPTION
42The
43.Fn cpuset_parselist
44function parses a
45.Va cpu-list
46filling the
47.Va mask .
48.Pp
49The
50.Va cpu-list
51may include numbers separated by '-' for ranges and commas separating individual
52numbers.
53A special list of
54.Dq all
55may be specified in which case the list includes all CPUs from the root set.
56.Pp
57The
58.Fn domainset_parselist
59function parses a
60.Xr domainset 9
61memory domain allocation policy
62specified by
63.Va domain_policy
64filling the
65.Va domain_mask
66and the
67.Va policyp .
68A valid
69.Va domain_policy
70is formatted as
71.Ar policy:domain-list .
72See the
73.Ar -n
74flag in
75.Xr cpuset 1
76for a list of valid domain policies.
77.Sh RETURN VALUES
78Return values can be the following
79.Bl -tag -width Er
80.It Dv CPUSET_PARSE_OK
81The parsing was successful
82.It Dv CPUSET_PARSE_ERROR
83The
84.Va cpu-list
85or
86.Va domain-policy
87format is invalid
88.It Dv CPUSET_PARSE_GETAFFINITY
89The
90.Xr cpuset_getaffinity 2
91call has failed
92.It Dv CPUSET_PARSE_INVALID_CPU
93The number of supported CPUs or NUMA domains has been exceeded.
94The maximum number being
95.Va CPU_SETSIZE
96and
97.Va DOMAINSET_SETSIZE
98respectively.
99.It Dv CPUSET_PARSE_GETDOMAIN
100The
101.Xr cpuset_getdomain 2
102call has failed
103.El
104.Sh SEE ALSO
105.Xr cpuset 1 ,
106.Xr cpuset 2 ,
107.Xr numa 4 ,
108.Xr cpuset 9 ,
109.Xr domainset 9
110.Sh AUTHORS
111.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
112