/* Returns a multiple of the size of a "struct signalfd_siginfo", or a negative error code. The "count" parameter must be at least the size of a "struct signalfd_siginfo".  */
static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
/* Returns a multiple of the size of a "struct signalfd_siginfo", or a negative error code. The "count" parameter must be at least the size of a "struct signalfd_siginfo".  */
static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
	struct signalfd_ctx *ctx = file->private_data;
	struct signalfd_siginfo __user *siginfo;
	int nonblock = file->f_flags & O_NONBLOCK;
	ssize_t ret, total = 0;
	siginfo_t info;
	count /= sizeof(struct signalfd_siginfo);
	if (!count)
		return -EINVAL;
	siginfo = (struct signalfd_siginfo __user *) buf;
	do {
		ret = signalfd_dequeue(ctx, &info, nonblock);
		if (unlikely(ret <= 0))
			break;
		ret = signalfd_copyinfo(siginfo, &info);
		if (ret < 0)
			break;
		siginfo++;
		total += ret;
		nonblock = 1;
	} while (--count);
	return total ? total: ret;
}