mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
libbsd: Use timespec_to_bigtime for time conversions in kqueue.
The FreeBSD manpage indicates that it will fail with EINVAL if an invalid timespec is passed.
This commit is contained in:
parent
6a2d53e723
commit
cf5249749d
@ -11,9 +11,8 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#define CLOCKS_PER_SEC_BEOS 1000
|
||||
#define CLK_TCK_BEOS CLOCKS_PER_SEC_BEOS
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <StackOrHeapArray.h>
|
||||
|
||||
#include <libroot/errno_private.h>
|
||||
#include <libroot/time_private.h>
|
||||
#include <syscalls.h>
|
||||
#include <event_queue_defs.h>
|
||||
|
||||
@ -187,7 +188,10 @@ kevent(int kq,
|
||||
bigtime_t timeout = 0;
|
||||
uint32 waitFlags = 0;
|
||||
if (tspec != NULL) {
|
||||
timeout = (tspec->tv_sec * 1000000LL) + (tspec->tv_nsec / 1000LL);
|
||||
if (!timespec_to_bigtime(*tspec, timeout)) {
|
||||
__set_errno(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
waitFlags |= B_RELATIVE_TIMEOUT;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user