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:
@@ -11,9 +11,8 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
#define CLOCKS_PER_SEC_BEOS 1000
|
#define CLOCKS_PER_SEC_BEOS 1000
|
||||||
#define CLK_TCK_BEOS CLOCKS_PER_SEC_BEOS
|
#define CLK_TCK_BEOS CLOCKS_PER_SEC_BEOS
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <StackOrHeapArray.h>
|
#include <StackOrHeapArray.h>
|
||||||
|
|
||||||
#include <libroot/errno_private.h>
|
#include <libroot/errno_private.h>
|
||||||
|
#include <libroot/time_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <event_queue_defs.h>
|
#include <event_queue_defs.h>
|
||||||
|
|
||||||
@@ -187,7 +188,10 @@ kevent(int kq,
|
|||||||
bigtime_t timeout = 0;
|
bigtime_t timeout = 0;
|
||||||
uint32 waitFlags = 0;
|
uint32 waitFlags = 0;
|
||||||
if (tspec != NULL) {
|
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;
|
waitFlags |= B_RELATIVE_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user