1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate *
4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate * with the License.
8*7c478bd9Sstevel@tonic-gate *
9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate *
14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate *
20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate */
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gate #include <sys/timer.h>
30*7c478bd9Sstevel@tonic-gate #include <sys/systm.h>
31*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
32*7c478bd9Sstevel@tonic-gate #include <sys/kmem.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/debug.h>
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gate static clock_backend_t clock_realtime;
36*7c478bd9Sstevel@tonic-gate
37*7c478bd9Sstevel@tonic-gate static int
clock_realtime_settime(timespec_t * ts)38*7c478bd9Sstevel@tonic-gate clock_realtime_settime(timespec_t *ts)
39*7c478bd9Sstevel@tonic-gate {
40*7c478bd9Sstevel@tonic-gate mutex_enter(&tod_lock);
41*7c478bd9Sstevel@tonic-gate tod_set(*ts);
42*7c478bd9Sstevel@tonic-gate set_hrestime(ts);
43*7c478bd9Sstevel@tonic-gate mutex_exit(&tod_lock);
44*7c478bd9Sstevel@tonic-gate
45*7c478bd9Sstevel@tonic-gate return (0);
46*7c478bd9Sstevel@tonic-gate }
47*7c478bd9Sstevel@tonic-gate
48*7c478bd9Sstevel@tonic-gate /*
49*7c478bd9Sstevel@tonic-gate * We normally won't execute this path; libc will see CLOCK_REALTIME and
50*7c478bd9Sstevel@tonic-gate * fast trap directly into gethrestime().
51*7c478bd9Sstevel@tonic-gate */
52*7c478bd9Sstevel@tonic-gate static int
clock_realtime_gettime(timespec_t * ts)53*7c478bd9Sstevel@tonic-gate clock_realtime_gettime(timespec_t *ts)
54*7c478bd9Sstevel@tonic-gate {
55*7c478bd9Sstevel@tonic-gate gethrestime(ts);
56*7c478bd9Sstevel@tonic-gate
57*7c478bd9Sstevel@tonic-gate return (0);
58*7c478bd9Sstevel@tonic-gate }
59*7c478bd9Sstevel@tonic-gate
60*7c478bd9Sstevel@tonic-gate static int
clock_realtime_getres(timespec_t * ts)61*7c478bd9Sstevel@tonic-gate clock_realtime_getres(timespec_t *ts)
62*7c478bd9Sstevel@tonic-gate {
63*7c478bd9Sstevel@tonic-gate ts->tv_sec = 0;
64*7c478bd9Sstevel@tonic-gate ts->tv_nsec = nsec_per_tick;
65*7c478bd9Sstevel@tonic-gate
66*7c478bd9Sstevel@tonic-gate return (0);
67*7c478bd9Sstevel@tonic-gate }
68*7c478bd9Sstevel@tonic-gate
69*7c478bd9Sstevel@tonic-gate static void
clock_realtime_fire(void * arg)70*7c478bd9Sstevel@tonic-gate clock_realtime_fire(void *arg)
71*7c478bd9Sstevel@tonic-gate {
72*7c478bd9Sstevel@tonic-gate int cnt2nth;
73*7c478bd9Sstevel@tonic-gate itimer_t *it = (itimer_t *)arg;
74*7c478bd9Sstevel@tonic-gate timeout_id_t *tidp = it->it_arg;
75*7c478bd9Sstevel@tonic-gate timespec_t now, interval2nth;
76*7c478bd9Sstevel@tonic-gate timespec_t *val, *interval;
77*7c478bd9Sstevel@tonic-gate proc_t *p = it->it_proc;
78*7c478bd9Sstevel@tonic-gate clock_t ticks;
79*7c478bd9Sstevel@tonic-gate
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate * First call into the timer subsystem to get the signal going.
82*7c478bd9Sstevel@tonic-gate */
83*7c478bd9Sstevel@tonic-gate timer_fire(it);
84*7c478bd9Sstevel@tonic-gate
85*7c478bd9Sstevel@tonic-gate val = &it->it_itime.it_value;
86*7c478bd9Sstevel@tonic-gate interval = &it->it_itime.it_interval;
87*7c478bd9Sstevel@tonic-gate
88*7c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock);
89*7c478bd9Sstevel@tonic-gate
90*7c478bd9Sstevel@tonic-gate if (!timerspecisset(interval)) {
91*7c478bd9Sstevel@tonic-gate timerspecclear(val);
92*7c478bd9Sstevel@tonic-gate *tidp = 0;
93*7c478bd9Sstevel@tonic-gate } else {
94*7c478bd9Sstevel@tonic-gate /*
95*7c478bd9Sstevel@tonic-gate * If this is an interval timer, we need to determine a time
96*7c478bd9Sstevel@tonic-gate * at which to go off in the future. In the event that the
97*7c478bd9Sstevel@tonic-gate * clock has been adjusted, we want to find our new interval
98*7c478bd9Sstevel@tonic-gate * relatively quickly (and we don't want to simply take the
99*7c478bd9Sstevel@tonic-gate * current time and add the interval; it would lead to
100*7c478bd9Sstevel@tonic-gate * unnecessary jitter in the timer). We therefore take steps
101*7c478bd9Sstevel@tonic-gate * from the time we expected to go off into the future;
102*7c478bd9Sstevel@tonic-gate * if the resulting time is still in the past, then we double
103*7c478bd9Sstevel@tonic-gate * our step size and continue. Once the resulting time is
104*7c478bd9Sstevel@tonic-gate * in the future, we subtract our last step, change our step
105*7c478bd9Sstevel@tonic-gate * size back to the original interval, and repeat until we
106*7c478bd9Sstevel@tonic-gate * can get to a valid, future timeout in one step. This
107*7c478bd9Sstevel@tonic-gate * assures that we will get the minimum, valid timeout
108*7c478bd9Sstevel@tonic-gate * value in a reasonable amount of wall time.
109*7c478bd9Sstevel@tonic-gate */
110*7c478bd9Sstevel@tonic-gate for (;;) {
111*7c478bd9Sstevel@tonic-gate interval2nth = *interval;
112*7c478bd9Sstevel@tonic-gate
113*7c478bd9Sstevel@tonic-gate /*
114*7c478bd9Sstevel@tonic-gate * We put a floor on interval2nth at nsec_per_tick.
115*7c478bd9Sstevel@tonic-gate * If we don't do this, and the interval is shorter
116*7c478bd9Sstevel@tonic-gate * than the time required to run through this logic,
117*7c478bd9Sstevel@tonic-gate * we'll never catch up to the current time (which
118*7c478bd9Sstevel@tonic-gate * is a moving target).
119*7c478bd9Sstevel@tonic-gate */
120*7c478bd9Sstevel@tonic-gate if (interval2nth.tv_sec == 0 &&
121*7c478bd9Sstevel@tonic-gate interval2nth.tv_nsec < nsec_per_tick)
122*7c478bd9Sstevel@tonic-gate interval2nth.tv_nsec = nsec_per_tick;
123*7c478bd9Sstevel@tonic-gate
124*7c478bd9Sstevel@tonic-gate for (cnt2nth = 0; ; cnt2nth++) {
125*7c478bd9Sstevel@tonic-gate timespecadd(val, &interval2nth);
126*7c478bd9Sstevel@tonic-gate gethrestime(&now);
127*7c478bd9Sstevel@tonic-gate if (timerspeccmp(val, &now) > 0)
128*7c478bd9Sstevel@tonic-gate break;
129*7c478bd9Sstevel@tonic-gate timespecadd(&interval2nth, &interval2nth);
130*7c478bd9Sstevel@tonic-gate }
131*7c478bd9Sstevel@tonic-gate if (cnt2nth == 0)
132*7c478bd9Sstevel@tonic-gate break;
133*7c478bd9Sstevel@tonic-gate timespecsub(val, &interval2nth);
134*7c478bd9Sstevel@tonic-gate }
135*7c478bd9Sstevel@tonic-gate
136*7c478bd9Sstevel@tonic-gate ticks = timespectohz(val, now);
137*7c478bd9Sstevel@tonic-gate *tidp = realtime_timeout(clock_realtime_fire, it, ticks);
138*7c478bd9Sstevel@tonic-gate }
139*7c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock);
140*7c478bd9Sstevel@tonic-gate }
141*7c478bd9Sstevel@tonic-gate
142*7c478bd9Sstevel@tonic-gate /*
143*7c478bd9Sstevel@tonic-gate * See the block comment in clock_realtime_timer_settime(), below.
144*7c478bd9Sstevel@tonic-gate */
145*7c478bd9Sstevel@tonic-gate static void
clock_realtime_fire_first(void * arg)146*7c478bd9Sstevel@tonic-gate clock_realtime_fire_first(void *arg)
147*7c478bd9Sstevel@tonic-gate {
148*7c478bd9Sstevel@tonic-gate itimer_t *it = (itimer_t *)arg;
149*7c478bd9Sstevel@tonic-gate timespec_t now;
150*7c478bd9Sstevel@tonic-gate timespec_t *val = &it->it_itime.it_value;
151*7c478bd9Sstevel@tonic-gate timeout_id_t *tidp = it->it_arg;
152*7c478bd9Sstevel@tonic-gate proc_t *p = it->it_proc;
153*7c478bd9Sstevel@tonic-gate
154*7c478bd9Sstevel@tonic-gate gethrestime(&now);
155*7c478bd9Sstevel@tonic-gate
156*7c478bd9Sstevel@tonic-gate if ((val->tv_sec > now.tv_sec) ||
157*7c478bd9Sstevel@tonic-gate (val->tv_sec == now.tv_sec && val->tv_nsec > now.tv_nsec)) {
158*7c478bd9Sstevel@tonic-gate /*
159*7c478bd9Sstevel@tonic-gate * We went off too early. We'll go to bed for one more tick,
160*7c478bd9Sstevel@tonic-gate * regardless of the actual difference; if the difference
161*7c478bd9Sstevel@tonic-gate * is greater than one tick, then we must have seen an adjtime.
162*7c478bd9Sstevel@tonic-gate */
163*7c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock);
164*7c478bd9Sstevel@tonic-gate *tidp = realtime_timeout(clock_realtime_fire, it, 1);
165*7c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock);
166*7c478bd9Sstevel@tonic-gate return;
167*7c478bd9Sstevel@tonic-gate }
168*7c478bd9Sstevel@tonic-gate
169*7c478bd9Sstevel@tonic-gate clock_realtime_fire(arg);
170*7c478bd9Sstevel@tonic-gate }
171*7c478bd9Sstevel@tonic-gate
172*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
173*7c478bd9Sstevel@tonic-gate static int
clock_realtime_timer_create(itimer_t * it,struct sigevent * ev)174*7c478bd9Sstevel@tonic-gate clock_realtime_timer_create(itimer_t *it, struct sigevent *ev)
175*7c478bd9Sstevel@tonic-gate {
176*7c478bd9Sstevel@tonic-gate it->it_arg = kmem_zalloc(sizeof (timeout_id_t), KM_SLEEP);
177*7c478bd9Sstevel@tonic-gate
178*7c478bd9Sstevel@tonic-gate return (0);
179*7c478bd9Sstevel@tonic-gate }
180*7c478bd9Sstevel@tonic-gate
181*7c478bd9Sstevel@tonic-gate static int
clock_realtime_timer_settime(itimer_t * it,int flags,const struct itimerspec * when)182*7c478bd9Sstevel@tonic-gate clock_realtime_timer_settime(itimer_t *it, int flags,
183*7c478bd9Sstevel@tonic-gate const struct itimerspec *when)
184*7c478bd9Sstevel@tonic-gate {
185*7c478bd9Sstevel@tonic-gate timeout_id_t tid, *tidp = it->it_arg;
186*7c478bd9Sstevel@tonic-gate timespec_t now;
187*7c478bd9Sstevel@tonic-gate proc_t *p = curproc;
188*7c478bd9Sstevel@tonic-gate clock_t ticks;
189*7c478bd9Sstevel@tonic-gate
190*7c478bd9Sstevel@tonic-gate gethrestime(&now);
191*7c478bd9Sstevel@tonic-gate
192*7c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock);
193*7c478bd9Sstevel@tonic-gate
194*7c478bd9Sstevel@tonic-gate while ((tid = *tidp) != 0) {
195*7c478bd9Sstevel@tonic-gate *tidp = 0;
196*7c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock);
197*7c478bd9Sstevel@tonic-gate (void) untimeout(tid);
198*7c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock);
199*7c478bd9Sstevel@tonic-gate }
200*7c478bd9Sstevel@tonic-gate
201*7c478bd9Sstevel@tonic-gate /*
202*7c478bd9Sstevel@tonic-gate * The timeout has been removed; it is safe to update it_itime.
203*7c478bd9Sstevel@tonic-gate */
204*7c478bd9Sstevel@tonic-gate it->it_itime = *when;
205*7c478bd9Sstevel@tonic-gate
206*7c478bd9Sstevel@tonic-gate if (timerspecisset(&it->it_itime.it_value)) {
207*7c478bd9Sstevel@tonic-gate if (!(flags & TIMER_ABSTIME))
208*7c478bd9Sstevel@tonic-gate timespecadd(&it->it_itime.it_value, &now);
209*7c478bd9Sstevel@tonic-gate
210*7c478bd9Sstevel@tonic-gate ticks = timespectohz(&it->it_itime.it_value, now);
211*7c478bd9Sstevel@tonic-gate
212*7c478bd9Sstevel@tonic-gate /*
213*7c478bd9Sstevel@tonic-gate * gethrestime() works by reading hres_last_tick, and
214*7c478bd9Sstevel@tonic-gate * adding in the current time delta (that is, the amount of
215*7c478bd9Sstevel@tonic-gate * time which has passed since the last tick of the clock).
216*7c478bd9Sstevel@tonic-gate * As a result, the time returned in "now", above, represents
217*7c478bd9Sstevel@tonic-gate * an hrestime sometime after lbolt was last bumped.
218*7c478bd9Sstevel@tonic-gate * The "ticks" we've been returned from timespectohz(), then,
219*7c478bd9Sstevel@tonic-gate * reflects the number of times the clock will tick between
220*7c478bd9Sstevel@tonic-gate * "now" and our desired execution time.
221*7c478bd9Sstevel@tonic-gate *
222*7c478bd9Sstevel@tonic-gate * However, when we call into realtime_timeout(), below,
223*7c478bd9Sstevel@tonic-gate * "ticks" will be interpreted against lbolt. That is,
224*7c478bd9Sstevel@tonic-gate * if we specify 1 tick, we will be registering a callout
225*7c478bd9Sstevel@tonic-gate * for the next tick of the clock -- which may occur in
226*7c478bd9Sstevel@tonic-gate * less than (1 / hz) seconds. More generally, we are
227*7c478bd9Sstevel@tonic-gate * registering a callout for "ticks" of the clock, which
228*7c478bd9Sstevel@tonic-gate * may be less than ("ticks" / hz) seconds (but not more than
229*7c478bd9Sstevel@tonic-gate * (1 / hz) seconds less). In other words, we may go off
230*7c478bd9Sstevel@tonic-gate * early.
231*7c478bd9Sstevel@tonic-gate *
232*7c478bd9Sstevel@tonic-gate * This is only a problem for the initial firing of the
233*7c478bd9Sstevel@tonic-gate * timer, so we have the initial firing go through a
234*7c478bd9Sstevel@tonic-gate * different handler which implements a nanosleep-esque
235*7c478bd9Sstevel@tonic-gate * algorithm.
236*7c478bd9Sstevel@tonic-gate */
237*7c478bd9Sstevel@tonic-gate *tidp = realtime_timeout(clock_realtime_fire_first, it, ticks);
238*7c478bd9Sstevel@tonic-gate }
239*7c478bd9Sstevel@tonic-gate
240*7c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock);
241*7c478bd9Sstevel@tonic-gate
242*7c478bd9Sstevel@tonic-gate return (0);
243*7c478bd9Sstevel@tonic-gate }
244*7c478bd9Sstevel@tonic-gate
245*7c478bd9Sstevel@tonic-gate static int
clock_realtime_timer_gettime(itimer_t * it,struct itimerspec * when)246*7c478bd9Sstevel@tonic-gate clock_realtime_timer_gettime(itimer_t *it, struct itimerspec *when)
247*7c478bd9Sstevel@tonic-gate {
248*7c478bd9Sstevel@tonic-gate timespec_t now;
249*7c478bd9Sstevel@tonic-gate proc_t *p = curproc;
250*7c478bd9Sstevel@tonic-gate
251*7c478bd9Sstevel@tonic-gate /*
252*7c478bd9Sstevel@tonic-gate * We always keep it_itime up to date, so we just need to snapshot
253*7c478bd9Sstevel@tonic-gate * the time under p_lock, and clean it up.
254*7c478bd9Sstevel@tonic-gate */
255*7c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock);
256*7c478bd9Sstevel@tonic-gate gethrestime(&now);
257*7c478bd9Sstevel@tonic-gate *when = it->it_itime;
258*7c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock);
259*7c478bd9Sstevel@tonic-gate
260*7c478bd9Sstevel@tonic-gate if (!timerspecisset(&when->it_value))
261*7c478bd9Sstevel@tonic-gate return (0);
262*7c478bd9Sstevel@tonic-gate
263*7c478bd9Sstevel@tonic-gate if (timerspeccmp(&when->it_value, &now) < 0) {
264*7c478bd9Sstevel@tonic-gate /*
265*7c478bd9Sstevel@tonic-gate * If this timer should have already gone off, set it_value
266*7c478bd9Sstevel@tonic-gate * to 0.
267*7c478bd9Sstevel@tonic-gate */
268*7c478bd9Sstevel@tonic-gate timerspecclear(&when->it_value);
269*7c478bd9Sstevel@tonic-gate } else {
270*7c478bd9Sstevel@tonic-gate timespecsub(&when->it_value, &now);
271*7c478bd9Sstevel@tonic-gate }
272*7c478bd9Sstevel@tonic-gate
273*7c478bd9Sstevel@tonic-gate return (0);
274*7c478bd9Sstevel@tonic-gate }
275*7c478bd9Sstevel@tonic-gate
276*7c478bd9Sstevel@tonic-gate static int
clock_realtime_timer_delete(itimer_t * it)277*7c478bd9Sstevel@tonic-gate clock_realtime_timer_delete(itimer_t *it)
278*7c478bd9Sstevel@tonic-gate {
279*7c478bd9Sstevel@tonic-gate proc_t *p = curproc;
280*7c478bd9Sstevel@tonic-gate timeout_id_t tid, *tidp = it->it_arg;
281*7c478bd9Sstevel@tonic-gate
282*7c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock);
283*7c478bd9Sstevel@tonic-gate
284*7c478bd9Sstevel@tonic-gate while ((tid = *tidp) != 0) {
285*7c478bd9Sstevel@tonic-gate *tidp = 0;
286*7c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock);
287*7c478bd9Sstevel@tonic-gate (void) untimeout(tid);
288*7c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock);
289*7c478bd9Sstevel@tonic-gate }
290*7c478bd9Sstevel@tonic-gate
291*7c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock);
292*7c478bd9Sstevel@tonic-gate
293*7c478bd9Sstevel@tonic-gate kmem_free(tidp, sizeof (timeout_id_t));
294*7c478bd9Sstevel@tonic-gate
295*7c478bd9Sstevel@tonic-gate return (0);
296*7c478bd9Sstevel@tonic-gate }
297*7c478bd9Sstevel@tonic-gate
298*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
299*7c478bd9Sstevel@tonic-gate void
clock_realtime_timer_lwpbind(itimer_t * it)300*7c478bd9Sstevel@tonic-gate clock_realtime_timer_lwpbind(itimer_t *it)
301*7c478bd9Sstevel@tonic-gate {
302*7c478bd9Sstevel@tonic-gate }
303*7c478bd9Sstevel@tonic-gate
304*7c478bd9Sstevel@tonic-gate void
clock_realtime_init()305*7c478bd9Sstevel@tonic-gate clock_realtime_init()
306*7c478bd9Sstevel@tonic-gate {
307*7c478bd9Sstevel@tonic-gate clock_backend_t *be = &clock_realtime;
308*7c478bd9Sstevel@tonic-gate struct sigevent *ev = &be->clk_default;
309*7c478bd9Sstevel@tonic-gate
310*7c478bd9Sstevel@tonic-gate ev->sigev_signo = SIGALRM;
311*7c478bd9Sstevel@tonic-gate ev->sigev_notify = SIGEV_SIGNAL;
312*7c478bd9Sstevel@tonic-gate ev->sigev_value.sival_ptr = NULL;
313*7c478bd9Sstevel@tonic-gate
314*7c478bd9Sstevel@tonic-gate be->clk_clock_settime = clock_realtime_settime;
315*7c478bd9Sstevel@tonic-gate be->clk_clock_gettime = clock_realtime_gettime;
316*7c478bd9Sstevel@tonic-gate be->clk_clock_getres = clock_realtime_getres;
317*7c478bd9Sstevel@tonic-gate be->clk_timer_gettime = clock_realtime_timer_gettime;
318*7c478bd9Sstevel@tonic-gate be->clk_timer_settime = clock_realtime_timer_settime;
319*7c478bd9Sstevel@tonic-gate be->clk_timer_delete = clock_realtime_timer_delete;
320*7c478bd9Sstevel@tonic-gate be->clk_timer_lwpbind = clock_realtime_timer_lwpbind;
321*7c478bd9Sstevel@tonic-gate be->clk_timer_create = clock_realtime_timer_create;
322*7c478bd9Sstevel@tonic-gate clock_add_backend(CLOCK_REALTIME, &clock_realtime);
323*7c478bd9Sstevel@tonic-gate /*
324*7c478bd9Sstevel@tonic-gate * For binary compatibility with old statically linked
325*7c478bd9Sstevel@tonic-gate * applications, we make the behavior of __CLOCK_REALTIME0
326*7c478bd9Sstevel@tonic-gate * the same as CLOCK_REALTIME.
327*7c478bd9Sstevel@tonic-gate */
328*7c478bd9Sstevel@tonic-gate clock_add_backend(__CLOCK_REALTIME0, &clock_realtime);
329*7c478bd9Sstevel@tonic-gate }
330