Deleted Added
full compact
kern_time.c (139804) kern_time.c (140481)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/kern_time.c 139804 2005-01-06 23:35:40Z imp $");
33__FBSDID("$FreeBSD: head/sys/kern/kern_time.c 140481 2005-01-19 17:44:59Z ps $");
34
35#include "opt_mac.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/lock.h>
40#include <sys/mutex.h>
41#include <sys/sysproto.h>

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

60 *
61 * These routines provide the kernel entry points to get and set
62 * the time-of-day and per-process interval timers. Subroutines
63 * here provide support for adding and subtracting timeval structures
64 * and decrementing interval timers, optionally reloading the interval
65 * timers when they expire.
66 */
67
34
35#include "opt_mac.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/lock.h>
40#include <sys/mutex.h>
41#include <sys/sysproto.h>

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

60 *
61 * These routines provide the kernel entry points to get and set
62 * the time-of-day and per-process interval timers. Subroutines
63 * here provide support for adding and subtracting timeval structures
64 * and decrementing interval timers, optionally reloading the interval
65 * timers when they expire.
66 */
67
68static int nanosleep1(struct thread *td, struct timespec *rqt,
69 struct timespec *rmt);
70static int settime(struct thread *, struct timeval *);
71static void timevalfix(struct timeval *);
72static void no_lease_updatetime(int);
73
74static void
75no_lease_updatetime(deltat)
76 int deltat;
77{

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

256 }
257 if (uap->tp == NULL)
258 return (0);
259 return (copyout(&ts, uap->tp, sizeof(ts)));
260}
261
262static int nanowait;
263
68static int settime(struct thread *, struct timeval *);
69static void timevalfix(struct timeval *);
70static void no_lease_updatetime(int);
71
72static void
73no_lease_updatetime(deltat)
74 int deltat;
75{

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

254 }
255 if (uap->tp == NULL)
256 return (0);
257 return (copyout(&ts, uap->tp, sizeof(ts)));
258}
259
260static int nanowait;
261
264static int
265nanosleep1(struct thread *td, struct timespec *rqt, struct timespec *rmt)
262int
263kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt)
266{
267 struct timespec ts, ts2, ts3;
268 struct timeval tv;
269 int error;
270
271 if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000)
272 return (EINVAL);
273 if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0))

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

317
318 error = copyin(uap->rqtp, &rqt, sizeof(rqt));
319 if (error)
320 return (error);
321
322 if (uap->rmtp &&
323 !useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
324 return (EFAULT);
264{
265 struct timespec ts, ts2, ts3;
266 struct timeval tv;
267 int error;
268
269 if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000)
270 return (EINVAL);
271 if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0))

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

315
316 error = copyin(uap->rqtp, &rqt, sizeof(rqt));
317 if (error)
318 return (error);
319
320 if (uap->rmtp &&
321 !useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
322 return (EFAULT);
325 error = nanosleep1(td, &rqt, &rmt);
323 error = kern_nanosleep(td, &rqt, &rmt);
326 if (error && uap->rmtp) {
327 int error2;
328
329 error2 = copyout(&rmt, uap->rmtp, sizeof(rmt));
330 if (error2)
331 error = error2;
332 }
333 return (error);

--- 404 unchanged lines hidden ---
324 if (error && uap->rmtp) {
325 int error2;
326
327 error2 = copyout(&rmt, uap->rmtp, sizeof(rmt));
328 if (error2)
329 error = error2;
330 }
331 return (error);

--- 404 unchanged lines hidden ---