root/src/eventer/eventer_POSIX_fd_opset.c

Revision 01751d3c6a2df6acc30c50e9cd1cce9064262450, 1.0 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

still nothing working, but substantially more plumbing

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2007, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  */
5
6 #include "noit_defines.h"
7 #include "eventer/eventer.h"
8
9 #include <sys/socket.h>
10
11 static int
12 POSIX_accept(int fd, struct sockaddr *addr, socklen_t *len,
13              int *mask, void *closure) {
14   *mask = EVENTER_READ | EVENTER_EXCEPTION;
15   return accept(fd, addr, len);
16 }
17
18 static int
19 POSIX_read(int fd, void *buffer, size_t len,
20            int *mask, void *closure) {
21   *mask = EVENTER_READ | EVENTER_EXCEPTION;
22   return read(fd, buffer, len);
23 }
24
25 static int
26 POSIX_write(int fd, const void *buffer, size_t len,
27             int *mask, void *closure) {
28   *mask = EVENTER_WRITE | EVENTER_EXCEPTION;
29   return write(fd, buffer, len);
30 }
31
32 static int
33 POSIX_close(int fd,
34             int *mask, void *closure) {
35   *mask = 0;
36   return close(fd);
37 }
38
39 struct _fd_opset _eventer_POSIX_fd_opset = {
40   POSIX_accept,
41   POSIX_read,
42   POSIX_write,
43   POSIX_close
44 };
45
46 eventer_fd_opset_t eventer_POSIX_fd_opset = &_eventer_POSIX_fd_opset;
Note: See TracBrowser for help on using the browser.