usleep.c (71579) | usleep.c (90039) |
---|---|
1/* 2 * Copyright (c) 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 --- 18 unchanged lines hidden (view full) --- 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 34#if defined(LIBC_SCCS) && !defined(lint) | 1/* 2 * Copyright (c) 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 --- 18 unchanged lines hidden (view full) --- 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 34#if defined(LIBC_SCCS) && !defined(lint) |
35#if 0 | |
36static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93"; | 35static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93"; |
37#endif 38static char rcsid[] = 39 "$FreeBSD: head/lib/libc/gen/usleep.c 71579 2001-01-24 13:01:12Z deischen $"; | |
40#endif /* LIBC_SCCS and not lint */ | 36#endif /* LIBC_SCCS and not lint */ |
37#include <sys/cdefs.h> 38__FBSDID("$FreeBSD: head/lib/libc/gen/usleep.c 90039 2002-02-01 00:57:29Z obrien $"); |
|
41 42#include "namespace.h" 43#include <time.h> 44#include <unistd.h> 45#include "un-namespace.h" 46 47int 48usleep(useconds) 49 unsigned int useconds; 50{ 51 struct timespec time_to_sleep; 52 53 time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; 54 time_to_sleep.tv_sec = useconds / 1000000; 55 return (_nanosleep(&time_to_sleep, NULL)); 56} | 39 40#include "namespace.h" 41#include <time.h> 42#include <unistd.h> 43#include "un-namespace.h" 44 45int 46usleep(useconds) 47 unsigned int useconds; 48{ 49 struct timespec time_to_sleep; 50 51 time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; 52 time_to_sleep.tv_sec = useconds / 1000000; 53 return (_nanosleep(&time_to_sleep, NULL)); 54} |