X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/5d5c5d0d5b79ade9a973d55186ffda2638ba2b6e..3903760236c30e3b5ace7a4eefac3a269d68957c:/osfmk/kern/clock_oldops.c diff --git a/osfmk/kern/clock_oldops.c b/osfmk/kern/clock_oldops.c index 70cacf28b..a3debc0d9 100644 --- a/osfmk/kern/clock_oldops.c +++ b/osfmk/kern/clock_oldops.c @@ -1,31 +1,29 @@ /* - * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2008 Apple Inc. All rights reserved. * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the - * License may not be used to create, or enable the creation or - * redistribution of, unlawful or unlicensed copies of an Apple operating - * system, or to circumvent, violate, or enable the circumvention or - * violation of, any terms of an Apple operating system software license - * agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ @@ -41,7 +39,6 @@ #include -#include #include #include #include @@ -130,8 +127,6 @@ static kern_return_t clock_sleep_internal( sleep_type_t sleep_type, mach_timespec_t *sleep_time); -int rtclock_config(void); - int rtclock_init(void); kern_return_t rtclock_gettime( @@ -143,7 +138,7 @@ kern_return_t rtclock_getattr( mach_msg_type_number_t *count); struct clock_ops sysclk_ops = { - rtclock_config, rtclock_init, + NULL, rtclock_init, rtclock_gettime, rtclock_getattr, }; @@ -157,7 +152,7 @@ kern_return_t calend_getattr( mach_msg_type_number_t *count); struct clock_ops calend_ops = { - 0, 0, + NULL, NULL, calend_gettime, calend_getattr, }; @@ -177,7 +172,7 @@ void clock_oldconfig(void) { clock_t clock; - register int i; + int i; simple_lock_init(&alarm_lock, 0); thread_call_setup(&alarm_done_call, (thread_call_func_t)alarm_done, NULL); @@ -190,7 +185,7 @@ clock_oldconfig(void) clock = &clock_list[i]; if (clock->cl_ops && clock->cl_ops->c_config) { if ((*clock->cl_ops->c_config)() == 0) - clock->cl_ops = 0; + clock->cl_ops = NULL; } } @@ -202,7 +197,7 @@ void clock_oldinit(void) { clock_t clock; - register int i; + int i; /* * Initialize basic clock structures. @@ -221,7 +216,7 @@ void clock_service_create(void) { clock_t clock; - register int i; + int i; /* * Initialize ipc clock services. @@ -300,7 +295,12 @@ kern_return_t rtclock_gettime( mach_timespec_t *time) /* OUT */ { - clock_get_system_nanotime(&time->tv_sec, (uint32_t *)&time->tv_nsec); + clock_sec_t secs; + clock_nsec_t nsecs; + + clock_get_system_nanotime(&secs, &nsecs); + time->tv_sec = (unsigned int)secs; + time->tv_nsec = nsecs; return (KERN_SUCCESS); } @@ -309,7 +309,12 @@ kern_return_t calend_gettime( mach_timespec_t *time) /* OUT */ { - clock_get_calendar_nanotime(&time->tv_sec, (uint32_t *)&time->tv_nsec); + clock_sec_t secs; + clock_nsec_t nsecs; + + clock_get_calendar_nanotime(&secs, &nsecs); + time->tv_sec = (unsigned int)secs; + time->tv_nsec = nsecs; return (KERN_SUCCESS); } @@ -615,8 +620,8 @@ static void alarm_expire(void) { clock_t clock; - register alarm_t alrm1; - register alarm_t alrm2; + alarm_t alrm1; + alarm_t alrm2; mach_timespec_t clock_time; mach_timespec_t *alarm_time; spl_t s; @@ -647,7 +652,7 @@ alarm_expire(void) * which issued the clock_sleep() call. */ if (alrm2->al_status == ALARM_SLEEP) { - alrm2->al_next = 0; + alrm2->al_next = NULL; alrm2->al_status = ALARM_DONE; alrm2->al_time = clock_time; thread_wakeup((event_t)alrm2); @@ -682,7 +687,7 @@ alarm_expire(void) static void alarm_done(void) { - register alarm_t alrm; + alarm_t alrm; kern_return_t code; spl_t s; @@ -721,7 +726,7 @@ static void post_alarm( alarm_t alarm) { - register alarm_t alrm1, alrm2; + alarm_t alrm1, alrm2; mach_timespec_t *alarm_time; mach_timespec_t *queue_time; @@ -758,7 +763,7 @@ set_alarm( uint64_t abstime; nanotime_to_absolutetime(alarm_time->tv_sec, alarm_time->tv_nsec, &abstime); - timer_call_enter(&alarm_expire_timer, abstime); + timer_call_enter_with_leeway(&alarm_expire_timer, NULL, abstime, 0, TIMER_CALL_USER_NORMAL, FALSE); } /* @@ -787,6 +792,8 @@ check_time( return ((result >= 0)? result: 0); } +#ifndef __LP64__ + mach_timespec_t clock_get_system_value(void) { @@ -808,3 +815,5 @@ clock_get_calendar_value(void) return value; } + +#endif /* __LP64__ */