usleep.c (165903) | usleep.c (200150) |
---|---|
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 --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> | 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 --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/lib/libc/gen/usleep.c 165903 2007-01-09 00:28:16Z imp $"); | 34__FBSDID("$FreeBSD: head/lib/libc/gen/usleep.c 200150 2009-12-05 19:31:38Z ed $"); |
35 36#include "namespace.h" 37#include <time.h> 38#include <unistd.h> 39#include "un-namespace.h" 40 41int | 35 36#include "namespace.h" 37#include <time.h> 38#include <unistd.h> 39#include "un-namespace.h" 40 41int |
42__usleep(useconds) 43 useconds_t useconds; | 42__usleep(useconds_t useconds) |
44{ 45 struct timespec time_to_sleep; 46 47 time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; 48 time_to_sleep.tv_sec = useconds / 1000000; 49 return (_nanosleep(&time_to_sleep, NULL)); 50} 51 52__weak_reference(__usleep, usleep); 53__weak_reference(__usleep, _usleep); | 43{ 44 struct timespec time_to_sleep; 45 46 time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; 47 time_to_sleep.tv_sec = useconds / 1000000; 48 return (_nanosleep(&time_to_sleep, NULL)); 49} 50 51__weak_reference(__usleep, usleep); 52__weak_reference(__usleep, _usleep); |