Hello,
This is my first post here. The following question was asked, by me, at the StackOverflow wqeb-site. Some days have passed and the qustion did not get enough attention and not a line of text of answer. So I think it is more appropriate to post it here. I should mention that, there is a possibility, that I've already asked this question. But I can not find any references to it in this forum, nor on SO.
Follow is the code that I do to read signalfd:
sock_read is a function that adds number of bytes read to the usual
read call. It also does some error checks and interrupt restarts.
Code:
if((status = sock_read(fd, sigbuf, sizeof(struct signalfd_siginfo) - rb, &n)) < 0) {
if(status != SOCK_EAGAIN){
return status;
}
}
if(0 == status){
return 0; /* can read return zero with signalfd ? */
}
if((rb + n) < sizeof(struct signalfd_siginfo)){
rb += n;
return 0;
}
I will make it short. Can read from
signalfd return data in not-a-multiple of
sizeof(struct signalfd_siginfo)?
And as a subquestion, will
read normally return zero?
P.S I understand that read may return
ENOMEM(or similar). I think that in the
signalfd case, the memory gets passed as is, without some use of lists, buffers and such. But I have zero experience with the following a Linux kernel source code. So this is only my opinion of the way data gets passed.