1.\"	$NetBSD: pthread_attr_getschedparam.3,v 1.2 2010/07/08 22:19:26 jruoho Exp $
2.\"
3.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
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.Dd July 7, 2010
29.Dt PTHREAD_ATTR_GETSCHEDPARAM 3
30.Os
31.Sh NAME
32.Nm pthread_attr_getschedparam
33.Nd get and set scheduling attributes
34.Sh LIBRARY
35.Lb libpthread
36.Sh SYNOPSIS
37.In pthread.h
38.Ft int
39.Fn pthread_attr_getschedparam \
40"const pthread_attr_t * restrict attr" "struct sched_param * restrict param"
41.Ft int
42.Fn pthread_attr_setschedparam \
43"pthread_attr_t *attr" "const struct sched_param *param"
44.Ft int
45.Fn pthread_attr_getschedpolicy \
46"const pthread_attr_t * restrict attr" "int * restrict policy"
47.Ft int
48.Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
49.Sh DESCRIPTION
50The
51.Fn pthread_attr_getschedparam
52and
53.Fn pthread_attr_setschedparam
54functions obtain and set the scheduling parameter attribute in the
55.Fa attr
56object.
57The
58.Vt sched_param
59structure is defined in
60.In sched.h .
61At minimum this structure contains only a single member,
62.Vt sched_priority .
63Refer to
64.Xr pthread_schedparam 3
65and
66.Xr sched 3
67for additional details.
68.Pp
69The
70.Fn pthread_attr_getschedpolicy
71and
72.Fn pthread_attr_setschedpolicy
73functions get and set the scheduling policy attribute,
74.Fa policy ,
75in the
76.Fa attr
77object.
78The supported values of
79.Fa policy
80are the same ones listed in
81.Xr pthread_schedparam 3 .
82.Sh RETURN VALUES
83If successful, all described functions return 0.
84Otherwise, an error number is returned to indicate the error.
85.Sh ERRORS
86The
87.Fn pthread_attr_getschedparam
88function may fail if:
89.Bl -tag -width Er
90.It Bq Er EINVAL
91An invalid parameter was specified.
92.El
93.Pp
94The
95.Fn pthread_attr_setschedparam
96function may fail if:
97.Bl -tag -width Er
98.It Bq Er EINVAL
99An invalid parameter was specified.
100.It Bq Er ENOMEM
101There was insufficient memory.
102.El
103.Pp
104The
105.Fn pthread_attr_setschedpolicy
106function may fail if:
107.Bl -tag -width Er
108.It Bq Er ENOMEM
109There was insufficient memory.
110.It Bq Er ENOTSUP
111An unsupported
112.Fa policy
113was specified.
114.El
115.Pp
116No errors are defined for
117.Fn pthread_attr_getschedpolicy .
118.Sh SEE ALSO
119.Xr pthread_attr 3 ,
120.Xr pthread_schedparam 3 ,
121.Xr sched 3
122.Sh STANDARDS
123These functions conform to
124.St -p1003.1-2008 .
125