1.\" $NetBSD: pthread_mutex.3,v 1.10 2017/10/22 16:37:24 abhinav Exp $ 2.\" 3.\" Copyright (c) 2002, 2010 The NetBSD Foundation, Inc. 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.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com> 28.\" All rights reserved. 29.\" 30.\" Redistribution and use in source and binary forms, with or without 31.\" modification, are permitted provided that the following conditions 32.\" are met: 33.\" 1. Redistributions of source code must retain the above copyright 34.\" notice, this list of conditions and the following disclaimer. 35.\" 2. Redistributions in binary form must reproduce the above copyright 36.\" notice, this list of conditions and the following disclaimer in the 37.\" documentation and/or other materials provided with the distribution. 38.\" 3. Neither the name of the author nor the names of any co-contributors 39.\" may be used to endorse or promote products derived from this software 40.\" without specific prior written permission. 41.\" 42.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 43.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 44.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 45.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 46.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 47.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 48.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 50.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 51.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52.\" SUCH DAMAGE. 53.\" 54.Dd November 31, 2017 55.Dt PTHREAD_MUTEX_GETPRIOCEILING 3 56.Os 57.Sh NAME 58.Nm pthread_mutex_getprioceiling , 59.Nm pthread_mutex_setprioceiling 60.Nd get or set the priority ceiling of a mutex 61.Sh LIBRARY 62.Lb libpthread 63.Sh SYNOPSIS 64.In pthread.h 65.Ft int 66.Fn pthread_mutex_getprioceiling "const pthread_mutex_t * restrict mutex" "int * restrict prioceiling" 67.Ft int 68.Fn pthread_mutex_setprioceiling "pthread_mutex_t * restrict mutex" "int prioceiling" "int * restrict old_ceiling" 69.Sh DESCRIPTION 70The 71.Fn pthread_mutex_getprioceiling 72function shall return the current priority ceiling of the mutex. 73.Pp 74The 75.Fn pthread_mutex_setprioceiling 76function shall either lock the mutex if it is unlocked, or block until 77it can successfully lock the mutex, then it shall change the mutex's priority 78ceiling and release the mutex. 79When the change is successful, the previous value of the priority ceiling 80shall be returned 81in 82.Fa old_ceiling . 83The process of locking the mutex need not adhere to the priority 84protect protocol. 85If the 86.Fn pthread_mutex_setprioceiling 87function fails, the mutex priority ceiling shall not be changed. 88.Sh RETURN VALUES 89If successful, these functions return 0. 90Otherwise, an error number is returned to indicate the error. 91.Sh ERRORS 92The 93.Fn pthread_mutex_getprioceiling 94and 95.Fn pthread_mutex_setprioceiling 96functions will fail if: 97.Bl -tag -width Er 98.It Bq Er EINVAL 99The priority requested by 100.Fa prioceiling 101is out of range; or 102the value specified by 103.Fa mutex 104does not refer to a currently existing mutex. 105.It Bq Er EPERM 106The caller does not have the privilege to perform the operation. 107.El 108.Sh SEE ALSO 109.Xr pthread_mutex_destroy 3 , 110.Xr pthread_mutex_init 3 , 111.Xr pthread_mutex_lock 3 , 112.Xr pthread_mutex_timedlock 3 , 113.Xr pthread_mutex_trylock 3 , 114.Xr pthread_mutex_unlock 3 115