lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sat, 13 Dec 2008 10:39:13 -0800 (PST)
From:	Davide Libenzi <davidel@...ilserver.org>
To:	Scott James Remnant <scott@...split.com>
cc:	Casey Dahlin <cdahlin@...hat.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] waitfd: file descriptor to wait on child processes

On Sat, 13 Dec 2008, Scott James Remnant wrote:

> On Fri, 2008-12-12 at 20:29 -0800, Davide Libenzi wrote:
> 
> > And how about this?
> > 
> > 	sfd = signalfd(SIGCHLD);
> > 
> > 	for (;;) {
> > 		poll(sfd, POLLIN);
> > 		while ((pid = waitpid(0, &status, WNOHANG)) != -1)
> > 			process_child_death(pid);
> > 	}
> > 
> At this point, why have signalfd()'s read() return siginfo_t at all?
> 
> You have to discard the entire information since it's only ever the
> first signal that matched, all subsequent ones are thrown away.

Signalfd is a wakeup gate available to the poll/select/epoll subsystems.
Signals that are queued inside the kernel, get de-queueing behavior, while 
signals that are overlapping, get overlapping behavior.
The code above enable you to wait for signals inside a poll/select/epoll 
dispatch loop, and get all the info waitpid() can return to you - w/out 
missing anything.
In a real app case, you're probably waiting for more than simple SIGCHLD, 
so you likely will have one (or more) read(2) of the signalfd to find out 
which signal you got, and do the waitpid(WNOHANG) loop in case of SIGCHLD.



- Davide


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ