xref: /netbsd-src/lib/libpthread/pthread_schedparam.3 (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
1.\" $NetBSD: pthread_schedparam.3,v 1.3 2003/07/04 08:43:33 wiz Exp $
2.\"
3.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. Neither the name of The NetBSD Foundation nor the names of its
14.\"    contributors may be used to endorse or promote products derived
15.\"    from this software without specific prior written permission.
16.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26.\" POSSIBILITY OF SUCH DAMAGE.
27.\"
28.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
29.\" All rights reserved.
30.\"
31.\" Redistribution and use in source and binary forms, with or without
32.\" modification, are permitted provided that the following conditions
33.\" are met:
34.\" 1. Redistributions of source code must retain the above copyright
35.\"    notice(s), this list of conditions and the following disclaimer as
36.\"    the first lines of this file unmodified other than the possible
37.\"    addition of one or more copyright notices.
38.\" 2. Redistributions in binary form must reproduce the above copyright
39.\"    notice(s), this list of conditions and the following disclaimer in
40.\"    the documentation and/or other materials provided with the
41.\"    distribution.
42.\"
43.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
44.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
47.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
50.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
51.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
52.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
53.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54.\"
55.\" $FreeBSD: src/lib/libpthread/man/pthread_schedparam.3,v 1.7 2002/09/16 19:29:29 mini Exp $
56.Dd January 30, 2003
57.Dt PTHREAD_SCHEDPARAM 3
58.Os
59.Sh NAME
60.Nm pthread_setschedparam ,
61.Nm pthread_getschedparam
62.Nd thread scheduling parameter manipulation
63.Sh LIBRARY
64.Lb libpthread
65.Sh SYNOPSIS
66.In pthread.h
67.Ft int
68.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param"
69.Ft int
70.Fn pthread_getschedparam "pthread_t thread" "int *policy" "struct sched_param *param"
71.Sh DESCRIPTION
72The
73.Fn pthread_setschedparam
74and
75.Fn pthread_getschedparam
76functions set and get the scheduling parameters of individual threads.
77The scheduling policy for a thread can either be
78.Dv SCHED_FIFO
79(first in, first out),
80.Dv SCHED_RR
81(round-robin),
82or
83.Dv SCHED_OTHER
84(system default).
85The thread priority (accessed via
86.Va param-\*[Gt]sched_priority )
87must be at least
88.Dv PTHREAD_MIN_PRIORITY
89and no more than
90.Dv PTHREAD_MAX_PRIORITY .
91.Sh RETURN VALUES
92If successful, these functions return 0.
93Otherwise, an error number is returned to indicate the error.
94.Sh ERRORS
95.Fn pthread_setschedparam
96may fail if:
97.Bl -tag -width Er
98.It Bq Er EINVAL
99The value specified by
100.Va policy
101is invalid.
102.It Bq Er ENOTSUP
103Invalid value for scheduling parameters.
104.It Bq Er ESRCH
105Non-existent thread
106.Va thread .
107.El
108.Pp
109.Fn pthread_getschedparam
110may fail if:
111.Bl -tag -width Er
112.It Bq Er ESRCH
113Non-existent thread
114.Va thread .
115.El
116.Sh STANDARDS
117.Fn pthread_setschedparam
118and
119.Fn pthread_getschedparam
120conform to
121.St -p1003.1-96 .
122