Re: [patch/rfc] Make poll/select report error (POLLNVAL and EBADF)for unsupported files

From: THIELL Stephane
Date: Wed Feb 17 2010 - 13:01:52 EST



On Mon, 15 Feb 2010, Eric Dumazet wrote:

Hmm, according to POSIX :

The poll() function shall support regular files, terminal and
pseudo-terminal devices, FIFOs, pipes, sockets ...

Regular files shall always poll TRUE for reading and writing.

As POSIX says poll(2) have to support regular files (and it seems all possible user file descriptors), then wouldn't it be better/more coherent to have epoll(7) behave the same way (ie. support regular files instead of epoll_ctl(2) returning EPERM), in order to allow generic code handling both very common situations like:

$ cat replay_file | application
and
$ application < replay_file

...where for instance the application doesn't know the origine of its fd 0 (pipe, file, or something else).

Regards,
Stephane Thiell




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