1.\" $NetBSD: cpuset.3,v 1.6 2011/11/02 20:25:20 wiz Exp $ 2.\" 3.\" Copyright (c) 2008 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Mindaugas Rasiukevicius <rmind at NetBSD org>. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd November 2, 2011 31.Dt CPUSET 3 32.Os 33.Sh NAME 34.Nm cpuset_create , 35.Nm cpuset_destroy , 36.Nm cpuset_zero , 37.Nm cpuset_set , 38.Nm cpuset_clr , 39.Nm cpuset_isset , 40.Nm cpuset_size 41.Nd dynamic CPU sets 42.Sh SYNOPSIS 43.In sched.h 44.Ft cpuset_t * 45.Fn cpuset_create "void" 46.Ft void 47.Fn cpuset_destroy "cpuset_t *set" 48.Ft void 49.Fn cpuset_zero "cpuset_t *set" 50.Ft int 51.Fn cpuset_set "cpuid_t cpu" "cpuset_t *set" 52.Ft int 53.Fn cpuset_clr "cpuid_t cpu" "cpuset_t *set" 54.Ft int 55.Fn cpuset_isset "cpuid_t cpu" "const cpuset_t *set" 56.Ft size_t 57.Fn cpuset_size "const cpuset_t *set" 58.Sh DESCRIPTION 59This section describes the functions used to create, set, use and destroy 60the dynamic CPU sets. 61.Pp 62This API can be used with the POSIX threads, see 63.Xr pthread 3 64and 65.Xr affinity 3 . 66.Pp 67The ID of the primary CPU in the system is 0. 68.Sh FUNCTIONS 69.Bl -tag -width compact 70.It Fn cpuset_create 71Allocates and initializes a clean CPU-set. 72Returns the pointer to the CPU-set, or 73.Dv NULL 74on failure. 75.It Fn cpuset_destroy set 76Destroy the CPU-set specified by 77.Fa set . 78.It Fn cpuset_zero set 79Makes the CPU-set specified by 80.Fa set 81clean, that is, memory is initialized to zero bytes, and none of 82the CPUs set. 83.It Fn cpuset_set cpu set 84Sets the CPU specified by 85.Fa cpu 86in 87.Fa set . 88Returns zero on success, and \-1 if 89.Fa cpu 90is invalid. 91.It Fn cpuset_clr cpu set 92Clears the CPU specified by 93.Fa cpu 94in the CPU-set 95.Fa set . 96Returns zero on success, and \-1 if 97.Fa cpu 98is invalid. 99.It Fn cpuset_isset cpu set 100Checks if CPU specified by 101.Fa cpu 102is set in the CPU-set 103.Fa set . 104Returns the positive number if set, zero if not set, and \-1 if 105.Fa cpu 106is invalid. 107.It Fn cpuset_size set 108Returns the size in bytes of CPU-set specified by 109.Fa set . 110.El 111.Sh SEE ALSO 112.Xr affinity 3 , 113.Xr pset 3 , 114.Xr sched 3 , 115.Xr schedctl 8 , 116.Xr kcpuset 9 117.Sh HISTORY 118The dynamic CPU sets appeared in 119.Nx 5.0 . 120