diff options
| author | rmind <rmind@NetBSD.org> | 2008-03-10 19:00:21 +0000 |
|---|---|---|
| committer | rmind <rmind@NetBSD.org> | 2008-03-10 19:00:21 +0000 |
| commit | f67f2ea58455fc50bbf315b3dee5e7f8bbc8e14b (patch) | |
| tree | 11c5dd7b289d55c063a271124983de56f5765559 | |
| parent | 71ca0c37fa31991a35e2b4bfe8be059bb1ae1060 (diff) | |
Add pset(3) manual page, and appropriate links.
Thanks <wiz> for review and fixes!
| -rw-r--r-- | distrib/sets/lists/comp/mi | 12 | ||||
| -rw-r--r-- | lib/librt/Makefile | 9 | ||||
| -rw-r--r-- | lib/librt/pset.3 | 233 |
3 files changed, 251 insertions, 3 deletions
diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index 41d5da2149c..a4c2bf71a57 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1118 2008/03/10 14:47:06 rmind Exp $ +# $NetBSD: mi,v 1.1119 2008/03/10 19:00:21 rmind Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5935,6 +5935,11 @@ ./usr/share/man/cat3/prop_string_mutable.0 comp-c-catman .cat ./usr/share/man/cat3/prop_string_size.0 comp-c-catman .cat ./usr/share/man/cat3/proplib.0 comp-c-catman .cat +./usr/share/man/cat3/pset.0 comp-c-catman .cat +./usr/share/man/cat3/pset_create.0 comp-c-catman .cat +./usr/share/man/cat3/pset_assign.0 comp-c-catman .cat +./usr/share/man/cat3/pset_bind.0 comp-c-catman .cat +./usr/share/man/cat3/pset_destroy.0 comp-c-catman .cat ./usr/share/man/cat3/psignal.0 comp-c-catman .cat ./usr/share/man/cat3/pthread.0 comp-c-catman .cat ./usr/share/man/cat3/pthread_atfork.0 comp-c-catman .cat @@ -10595,6 +10600,11 @@ ./usr/share/man/man3/prop_string_mutable.3 comp-c-man .man ./usr/share/man/man3/prop_string_size.3 comp-c-man .man ./usr/share/man/man3/proplib.3 comp-c-man .man +./usr/share/man/man3/pset.3 comp-c-man .man +./usr/share/man/man3/pset_create.3 comp-c-man .man +./usr/share/man/man3/pset_assign.3 comp-c-man .man +./usr/share/man/man3/pset_bind.3 comp-c-man .man +./usr/share/man/man3/pset_destroy.3 comp-c-man .man ./usr/share/man/man3/psignal.3 comp-c-man .man ./usr/share/man/man3/pthread.3 comp-c-man .man ./usr/share/man/man3/pthread_atfork.3 comp-c-man .man diff --git a/lib/librt/Makefile b/lib/librt/Makefile index 06ee6f26e3e..ff7b44912dd 100644 --- a/lib/librt/Makefile +++ b/lib/librt/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2008/03/10 14:47:06 rmind Exp $ +# $NetBSD: Makefile,v 1.7 2008/03/10 19:00:21 rmind Exp $ # WARNS= 2 @@ -9,7 +9,7 @@ SRCS+= sched.c MAN+= aio_cancel.3 aio_error.3 aio_fsync.3 aio_read.3 aio_return.3 \ aio_suspend.3 aio_write.3 lio_listio.3 \ - sched.3 \ + pset.3 sched.3 \ sem_destroy.3 sem_getvalue.3 sem_init.3 sem_open.3 sem_post.3 \ sem_wait.3 @@ -17,6 +17,11 @@ MLINKS+= sem_open.3 sem_close.3 MLINKS+= sem_open.3 sem_unlink.3 MLINKS+= sem_wait.3 sem_trywait.3 +MLINKS+= pset.3 pset_create.3 +MLINKS+= pset.3 pset_assign.3 +MLINKS+= pset.3 pset_bind.3 +MLINKS+= pset.3 pset_destroy.3 + MLINKS+= sched.3 sched_setparam.3 MLINKS+= sched.3 sched_getparam.3 MLINKS+= sched.3 sched_setscheduler.3 diff --git a/lib/librt/pset.3 b/lib/librt/pset.3 new file mode 100644 index 00000000000..62023f0b726 --- /dev/null +++ b/lib/librt/pset.3 @@ -0,0 +1,233 @@ +.\" $NetBSD: pset.3,v 1.1 2008/03/10 19:00:21 rmind Exp $ +.\" +.\" Copyright (c) 2008 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Mindaugas Rasiukevicius <rmind at NetBSD org>. +.\" +.\" 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" +.Dd March 10, 2008 +.Dt PSET 3 +.Os +.Sh NAME +.Nm pset_create , +.Nm pset_assign , +.Nm pset_bind , +.Nm pset_destroy +.Nd processor sets +.Sh SYNOPSIS +.In sys/pset.h +.Ft int +.Fn pset_create "psetid_t *psid" +.Ft int +.Fn pset_assign "psetid_t psid" "cpuid_t cpuid" "psetid_t *opsid" +.Ft int +.Fn pset_bind "psetid_t psid" "idtype_t type" "id_t id" "psetid_t *opsid" +.Ft int +.Fn pset_destroy "psetid_t psid" +.Sh DESCRIPTION +The processor sets API provides the possibility to bind processes or +threads to specific processors or groups of processors. +This section describes the functions used to control processor sets. +.Ss FUNCTIONS +.Bl -tag -width compact +.It Fn pset_create psid +Creates a processor set, and returns its ID into +.Fa psid . +.It Fn pset_assign psid cpu opsid +Assigns the processor specified by +.Fa cpuid +to the processor set specified by +.Fa psid . +Stores the current processor set ID of the processor or +.Dv PS_NONE +into +.Fa opsid , +if the pointer is not +.Dv NULL . +.Pp +If +.Fa psid +is set to +.Dv PS_QUERY , +then the current processor set ID will be returned into +.Fa psid , +and no assignment will be performed. +.Pp +If +.Fa psid +is set to +.Dv PS_MYID , +then the processor set ID of the calling process will be used, and +.Fa psid +will be ignored. +.Pp +If +.Fa psid +is set to +.Dv PS_NONE , +any assignment to the processor will be cleared. +.It Fn pset_bind psid type id opsid +Binds the target specified by +.Fa id +to the processor set specified by +.Fa psid . +The current processor set ID to which the target is bound or +.Dv PS_NONE +will be returned in +.Fa opsid , +if the pointer is not +.Dv NULL . +.Nx +supports the following types of targets specified by +.Fa type : +.Bl -tag -width P_PID +.It Dv P_PID +Process identified by the PID. +.It Dv P_LWPID +Thread of the calling process indentified by the LID. +.El +.Pp +If +.Fa psid +is set to +.Dv PS_QUERY , +then the current processor set ID to which the target is bound or +.Dv PS_NONE +will be returned in +.Fa opsid , +and no binding will be performed. +If +.Fa psid +is set to +.Dv PS_MYID , +then the processor set ID of the calling process will be used. +.Pp +If +.Fa psid +is set to +.Dv PS_NONE , +the specified target will be unbound from the processor set. +.It Fn pset_destroy psid +Destroys the processor set specified by +.Fa psid . +Before destroying the processor set, all related assignments of the +processors will be cleared, and all bound threads will be unbound. +.Pp +If +.Fa psid +is +.Dv PS_MYID , +the processor set ID of the caller thread will be used. +.El +.Ss NOTES +The +.Fa pset_bind +function can return the current processor set ID to which the +target is bound, or +.Dv PS_NONE . +However, for example, the process may have many threads, which could be +bound to different processor sets. +In such a case it is unspecified which thread will be used to return +the information. +.Sh RETURN VALUES +Upon successful completion these functions return 0. +Otherwise, \-1 is returned and +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn pset_create +function fails if: +.Bl -tag -width Er +.It Bq Er ENOMEM +No memory is available for creation of the processor set, or limit +of the allowed count of the processor sets was reached. +.It Bq Er EPERM +The calling process is not the super-user. +.El +.Pp +The +.Fn pset_assign +function fails if: +.Bl -tag -width Er +.It Bq Er EBUSY +Another operation is performing on the processor set. +.It Bq Er EINVAL +.Fa psid +or +.Fa cpuid +are invalid. +.It Bq Er EPERM +The calling process is not the super-user, and +.Fa psid +is not +.Dv PS_QUERY . +.El +.Pp +The +.Fn pset_bind +function fails if: +.Bl -tag -width Er +.It Bq Er EBUSY +Another operation is performing on the processor set. +.It Bq Er EINVAL +.Fa psid +or +.Fa type +are invalid. +.It Bq Er EPERM +The calling process is not the super-user, and +.Fa psid +is not +.Dv PS_QUERY . +.It Bq Er ESRCH +The specified target was not found. +.El +.Pp +The +.Fn pset_destroy +function fails if: +.Bl -tag -width Er +.It Bq Er EBUSY +Another operation is performing on the processor set. +.It Bq Er EPERM +The calling process is not the super-user. +.El +.Sh SEE ALSO +.Xr sched 3 , +.Xr schedctl 8 +.Sh HISTORY +The processor sets appeared in +.Nx 5.0 . +.Sh BUGS +Currently, these functions are valid and work correctly only with +the SCHED_M2 thread scheduler implementation. |
