1.\" $NetBSD: kpause.9,v 1.3 2008/01/02 16:51:32 pooka Exp $ 2.\" 3.\" Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Andrew Doran. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.\" ------------------------------------------------------------ 38.Dd January 2, 2008 39.Dt KPAUSE 9 40.Os 41.\" ------------------------------------------------------------ 42.Sh NAME 43.Nm kpause 44.Nd make the calling LWP sleep 45.\" ------------------------------------------------------------ 46.Sh SYNOPSIS 47.In sys/proc.h 48.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 49.Ft int 50.Fn kpause \ 51"const char *wmesg" "bool intr" "int timeo" "kmutex_t *mtx" 52.\" ------------------------------------------------------------ 53.Sh DESCRIPTION 54.Fn kpause 55makes the calling LWP sleep. 56It's similar to 57.Xr cv_timedwait_sig 9 58without the corresponding 59.Xr cv_signal 9 . 60.Pp 61.Fn kpause 62can wake up spontaneously. 63Callers should prepare to handle it. 64.Pp 65.Bl -tag -width wmesg 66.It Fa wmesg 67Specifies a string of no more than 8 characters that describes 68the resource or condition associated with the call of 69.Fn kpause . 70The kernel does not use this argument directly but makes it available for 71utilities such as 72.Xr ps 1 73to display. 74.It Fa intr 75If true, sleep interruptably. 76If the LWP recieves a signal, or is interrupted by another condition such 77as its containing process exiting, the wait is ended early and an error 78code returned. 79.It Fa timeo 80Specify a timeout. 81It is an architecture and system dependent value related to the number of 82clock interrupts per second. 83See 84.Xr hz 9 85for details. 86The 87.Xr mstohz 9 88macro can be used to convert a timeout expressed in milliseconds to 89one suitable for 90.Fn kpause . 91.Pp 92Zero means no timeout. 93.It Fa mtx 94Convenience and symmetry with other synchronization operations. 95If not 96.Dv NULL , 97.Fa mtx 98will be released once the LWP has prepared to sleep, and will be reacquired 99before 100.Fn kpause 101returns. 102.El 103.\" ------------------------------------------------------------ 104.Sh RETURN VALUES 105.Fn kpause 106returns 0 when waking up spontaneously. 107Otherwise, 108It returns an error number. 109.\" ------------------------------------------------------------ 110.Sh ERRORS 111.Bl -tag -width Er 112.It Bq Er EWOULDBLOCK 113The timeout expired. 114.It Bq Er ERESTART 115.Fn kpause 116returned as a result of a signal with 117.Dv SA_RESTART 118property. 119.It Bq Er EINTR 120.Fn kpause 121returned due to other reasons. 122Typically as a result of a signal without 123.Dv SA_RESTART 124property. 125.El 126.\" ------------------------------------------------------------ 127.Sh SEE ALSO 128.Xr sigaction 2 , 129.Xr errno 9 , 130.Xr condvar 9 , 131.Xr mstohz 9 , 132.Xr hz 9 133