libdl: first execute all destructors, then munmap library
[uclibc-ng.git] / libc / unistd / ualarm.c
blob82eb972b214ee8ce61e7afe4c41ea440ee0d30b4
1 /*
2 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5 */
7 #include <time.h>
8 #include <sys/time.h>
9 #include <sys/types.h>
10 #include <unistd.h>
13 useconds_t ualarm(useconds_t value, useconds_t interval)
15 struct itimerval otimer;
16 const struct itimerval itimer = {
17 { 0, interval },
18 { 0, value}
21 if (setitimer(ITIMER_REAL, &itimer, &otimer) < 0) {
22 return -1;
24 return((otimer.it_value.tv_sec * 1000000) + otimer.it_value.tv_usec);