summaryrefslogtreecommitdiff
path: root/mcon/U/d_devpoll.U
blob: 1731a3c06bc3f2816be748ff62fe04933f43fb28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 2006, Christian Biere
?RCS:
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?MAKE:d_dev_poll: Trylink cat
?MAKE:	-pick add $@ %<
?S:d_dev_poll:
?S:	This variable conditionally defines the HAS_DEV_POLL symbol, which
?S:	indicates to the C program that /dev/poll support is available.
?S:.
?C:HAS_DEV_POLL:
?C:	This symbol is defined when /dev/poll can be used.
?C:.
?H:#$d_dev_poll HAS_DEV_POLL
?H:.
?LINT: set d_dev_poll
: can we use /dev/poll?
$cat >try.c <<EOC
#include <poll.h>
#include <stropts.h>
#include <sys/devpoll.h>
int main(void)
{
  static struct pollfd pfd;
  static struct dvpoll dvp;
  static int ret;
  pfd.fd |= 1;
  pfd.events |= POLLIN;
  pfd.events |= POLLPRI;
  pfd.events |= POLLOUT;
  pfd.events |= POLLHUP;
  pfd.events |= POLLERR;
  pfd.events |= POLLNVAL;
  pfd.events |= POLLREMOVE;
  pfd.revents |= 1;
  dvp.dp_timeout |= 1;
  dvp.dp_nfds |= 1;
  dvp.dp_fds = &pfd;
  ret |= ioctl(1, DP_POLL, &dvp);
  return 0 != ret;
}
EOC
cyn="whether /dev/poll can be used"
set d_dev_poll
eval $trylink