Zbr's days.
August
Sun Mon Tue Wed Thu Fri Sat
         
30
31            
2008
Months
AugSep
Oct Nov Dec

About TODO Blog RSS Old blog Projects Gallery Notes

Tue, 13 Mar 2007

signalfd/timerfd patches by Davide Libenzi.


Ok, some time after I posted first version of eventfs, Davide Libenzi has posted his version for signalfd system call (created originally by Linus Torvalds), which ended up in a big discussion and subsequent three releases, which now includes code for timers too. My implementation is smaller and uses completely different idea - signal file descriptor is processed before signal is posted into signal mask, so it eliminates some issues and simplifies code.
My implementation does not require additional steps to run in your code (like blocking of the signal to be delivered through file descriptor as in Linus' variant), and nevertheless I got zero responses on it although a lot of people including Linus and Davide were in Cc list.
I call it NIH syndrome and it does demotivate me from doing anything related to generic Linux code.

I got that news via LWN:kernel news line.

Eventfs and kevent projects are officially closed. I want to specially thank David Miller, Zach Brown, Johann Borck, Jonathan Corbet and all other people for theirs time.

/devel/eventfs :: Link / Comments (0)


Wed, 07 Mar 2007

First release of the eventfs.


Eventfs - pseudo FS which allows to bind file descriptors to events.

One can bind signal and other events (currently only signals are supported) and poll them using epoll().

It is heavily based on ideas from kevent project.

I've sent to linux-kernel@ and hackers who participated in kevent discussion.
Let's see where this will end up.

/devel/eventfs :: Link / Comments (0)


Eventfs.


This is a prototype of the pseudo filesystem created to bind different events and epoll().
I will implement only signal biding (and maybe POSIX timers binding), that's all - if there will be no feedback like with kevent, this will be dropped from the start - I will better continue implementation of the scalable socket lookup.

Basic idea is to provide set of syscalls, which will get object id (like signal number) and private data pointer and private kernel interface (used for example by POSIX timers), which will end up allocating new file structure and descriptor with appropriate ->poll() callback, which can be used by epoll().

So far it looks like I've found a race in Linux signal handling, which can lead to the lost signals setup.
Consider following code in do_sigaction() (called from signal() for example):

int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
{
	struct k_sigaction *k;
	sigset_t mask;

	if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig)))
		return -EINVAL;

	k = ¤t->sighand->action[sig-1];

	spin_lock_irq(¤t->sighand->siglock);
	...
		*k = *act;
	...
	spin_lock_irq(¤t->sighand->siglock);
	return 0;
}
If signal() or sigaction() is called from signal handler just before spin_lock_irq(), it will not take any effect, since the same action will be overwritten in a process after handler is completed. Man page says that both signal() and sigaction() are signal safe functions.

/devel/eventfs :: Link / Comments (0)