kern_time.c (40648) | kern_time.c (43301) |
---|---|
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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 | 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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 |
34 * $Id: kern_time.c,v 1.58 1998/06/09 13:10:53 phk Exp $ | 34 * $Id: kern_time.c,v 1.59 1998/10/25 17:44:51 phk Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/sysproto.h> 39#include <sys/resourcevar.h> 40#include <sys/signalvar.h> 41#include <sys/kernel.h> 42#include <sys/systm.h> --- 151 unchanged lines hidden (view full) --- 194 struct timespec *rqt, *rmt; 195{ 196 struct timespec ts, ts2, ts3; 197 struct timeval tv; 198 int error; 199 200 if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) 201 return (EINVAL); | 35 */ 36 37#include <sys/param.h> 38#include <sys/sysproto.h> 39#include <sys/resourcevar.h> 40#include <sys/signalvar.h> 41#include <sys/kernel.h> 42#include <sys/systm.h> --- 151 unchanged lines hidden (view full) --- 194 struct timespec *rqt, *rmt; 195{ 196 struct timespec ts, ts2, ts3; 197 struct timeval tv; 198 int error; 199 200 if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) 201 return (EINVAL); |
202 if (rqt->tv_sec < 0 || rqt->tv_sec == 0 && rqt->tv_nsec == 0) | 202 if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0)) |
203 return (0); 204 getnanouptime(&ts); 205 timespecadd(&ts, rqt); 206 TIMESPEC_TO_TIMEVAL(&tv, rqt); 207 for (;;) { 208 error = tsleep(&nanowait, PWAIT | PCATCH, "nanslp", 209 tvtohz(&tv)); 210 getnanouptime(&ts2); --- 434 unchanged lines hidden --- | 203 return (0); 204 getnanouptime(&ts); 205 timespecadd(&ts, rqt); 206 TIMESPEC_TO_TIMEVAL(&tv, rqt); 207 for (;;) { 208 error = tsleep(&nanowait, PWAIT | PCATCH, "nanslp", 209 tvtohz(&tv)); 210 getnanouptime(&ts2); --- 434 unchanged lines hidden --- |