Linux-FD

 view release on metacpan or  search on metacpan

lib/Linux/FD.xs  view on Meta::CPAN

	CODE:
		for (i = 2; i < items; i++)
			flags |= get_timer_flag(ST(i));
		RETVAL = new_timerfd(classname, clock, flags, "Linux::FD::Timer->new");
	OUTPUT:
		RETVAL

void get_timeout(Fd timerfd)
	PREINIT:
		struct itimerspec value;
	PPCODE:
		if (timerfd_gettime(timerfd, &value) == -1)
			die_sys("Couldn't get_timeout: %s");
		mXPUSHn(timespec_to_nv(&value.it_value));
		if (GIMME_V == G_ARRAY)
			mXPUSHn(timespec_to_nv(&value.it_interval));

SV* set_timeout(Fd timerfd, struct timespec new_value, struct timespec new_interval = NEVER, bool abstime = FALSE)
	PREINIT:
		struct itimerspec new_itimer, old_itimer;
	PPCODE:
		new_itimer.it_value = new_value;
		new_itimer.it_interval = new_interval;
		if (timerfd_settime(timerfd, (abstime ? TIMER_ABSTIME : 0), &new_itimer, &old_itimer) == -1)
			die_sys("Couldn't set_timeout: %s");
		mXPUSHn(timespec_to_nv(&old_itimer.it_value));
		if (GIMME_V == G_ARRAY)
			mXPUSHn(timespec_to_nv(&old_itimer.it_interval));

IV receive(Fd timerfd)
	PREINIT:

lib/Linux/FD.xs  view on Meta::CPAN

			else
				die_sys("Couldn't read from timerfd: %s");
		}
		RETVAL = buffer;
	OUTPUT:
		RETVAL

void clocks(SV* classname)
	INIT:
	int i;
	PPCODE:
	for (i = 0; i < sizeof clocks / sizeof *clocks; ++i)
		mXPUSHp(clocks[i].key, clocks[i].length);



( run in 0.836 second using v1.01-cache-2.11-cpan-5511b514fd6 )