Why not to use a socket (Unix socket or TCP/IP socket), push your
"0123456789" in one side and retrieve the same from the other side?
You'll need different code to open/close the socket, but writing/reading
will look the same.
--- Omer
On Wed, 2013-06-19 at 09:01 +0300, Elazar Leibovich wrote:
I think I didn't explain myself correctly, so let me give a different
example.
Let's make a file descriptor that counts to 9.
I.e, we want to emulate the behavior:
int fd = make_counter_fd();
assert(write(fd, buf, 100) == 11);
assert(strcmp(buf, "0123456789") == 0);
Let me describe a
On 18/06/13 22:16, Elazar Leibovich wrote:
> I'm using it as a fake "always non-blocking" file descriptor.
>
> My main libevent-like poll loop looks like:
>
> poll(fds)
> for fd in fds:
>if fd.revents | POLLIN:
>fd.read_callback()
>if fd.revents | POLLOUT:
>
I'm using it as a fake "always non-blocking" file descriptor.
My main libevent-like poll loop looks like:
poll(fds)
for fd in fds:
if fd.revents | POLLIN:
fd.read_callback()
if fd.revents | POLLOUT:
fd.write_callback()
Now let's say I want a fake filed
Damn I missed that.
To my defense, this bug should be also mentioned in the POLLNVAL section.
As it stands now, it looks like the only reason for POLLNVAL is a closed
file descriptor.
Sorry and thanks.
On Tue, Jun 18, 2013 at 6:09 PM, Oleg Goldshmidt wrote:
> Elazar Leibovich writes:
>
> > T
On 18/06/13 17:43, Elazar Leibovich wrote:
> Try to open /dev/null, and then to poll the file descriptor. Neither
> in the man page nor in the standard I see anything preventing you to
> poll on /dev/null, yet, it does not work on Mac OS X. You get a POLLNVAL.
>
Under Linux, whether you can poll (e
Elazar Leibovich writes:
> Try to open /dev/null, and then to poll the file descriptor. Neither
> in the man page nor in the standard I see anything preventing you to
> poll on /dev/null, yet, it does not work on Mac OS X. You get a
> POLLNVAL.
>From
>http://developer.apple.com/library/mac/#doc
Try to open /dev/null, and then to poll the file descriptor. Neither in the
man page nor in the standard I see anything preventing you to poll on
/dev/null, yet, it does not work on Mac OS X. You get a POLLNVAL.
Run the following:
https://gist.github.com/elazarl/5805848
#include
#include
#inc