ntptime.c (0:68f95e015346) ntptime.c (5802:0a3342d4ad49)
1/*
1/*
2 * Copyright 1994,1996-2003 Sun Microsystems, Inc. All rights reserved.
2 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6/*
7 * Copyright (c) David L. Mills 1993, 1994
8 *
9 * Permission to use, copy, modify, and distribute this software and its
10 * documentation for any purpose and without fee is hereby granted, provided

--- 145 unchanged lines hidden (view full) ---

156
157 if (modes != 0 && secpolicy_settime(CRED()) != 0)
158 return (set_errno(EPERM));
159
160 if (ntv.constant < 0 || ntv.constant > 30)
161 return (set_errno(EINVAL));
162
163 mutex_enter(&tod_lock);
3 * Use is subject to license terms.
4 */
5
6/*
7 * Copyright (c) David L. Mills 1993, 1994
8 *
9 * Permission to use, copy, modify, and distribute this software and its
10 * documentation for any purpose and without fee is hereby granted, provided

--- 145 unchanged lines hidden (view full) ---

156
157 if (modes != 0 && secpolicy_settime(CRED()) != 0)
158 return (set_errno(EPERM));
159
160 if (ntv.constant < 0 || ntv.constant > 30)
161 return (set_errno(EINVAL));
162
163 mutex_enter(&tod_lock);
164 if (modes & MOD_FREQUENCY)
165 time_freq = ntv.freq - pps_freq;
166 if (modes & MOD_MAXERROR)
167 time_maxerror = ntv.maxerror;
168 if (modes & MOD_ESTERROR)
169 time_esterror = ntv.esterror;
170 if (modes & MOD_STATUS) {
171 time_status &= STA_RONLY;
172 time_status |= ntv.status & ~STA_RONLY;
173 }
174 if (modes & MOD_TIMECONST)
175 time_constant = ntv.constant;
164 if (modes & MOD_MAXERROR)
165 time_maxerror = ntv.maxerror;
166 if (modes & MOD_ESTERROR)
167 time_esterror = ntv.esterror;
168 if (modes & MOD_STATUS) {
169 time_status &= STA_RONLY;
170 time_status |= ntv.status & ~STA_RONLY;
171 }
172 if (modes & MOD_TIMECONST)
173 time_constant = ntv.constant;
176
177 if (modes & MOD_OFFSET)
178 clock_update(ntv.offset);
174 if (modes & MOD_OFFSET)
175 clock_update(ntv.offset);
179
176 if (modes & MOD_FREQUENCY)
177 time_freq = ntv.freq - pps_freq;
180 /*
181 * Retrieve all clock variables
182 */
183 ntv.offset = time_offset / SCALE_UPDATE;
184 ntv.freq = time_freq + pps_freq;
185 ntv.maxerror = time_maxerror;
186 ntv.esterror = time_esterror;
187 ntv.status = time_status;

--- 31 unchanged lines hidden ---
178 /*
179 * Retrieve all clock variables
180 */
181 ntv.offset = time_offset / SCALE_UPDATE;
182 ntv.freq = time_freq + pps_freq;
183 ntv.maxerror = time_maxerror;
184 ntv.esterror = time_esterror;
185 ntv.status = time_status;

--- 31 unchanged lines hidden ---