Re: poll() returns even if there is data.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 23, 2010 at 10:01 AM, Mansuri, Wasim (NSN - IN/Bangalore)
<wasim.mansuri@xxxxxxx> wrote:
> Here in my code I am doing open than poll and if poll returns with the event POLLIN than read.
> Even if poll returns with the event POLLIN read returns 0, that means no data.
>
<snip>
> I am pasting code snip below.
>
>  if((fd = open(fileName,O_RDONLY))==-1){
>            printf("File opened Failed errno=%d\n",errno);
>            return (0);
>    }
>
>    loc = lseek(fd,0,SEEK_END);

This is your culprit. you're seeking to the end of the file, which
will ensure that your read will result in an EOF.

> poll returned with ret = 1, events = 1, revents=1, errno =0
> Read Failed on /var/log/messages with retValue = 0 Errno = 0


-- 
Siddhesh Poyarekar
http://siddhesh.in
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux