---
name: "cpuset"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/cpuset/3"
---

# cpuset(3)

utility functions for cpuset(2) handling

## NAME

**cpuset\_parselist**, **domainset\_parselist** – utility functions for [cpuset(2)](/cpuset/2.md) handling

## LIBRARY

System Utilities Library (libutil, -lutil)

## SYNOPSIS

**#include \<sys/cpuset.h\>**

**#include \<libutil.h\>**

*int*\

**cpuset\_parselist**(*const char \*cpu\_list*, *cpuset\_t \*mask*);

*int*\

**domainset\_parselist**(*const char \*domain\_policy*, *domainset\_t \*domain\_mask*, *int \*policyp*);

## DESCRIPTION

The **cpuset\_parselist**() function parses a *cpu-list* filling the *mask*.

The *cpu-list* may include numbers separated by '-' for ranges and commas separating individual numbers. A special list of “all” may be specified in which case the list includes all CPUs from the root set.

The **domainset\_parselist**() function parses a [domainset(9)](/domainset/9.md) memory domain allocation policy specified by *domain\_policy* filling the *domain\_mask* and the *policyp*. A valid *domain\_policy* is formatted as *policy:domain-list*. See the *-n* flag in [cpuset(1)](/cpuset/1.md) for a list of valid domain policies.

## RETURN VALUES

Return values can be the following

- CPUSET\_PARSE\_OK

  The parsing was successful

- CPUSET\_PARSE\_ERROR

  The *cpu-list* or *domain-policy* format is invalid

- CPUSET\_PARSE\_GETAFFINITY

  The [cpuset\_getaffinity(2)](/cpuset_getaffinity/2.md) call has failed

- CPUSET\_PARSE\_INVALID\_CPU

  The number of supported CPUs or NUMA domains has been exceeded. The maximum number being *CPU\_SETSIZE* and *DOMAINSET\_SETSIZE* respectively.

- CPUSET\_PARSE\_GETDOMAIN

  The [cpuset\_getdomain(2)](/cpuset_getdomain/2.md) call has failed

## SEE ALSO

[cpuset(1)](/cpuset/1.md), [cpuset(2)](/cpuset/2.md), [numa(4)](/numa/4.md), [cpuset(9)](/cpuset/9.md), [domainset(9)](/domainset/9.md)

## AUTHORS

Jeffrey Roberson ⟨*jeff@FreeBSD.org*⟩
