Re: poll (3) (WAS select (3))

2016-04-30 Thread Kaare Rasmussen
Den 01-05-2016 kl. 01:54 skrev Brandon Allbery: In fact, this is currently being discussed in IRC: OK; seems there's a way out. Thanks for the info; I'll look into it the next time I have a spare moment. /kaare

Re: poll (3) (WAS select (3))

2016-04-30 Thread Brandon Allbery
On Sat, Apr 30, 2016 at 7:49 PM, Brandon Allbery wrote: > On Sat, Apr 30, 2016 at 3:05 PM, Kaare Rasmussen wrote: > >> sub poll(CArray[Pollfd], uint64, uint32) returns int32 is native { * } > > > This, unfortunately, means an array of pointers to Pollfd

Re: poll (3) (WAS select (3))

2016-04-30 Thread Brandon Allbery
On Sat, Apr 30, 2016 at 3:05 PM, Kaare Rasmussen wrote: > sub poll(CArray[Pollfd], uint64, uint32) returns int32 is native { * } This, unfortunately, means an array of pointers to Pollfd structs, not an array of Pollfd structs. NativeCall doesn't support the latter currently,

poll (3) (WAS select (3))

2016-04-30 Thread Kaare Rasmussen
Den 30-04-2016 kl. 19:14 skrev Kaare Rasmussen: select(3) is an abysmal API. There's a reason most OSes replaced select(2) with a backward compatibility select(3) and moved on to something poll-like (look for poll(2) or epoll(2)). Well, it's not that I fare better with poll

Re: select (3)

2016-04-30 Thread Kaare Rasmussen
as a bit buffer. Well, thanks for your responses. select(3) is an abysmal API. There's a reason most OSes replaced select(2) with a backward compatibility select(3) and moved on to something poll-like (look for poll(2) or epoll(2)). I know. It's just that select looked simple enough to try out

Re: select (3)

2016-04-30 Thread Brandon Allbery
them by hand. Which leads to... select(3) is an abysmal API. There's a reason most OSes replaced select(2) with a backward compatibility select(3) and moved on to something poll-like (look for poll(2) or epoll(2)). -- brandon s allbery kf8nh sine nomine assoc

Re: select (3)

2016-04-30 Thread Kaare Rasmussen
Den 30-04-2016 kl. 15:57 skrev Brandon Allbery: Note that "nfds" is the highest fd number to check for, plus one. For the naïve implementation, you need to add one here. Right, it wasn't in this example, but it doesn't matter much. my $readfds = CArray[uint8].new(0, 2); What is this

Re: select (3)

2016-04-30 Thread Brandon Allbery
On Sat, Apr 30, 2016 at 4:35 AM, Kaare Rasmussen wrote: > my $nfds = dup(0); > Note that "nfds" is the highest fd number to check for, plus one. For the naïve implementation, you need to add one here. my $readfds = CArray[uint8].new(0, 2); > What is this initialized to? The

Re: select (3)

2016-04-30 Thread Kaare Rasmussen
Den 30-04-2016 kl. 10:35 skrev Kaare Rasmussen: Variations over [2] give inconclusive results, so I know I'm doing something (probably very basic) wrong. But what? The current incancation tries to dup the STDIN fd to 14, which should be the second last bit in the 2nd uint8. But I've tried

select (3)

2016-04-30 Thread Kaare Rasmussen
Hi I've been playing on and off with the system call select (3) (http://linux.die.net/man/3/select) in order to learn a bit Perl 6 and NativeCall. But I get no traction, so I'd like to know what I'm doing wrong. Before I start I'd like to wonder a little about the fd usage of moar. Perl 5