1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

- Add a man page for cpuset_getaffinity() and cpuset_setaffinity() and

hook it up to the build.

Reviewed by:	brueffer (skeleton and formatting assistance)
This commit is contained in:
Jeff Roberson 2008-03-29 10:26:29 +00:00
parent 329356f9f2
commit d1317e00b8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177706
2 changed files with 159 additions and 2 deletions

View File

@ -63,8 +63,8 @@ MAN+= _exit.2 abort2.2 accept.2 access.2 acct.2 adjtime.2 \
aio_suspend.2 aio_waitcomplete.2 aio_write.2 \
bind.2 brk.2 chdir.2 chflags.2 \
chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 \
connect.2 cpuset.2 dup.2 execve.2 extattr_get_file.2 \
fcntl.2 fhopen.2 flock.2 fork.2 fsync.2 \
connect.2 cpuset.2 cpuset_getaffinity.2 dup.2 execve.2 \
extattr_get_file.2 fcntl.2 fhopen.2 flock.2 fork.2 fsync.2 \
getdirentries.2 getdtablesize.2 \
getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \
getpeername.2 getpgrp.2 getpid.2 getpriority.2 getrlimit.2 \
@ -105,6 +105,7 @@ MLINKS+=chmod.2 fchmod.2 chmod.2 lchmod.2
MLINKS+=chown.2 fchown.2 chown.2 lchown.2
MLINKS+=clock_gettime.2 clock_getres.2 clock_gettime.2 clock_settime.2
MLINKS+=cpuset.2 cpuset_setid.2 cpuset.2 cpuset_getid.2
MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2
MLINKS+=dup.2 dup2.2
MLINKS+=extattr_get_file.2 extattr.2 \
extattr_get_file.2 extattr_delete_fd.2 \

View File

@ -0,0 +1,156 @@
.\" Copyright (c) 2008 Christian Brueffer
.\" Copyright (c) 2008 Jeffrey Roberson
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd March 29, 2008
.Dt CPUSET 2
.Os
.Sh NAME
.Nm cpuset_getaffinity ,
.Nm cpuset_setaffinity
.Nd manage CPU affinity
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/cpuset.h
.Ft int
.Fn cpuset_getaffinity "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "cpuset_t *mask"
.Ft int
.Fn cpuset_setaffinity "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "const cpuset_t *mask"
.Sh DESCRIPTION
.Fn cpuset_getaffinity
and
.Fn cpuset_setaffinity
allow the manipulation of sets of CPUs available to processes, threads,
interrupts and other resources.
These functions may manipulate sets of CPUs that contain many processes
or per-object anonymous masks that effect only a single object.
.Pp
The valid values for the
.Fa level
and
.Fa which
arguments are documented in
.Xr cpuset 2 .
These arguments specify which object and which set of the object we are
referring to.
Not all possible combinations are valid.
For example, only processes may belong to a numbered set accessed by a
.Fa level
argument of
.Dv CPU_LEVEL_CPUSET .
All resources, however, have a mask which may be manipulated with
.Dv CPU_LEVEL_WHICH .
.Pp
Masks of type
.Ft cpuset_t
are composed using the
.Xr CPU_SET 2
macros.
The kernel tolerates large sets as long as all CPUs specified
in the set exist.
Sets smaller than the kernel uses generate an error on calls to
.Fn cpuset_getaffinity
even if the result set would fit within the user supplied set.
Calls to
.Fn cpuset_setaffinity
tolerate small sets with no restrictions.
.Pp
The supplied mask should have a size of
.Fa setsize
bytes.
This size is usually provided by calling
.Li sizeof(mask)
which is ultimately determined by the value of
.Dv CPU_SETSIZE
as defined in
.In sys/cpuset.h .
.Pp
.Fn cpuset_getaffinity
retrieves the
mask from the object specified by
.Fa level ,
.Fa which
and
.Fa id
and stores it in the space provided by
.Fa mask .
.Pp
.Fn cpuset_setaffinity
attempts to set the mask for the object specified by
.Fa level ,
.Fa which
and
.Fa id
to the value in
.Fa mask .
.Pp
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
The following error codes may be set in
.Va errno :
.Bl -tag -width Er
.It Bq Er EINVAL
The
.Fa level
or
.Fa which
argument was not a valid value.
.It Bq Er EDEADLK
The
.Fn cpuset_setaffinity
call would leave a thread without a valid CPU to run on because the set
does not overlap with the thread's anonymous mask.
.It Bq Er EFAULT
The mask pointer passed was invalid.
.It Bq Er ESRCH
The object specified by the
.Fa id
and
.Fa which
arguments could not be found.
.It Bq Er ERANGE
The
.Fa cpusetsize
was either preposterously large or smaller than the kernel set size.
.It Bq Er EPERM
The calling process did not have the credentials required to complete the
operation.
.El
.Sh SEE ALSO
.Xr cpuset 1 ,
.Xr cpuset 2 ,
.Xr cpuset_getid 2 ,
.Xr cpuset_setid 2 ,
.Xr CPU_SET 3
.Sh HISTORY
The
.Nm
family of system calls first appeared in
.Fx 8.0 .
.Sh AUTHOR
.An Jeffrey Roberson Aq jeff@FreeBSD.org