File: poll.c

package info (click to toggle)
mlton 20100608-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 36,624 kB
  • sloc: ansic: 18,441; lisp: 2,879; makefile: 1,572; sh: 1,326; pascal: 256; asm: 97
file content (22 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "platform.h"

C_Errno_t(C_Int_t) 
OS_IO_poll (Vector(C_Fd_t) fds, 
            Vector(C_Short_t) eventss, 
            C_NFds_t n, 
            C_Int_t timeout, 
            Array(C_Short_t) reventss) {
  unsigned int i;
  int res;
  struct pollfd ufds[n];

  for (i = 0; i < n; i++) {
    ufds[i].fd = ((const int*)fds)[i];
    ufds[i].events = ((const short*)eventss)[i];
  }
  res = poll (ufds, n, timeout);
  for (i = 0; i < n; i++) {
    ((short*)reventss)[i] = ufds[i].revents;
  }
  return res;
}