xref: /netbsd-src/lib/libpthread/pthread_attr_getschedparam.3 (revision 3e5ec8a33f515be1aff78e35e0212641b48508b2)
1.\"	$NetBSD: pthread_attr_getschedparam.3,v 1.3 2017/10/22 16:37:24 abhinav 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.Nm pthread_attr_setschedparam ,
34.Nm pthread_attr_getschedpolicy ,
35.Nm pthread_attr_setschedpolicy
36.Nd get and set scheduling attributes
37.Sh LIBRARY
38.Lb libpthread
39.Sh SYNOPSIS
40.In pthread.h
41.Ft int
42.Fn pthread_attr_getschedparam \
43"const pthread_attr_t * restrict attr" "struct sched_param * restrict param"
44.Ft int
45.Fn pthread_attr_setschedparam \
46"pthread_attr_t *attr" "const struct sched_param *param"
47.Ft int
48.Fn pthread_attr_getschedpolicy \
49"const pthread_attr_t * restrict attr" "int * restrict policy"
50.Ft int
51.Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
52.Sh DESCRIPTION
53The
54.Fn pthread_attr_getschedparam
55and
56.Fn pthread_attr_setschedparam
57functions obtain and set the scheduling parameter attribute in the
58.Fa attr
59object.
60The
61.Vt sched_param
62structure is defined in
63.In sched.h .
64At minimum this structure contains only a single member,
65.Vt sched_priority .
66Refer to
67.Xr pthread_schedparam 3
68and
69.Xr sched 3
70for additional details.
71.Pp
72The
73.Fn pthread_attr_getschedpolicy
74and
75.Fn pthread_attr_setschedpolicy
76functions get and set the scheduling policy attribute,
77.Fa policy ,
78in the
79.Fa attr
80object.
81The supported values of
82.Fa policy
83are the same ones listed in
84.Xr pthread_schedparam 3 .
85.Sh RETURN VALUES
86If successful, all described functions return 0.
87Otherwise, an error number is returned to indicate the error.
88.Sh ERRORS
89The
90.Fn pthread_attr_getschedparam
91function may fail if:
92.Bl -tag -width Er
93.It Bq Er EINVAL
94An invalid parameter was specified.
95.El
96.Pp
97The
98.Fn pthread_attr_setschedparam
99function may fail if:
100.Bl -tag -width Er
101.It Bq Er EINVAL
102An invalid parameter was specified.
103.It Bq Er ENOMEM
104There was insufficient memory.
105.El
106.Pp
107The
108.Fn pthread_attr_setschedpolicy
109function may fail if:
110.Bl -tag -width Er
111.It Bq Er ENOMEM
112There was insufficient memory.
113.It Bq Er ENOTSUP
114An unsupported
115.Fa policy
116was specified.
117.El
118.Pp
119No errors are defined for
120.Fn pthread_attr_getschedpolicy .
121.Sh SEE ALSO
122.Xr pthread_attr 3 ,
123.Xr pthread_schedparam 3 ,
124.Xr sched 3
125.Sh STANDARDS
126These functions conform to
127.St -p1003.1-2008 .
128