1*84d9c625SLionel Sambuc.\" $NetBSD: timer_create.2,v 1.12 2012/11/06 21:16:21 uwe Exp $ 22fe8fb19SBen Gras.\" 32fe8fb19SBen Gras.\" Copyright (c) 2003 The NetBSD Foundation, Inc. 42fe8fb19SBen Gras.\" All rights reserved. 52fe8fb19SBen Gras.\" 62fe8fb19SBen Gras.\" This code is derived from software contributed to The NetBSD Foundation 72fe8fb19SBen Gras.\" by Christos Zoulas. 82fe8fb19SBen Gras.\" 92fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without 102fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions 112fe8fb19SBen Gras.\" are met: 122fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright 132fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer. 142fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 152fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer in the 162fe8fb19SBen Gras.\" documentation and/or other materials provided with the distribution. 172fe8fb19SBen Gras.\" 182fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 192fe8fb19SBen Gras.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 202fe8fb19SBen Gras.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 212fe8fb19SBen Gras.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 222fe8fb19SBen Gras.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 232fe8fb19SBen Gras.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 242fe8fb19SBen Gras.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 252fe8fb19SBen Gras.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 262fe8fb19SBen Gras.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 272fe8fb19SBen Gras.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 282fe8fb19SBen Gras.\" POSSIBILITY OF SUCH DAMAGE. 292fe8fb19SBen Gras.\" 302fe8fb19SBen Gras.Dd May 19, 2010 312fe8fb19SBen Gras.Dt TIMER_CREATE 2 322fe8fb19SBen Gras.Os 332fe8fb19SBen Gras.Sh NAME 342fe8fb19SBen Gras.Nm timer_create 352fe8fb19SBen Gras.Nd create a per-process timer 362fe8fb19SBen Gras.Sh LIBRARY 372fe8fb19SBen Gras.Lb libc 382fe8fb19SBen Gras.Sh SYNOPSIS 392fe8fb19SBen Gras.In time.h 402fe8fb19SBen Gras.In signal.h 412fe8fb19SBen Gras.Ft int 422fe8fb19SBen Gras.Fn timer_create "clockid_t clockid" "struct sigevent * restrict evp" "timer_t * restrict timerid" 432fe8fb19SBen Gras.Sh DESCRIPTION 442fe8fb19SBen GrasThe 452fe8fb19SBen Gras.Fn timer_create 462fe8fb19SBen Grasfunction creates a per-process timer using the clock specified in the 472fe8fb19SBen Gras.Ar clockid 482fe8fb19SBen Grasargument. 492fe8fb19SBen GrasIf it succeeds, the 502fe8fb19SBen Gras.Fn timer_create 512fe8fb19SBen Grasfunction fills in the 522fe8fb19SBen Gras.Ar timerid 532fe8fb19SBen Grasargument with an id associated with the timer created that can be used by 542fe8fb19SBen Grasother timer related calls. 552fe8fb19SBen GrasThe 562fe8fb19SBen Gras.Ar clockid 572fe8fb19SBen Grasmust be a valid clock id as defined in 582fe8fb19SBen Gras.In time.h . 592fe8fb19SBen GrasThe timer is created in a disarmed state. 602fe8fb19SBen Gras.Pp 612fe8fb19SBen GrasAn optional 622fe8fb19SBen Gras.Pq non- Ns Dv NULL 632fe8fb19SBen Gras.Em struct sigevent 642fe8fb19SBen Grasargument can be specified by the 652fe8fb19SBen Gras.Ar evp 662fe8fb19SBen Grasargument. 672fe8fb19SBen GrasIf the 682fe8fb19SBen Gras.Ar evp 692fe8fb19SBen Grasargument is 702fe8fb19SBen Gras.Dv NULL , 712fe8fb19SBen Grasthen 722fe8fb19SBen Gras.Fa evp-\*[Gt]sigev_notify 732fe8fb19SBen Grasdefaults to 742fe8fb19SBen Gras.Dv SIGEV_SIGNAL 752fe8fb19SBen Grasand 762fe8fb19SBen Gras.Fa evp-\*[Gt]sigev_value 772fe8fb19SBen Grasis set to 782fe8fb19SBen Gras.Ar timerid . 792fe8fb19SBen GrasRefer to 802fe8fb19SBen Gras.Xr sigevent 3 812fe8fb19SBen Grasfor more details. 822fe8fb19SBen Gras.Sh NOTES 832fe8fb19SBen GrasTimers are not inherited after a 842fe8fb19SBen Gras.Xr fork 2 852fe8fb19SBen Grasand are disarmed and deleted by an 862fe8fb19SBen Gras.Xr exec 3 . 872fe8fb19SBen Gras.Sh RETURN VALUES 882fe8fb19SBen GrasIf successful, the 892fe8fb19SBen Gras.Fn timer_create 902fe8fb19SBen Grasfunction returns 0, and fills in the 912fe8fb19SBen Gras.Ar timerid 922fe8fb19SBen Grasargument with the id of the new timer that was created. 932fe8fb19SBen GrasOtherwise, it returns \-1, and sets 942fe8fb19SBen Gras.Dv errno 952fe8fb19SBen Grasto indicate the error. 962fe8fb19SBen Gras.Sh ERRORS 972fe8fb19SBen GrasThe 982fe8fb19SBen Gras.Fn timer_create 992fe8fb19SBen Grasfunction will fail if: 1002fe8fb19SBen Gras.Bl -tag -width Er 1012fe8fb19SBen Gras.It Bq Er EAGAIN 1022fe8fb19SBen GrasThe system is out of resources to satisfy this request, or the process has 1032fe8fb19SBen Grascreated all the timers it is allowed. 1042fe8fb19SBen Gras.It Bq Er EINVAL 1052fe8fb19SBen GrasThe argument 1062fe8fb19SBen Gras.Ar clockid 1072fe8fb19SBen Grasis not a valid clock id. 1082fe8fb19SBen Gras.El 1092fe8fb19SBen Gras.Sh SEE ALSO 1102fe8fb19SBen Gras.Xr clock_getres 2 , 1112fe8fb19SBen Gras.Xr clock_gettime 2 , 1122fe8fb19SBen Gras.Xr clock_settime 2 , 1132fe8fb19SBen Gras.Xr timer_delete 2 , 1142fe8fb19SBen Gras.Xr timer_getoverrun 2 , 1152fe8fb19SBen Gras.Xr timer_gettime 2 , 116*84d9c625SLionel Sambuc.Xr timer_settime 2 , 117*84d9c625SLionel Sambuc.Xr sigevent 3 1182fe8fb19SBen Gras.Sh STANDARDS 1192fe8fb19SBen Gras.St -p1003.1b-93 , 1202fe8fb19SBen Gras.St -p1003.1i-95 121