int
kqueue(void)
{
	/*
		The kqueue identifier is opaque, so lets just return
		the epoll's descriptor.
	 */
	return epoll_create$LINUX(0);
}
int lll_futex_wake(OSLowLock* futex,
				   int value)
{
	return futex$LINUX(futex,
					   FUTEX_WAKE,
					   value,
					   NULL,
					   NULL,
					   0);
}
int lll_futex_timed_wait(OSLowLock* futex,
						 int value,
						 const struct timespec *timeout)
{
	/*
		If this is ever called in single threaded mode, the
		application will hang up (as this will become a deadlock).
	 */
	
	//OSLog("lll_futex_timed_wait: %p", futex);
	
	return futex$LINUX(futex,
					   FUTEX_WAIT,
					   value,
					   timeout,
					   NULL,
					   0);
}
Esempio n. 4
0
static int
verify_paddr(physaddr_t paddr)
{
	int i, ok;

	if (!machdep->verify_paddr(paddr))
		return FALSE;

	if (!nr_segments)
		return TRUE;

	for (i = ok = 0; i < nr_segments; i++) {
		if ((paddr >= ram_segments[i].start) &&
		    (paddr < ram_segments[i].end)) {
			ok++;
			break;
		}
	}

	/*
	 *  Pre-2.6.13 x86_64 /proc/iomem was restricted to 4GB,
	 *  so just accept it.
	 */
	if ((paddr >= 0x100000000ULL) &&
	    machine_type("X86_64") &&
	    (THIS_KERNEL_VERSION < LINUX(2,6,13)))
		ok++;

	if (!ok) {
		if (CRASHDEBUG(1))
			console("reject: %llx\n", (ulonglong)paddr);
		return FALSE;
	}
	
	return TRUE;
}
Esempio n. 5
0
static inline clock_t clock_now(void)
{
	struct timespec tm;
	clock_gettime$LINUX( CLOCK_MONOTONIC, &tm);
	return tm.tv_sec * CLOCKS_PER_SEC + (tm.tv_nsec * (CLOCKS_PER_SEC/1e9));
}
Esempio n. 6
0
	struct timespec tm;
	clock_gettime$LINUX( CLOCK_MONOTONIC, &tm);
	return tm.tv_sec * CLOCKS_PER_SEC + (tm.tv_nsec * (CLOCKS_PER_SEC/1e9));
}

void _time_init(void) {
	clock_start = clock_now();
}

int
gettimeofday(struct timeval *restrict tp, void *restrict tzp)
{
	//OSLogLib("time", "gettimeofday(%p, %p)", tp, tzp);
	
	linux_timeval_t timeval;
	int ret = gettimeofday$LINUX(&timeval, tzp);
	
	tp->tv_sec = timeval.tv_sec;
	tp->tv_usec = (int)timeval.tv_usec;
	
	return ret;
}

time_t
time(time_t *t)
{
	struct timeval tt;
	
	if (gettimeofday(&tt, (struct timezone *)0) < 0)
		return (-1);
	if (t)