mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
Add test to configure to avoid using the broken poll implementation on
Mac OS X 10.4 and later, which does not support devices. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28377 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9f85884bfd
commit
01ab7f8505
4 changed files with 86 additions and 1 deletions
24
config/config.poll-dev.c
Normal file
24
config/config.poll-dev.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* Mac OS X has a native poll implementation since Mac OS X 10.4, but
|
||||
* this implementation is broken in (at least) OS X 10.4 and 10.5 in
|
||||
* that it does not support devices.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int fd, n;
|
||||
struct pollfd pollfds[1];
|
||||
|
||||
fd = open("/dev/null", O_RDONLY | O_NONBLOCK, 0);
|
||||
|
||||
pollfds[0].fd = fd;
|
||||
pollfds[0].events = POLLIN;
|
||||
n = poll(pollfds, 1, 0);
|
||||
close(fd);
|
||||
|
||||
return (n == 1 && !(pollfds[0].revents & POLLNVAL)) ? 0 : 1;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue