Index: head/lib/libc/sys/sigqueue.2 =================================================================== --- head/lib/libc/sys/sigqueue.2 (revision 152943) +++ head/lib/libc/sys/sigqueue.2 (revision 152944) @@ -1,142 +1,145 @@ .\" Copyright (c) 2005 David Xu .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice(s), this list of conditions and the following disclaimer as .\" the first lines of this file unmodified other than the possible .\" addition of one or more copyright notices. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice(s), this list of conditions and the following disclaimer in .\" the documentation and/or other materials provided with the .\" distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd November 11, 2005 .Dt SIGQUEUE 2 .Os .Sh NAME .Nm sigqueue .Nd "queue a signal to a process (REALTIME)" .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In signal.h .Ft int .Fn sigqueue "pid_t pid" "int signo" "const union sigval value" .Sh DESCRIPTION The .Fn sigqueue system call causes the signal specified by .Fa signo to be sent with the value specified by .Fa value to the process specified by .Fa pid . If .Fa signo is zero (the null signal), error checking is performed but no signal is actually sent. The null signal can be used to check the validity of PID. .Pp The conditions required for a process to have permission to queue a signal to another process are the same as for the .Xr kill 2 system call. The .Fn sigqueue system call queues a signal to a single process specified by the .Fa pid argument. .Pp The .Fn sigqueue system call returns immediately. If the resources were available to queue the signal, the signal will be queued and sent to the receiving process. .Pp If the value of .Fa pid causes .Fa signo to be generated for the sending process, and if .Fa signo is not blocked for the calling thread and if no other thread has .Fa signo unblocked or is waiting in a .Fn sigwait system call for .Fa signo , either .Fa signo or at least the pending, unblocked signal will be delivered to the calling thread before .Fn sigqueue returns. Should any multiple pending signals in the range .Dv SIGRTMIN to .Dv SIGRTMAX be selected for delivery, it is the lowest numbered one. The selection order between realtime and non-realtime signals, or between multiple pending non-realtime signals, is unspecified. .Sh RETURN VALUES .Rv -std .Sh ERRORS The .Fn sigqueue system call will fail if: .Bl -tag -width Er .It Bq Er EAGAIN No resources are available to queue the signal. The process has already queued .Brq Dv SIGQUEUE_MAX signals that are still pending at the receiver(s), or a system-wide resource limit has been exceeded. .It Bq Er EINVAL The value of the .Fa signo argument is an invalid or unsupported signal number. .It Bq Er EEPERM The process does not have the appropriate privilege to send the signal to the receiving process. .It Bq Er ESRCH The process .Fa pid does not exist. .El .Sh SEE ALSO .Xr sigaction 2 , .Xr sigpending 2 , .Xr sigqueue 2 , .Xr sigsuspend 2 , .Xr sigtimedwait 2 , .Xr sigwait 2 , .Xr sigwaitinfo 2 , .Xr pause 3 , .Xr pthread_sigmask 3 .Sh STANDARDS The .Fn sigqueue system call conforms to -.St -p1003.1-96 . +.St -p1003.1-2004 +.Sh HISTORY +Support for POSIX realtime signal queue first appeared in +.Fx 7.0 . Index: head/lib/libc/sys/timer_create.2 =================================================================== --- head/lib/libc/sys/timer_create.2 (revision 152943) +++ head/lib/libc/sys/timer_create.2 (revision 152944) @@ -1,158 +1,161 @@ .\" Copyright (c) 2005 David Xu .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice(s), this list of conditions and the following disclaimer as .\" the first lines of this file unmodified other than the possible .\" addition of one or more copyright notices. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice(s), this list of conditions and the following disclaimer in .\" the documentation and/or other materials provided with the .\" distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd September 11, 2000 .Dt TIMER_CREATE 2 .Os .Sh NAME .Nm timer_create .Nd "create a per-process timer (REALTIME)" .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In time.h .Ft int .Fo timer_create .Fa "clockid_t clockid" "struct sigevent *restrict evp" .Fa "timer_t *restrict timerid" .Fc .Sh DESCRIPTION The .Fn timer_create system call creates a per-process timer using the specified clock, .Fa clock_id , as the timing base. The .Fn timer_create system call returns, in the location referenced by .Fa timerid , a timer ID of type .Vt timer_t used to identify the timer in timer requests. This timer ID is unique within the calling process until the timer is deleted. The particular clock, .Fa clock_id , is defined in .In time.h . The timer whose ID is returned is in a disarmed state upon return from .Fn timer_create . .Pp The .Fa evp argument, if .Pf non- Dv NULL , points to a .Vt sigevent structure. This structure, allocated by the application, defines the asynchronous notification to occur when the timer expires. If the .Fa evp argument is .Dv NULL , the effect is as if the .Fa evp argument pointed to a .Vt sigevent structure with the .Va sigev_notify member having the value .Dv SIGEV_SIGNAL , the .Va sigev_signo having a default signal number, and the .Va sigev_value member having the value of the timer ID. .Pp The implementations supports a .Fa clock_id of .Dv CLOCK_REALTIME or .Dv CLOCK_MONOTONIC . .Pp If .Fa evp->sigev_sigev_notify is .Dv SIGEV_THREAD and .Fa sev->sigev_notify_attributes is not .Dv NULL , if the attribute pointed to by .Fa sev->sigev_notify_attributes has a thread stack address specified by a call to .Fn pthread_attr_setstack or .Fn pthread_attr_setstackaddr , the results are unspecified if the signal is generated more than once. .Sh RETURN VALUES If the call succeeds, .Fn timer_create returns zero and updates the location referenced by .Fa timerid to a .Vt timer_t , which can be passed to the per-process timer calls. If an error occurs, the system call returns a value of \-1 and the global variable .Va errno is set to indicate the error. The value of .Fa timerid is undefined if an error occurs. .Sh ERRORS The .Fn timer_create system call will fail if: .Bl -tag -width Er .It Bq Er EAGAIN The calling process has already created all of the timers it is allowed by this implementation. .It Bq Er EINVAL The specified clock ID is not supported. .It Bq Er EFAULT Any arguments point outside the allocated address space or there is a memory protection fault. .El .Sh SEE ALSO .Xr clock_getres 2 , .Xr timer_delete 2 , .Xr timer_getoverun 2 .Sh STANDARDS The .Fn timer_create system call conforms to -.St -p1003.1-96 . +.St -p1003.1-2004 +.Sh HISTORY +Support for POSIX per-process timer first appeared in +.Fx 7.0 . Index: head/lib/libc/sys/timer_delete.2 =================================================================== --- head/lib/libc/sys/timer_delete.2 (revision 152943) +++ head/lib/libc/sys/timer_delete.2 (revision 152944) @@ -1,75 +1,78 @@ .\" Copyright (c) 2005 David Xu .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice(s), this list of conditions and the following disclaimer as .\" the first lines of this file unmodified other than the possible .\" addition of one or more copyright notices. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice(s), this list of conditions and the following disclaimer in .\" the documentation and/or other materials provided with the .\" distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd September 11, 2000 .Dt TIMER_DELETE 2 .Os .Sh NAME .Nm timer_delete .Nd "delete a per-process timer (REALTIME)" .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In time.h .Ft int .Fn timer_delete "timer_t timerid" .Sh DESCRIPTION The .Fn timer_delete system call deletes the specified timer, .Fa timerid , previously created by the .Xr timer_create 2 system call. If the timer is armed when .Fn timer_delete is called, the behavior is as if the timer is automatically disarmed before removal. Pending signals for the deleted timer are cleared. .Sh RETURN VALUES .Rv -std .Sh ERRORS The .Fn timer_delete system call will fail if: .Bl -tag -width Er .It Bq Er EINVAL The timer ID specified by .Fa timerid is not a valid timer ID. .El .Sh SEE ALSO .Xr timer_create 2 .Sh STANDARDS The .Fn timer_delete system call conforms to -.St -p1003.1-96 . +.St -p1003.1-2004 +.Sh HISTORY +Support for POSIX per-process timer first appeared in +.Fx 7.0 . Index: head/lib/libc/sys/timer_settime.2 =================================================================== --- head/lib/libc/sys/timer_settime.2 (revision 152943) +++ head/lib/libc/sys/timer_settime.2 (revision 152944) @@ -1,259 +1,262 @@ .\" Copyright (c) 2005 David Xu .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice(s), this list of conditions and the following disclaimer as .\" the first lines of this file unmodified other than the possible .\" addition of one or more copyright notices. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice(s), this list of conditions and the following disclaimer in .\" the documentation and/or other materials provided with the .\" distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd September 11, 2000 .Dt TIMER_SETTIME 2 .Os .Sh NAME .Nm timer_getoverrun , .Nm timer_gettime , .Nm timer_settime .Nd "per-process timers (REALTIME)" .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In time.h .Ft int .Fn timer_getoverrun "timer_t timerid" .Ft int .Fn timer_gettime "timer_t timerid" "struct itimerspec *value" .Ft int .Fo timer_settime .Fa "timer_t timerid" "int flags" "const struct itimerspec *restrict value" .Fa "struct itimerspec *restrict ovalue" .Fc .Sh DESCRIPTION The .Fn timer_gettime system call stores the amount of time until the specified timer, .Fa timerid , expires and the reload value of the timer into the space pointed to by the .Fa value argument. The .Va it_value member of this structure contains the amount of time before the timer expires, or zero if the timer is disarmed. This value is returned as the interval until timer expiration, even if the timer was armed with absolute time. The .Va it_interval member of .Fa value contains the reload value last set by .Fn timer_settime . .Pp The .Fn timer_settime system call sets the time until the next expiration of the timer specified by .Fa timerid from the .Va it_value member of the .Fa value argument and arms the timer if the .Va it_value member of .Fa value is non-zero. If the specified timer was already armed when .Fn timer_settime is called, this call resets the time until next expiration to the value specified. If the .Va it_value member of .Fa value is zero, the timer is disarmed. If the timer is disarmed, then pending signal is removed. .Pp If the flag .Dv TIMER_ABSTIME is not set in the argument .Fa flags , .Fn timer_settime behaves as if the time until next expiration is set to be equal to the interval specified by the .Va it_value member of .Fa value . That is, the timer expires in .Va it_value nanoseconds from when the call is made. If the flag .Dv TIMER_ABSTIME is set in the argument .Fa flags , .Fn timer_settime behaves as if the time until next expiration is set to be equal to the difference between the absolute time specified by the it_value member of value and the current value of the clock associated with .Fa timerid . That is, the timer expires when the clock reaches the value specified by the .Va it_value member of .Fa value . If the specified time has already passed, the system call succeeds and the expiration notification is made. .Pp The reload value of the timer is set to the value specified by the .Va it_interval member of .Fa value . When a timer is armed with a non-zero .Va it_interval , a periodic (or repetitive) timer is specified. .Pp Time values that are between two consecutive non-negative integer multiples of the resolution of the specified timer are rounded up to the larger multiple of the resolution. Quantization error will not cause the timer to expire earlier than the rounded time value. .Pp If the argument .Fa ovalue is not .Dv NULL , the .Fn timer_settime system call stores, in the location referenced by .Fa ovalue , a value representing the previous amount of time before the timer would have expired, or zero if the timer was disarmed, together with the previous timer reload value. Timers do not expire before their scheduled time. .Pp Only a single signal is queued to the process for a given timer at any point in time. When a timer for which a signal is still pending expires, no signal is queued, and a timer overrun will occur. When a timer expiration signal is accepted by a process, the .Fn timer_getoverrun system call returns the timer expiration overrun count for the specified timer. The overrun count returned contains the number of extra timer expirations that occurred between the time the signal was generated (queued) and when it was accepted, up to but not including an maximum of .Brq Dv DELAYTIMER_MAX . If the number of such extra expirations is greater than or equal to .Brq Dv DELAYTIMER_MAX , then the overrun count is set to .Brq Dv DELAYTIMER_MAX . The value returned by .Fn timer_getoverrun applies to the most recent expiration signal acceptance for the timer. If no expiration signal has been delivered for the timer, the return value of .Fn timer_getoverrun is unspecified. .Sh RETURN VALUES If the .Fn timer_getoverrun system call succeeds, it returns the timer expiration overrun count as explained above. Otherwise the value \-1 is returned, and the global variable .Va errno is set to indicate the error. .Pp .Rv -std timer_gettime timer_settime .Sh ERRORS The .Fn timer_settime system call will fail if: .Bl -tag -width Er .It Bq Er EINVAL A .Fa value structure specified a nanosecond value less than zero or greater than or equal to 1000 million, and the .Va it_value member of that structure did not specify zero seconds and nanoseconds. .El .Pp These system calls may fail if: .Bl -tag -width Er .It Bq Er EINVAL The .Fa timerid argument does not correspond to an ID returned by .Fn timer_create but not yet deleted by .Fn timer_delete . .El .Pp The .Fn timer_settime system call may fail if: .Bl -tag -width Er .It Bq Er EINVAL The .Va it_interval member of .Fa value is not zero and the timer was created with notification by creation of a new thread .Va ( sigev_sigev_notify was .Dv SIGEV_THREAD ) and a fixed stack address has been set in the thread attribute pointed to by .Va sigev_notify_attributes . .El .Pp The .Fn timer_gettime and .Fn timer_settime system calls may fail if: .Bl -tag -width Er .It Bq Er EFAULT Any arguments point outside the allocated address space or there is a memory protection fault. .El .Sh SEE ALSO .Xr clock_getres 2 , .Xr timer_create 2 .Sh STANDARDS The .Fn timer_getoverrun , .Fn timer_gettime , and .Fn timer_settime system calls conform to -.St -p1003.1-96 . +.St -p1003.1-2004 +.Sh HISTORY +Support for POSIX per-process timer first appeared in +.Fx 7.0 .