… | |
… | |
8 | * 1. Redistributions of source code must retain the above copyright |
8 | * 1. Redistributions of source code must retain the above copyright |
9 | * notice, this list of conditions and the following disclaimer. |
9 | * notice, this list of conditions and the following disclaimer. |
10 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * 2. Redistributions in binary form must reproduce the above copyright |
11 | * notice, this list of conditions and the following disclaimer in the |
11 | * notice, this list of conditions and the following disclaimer in the |
12 | * documentation and/or other materials provided with the distribution. |
12 | * documentation and/or other materials provided with the distribution. |
13 | * 3. The name of the author may not be used to endorse or promote products |
|
|
14 | * derived from this software without specific prior written permission. |
|
|
15 | * |
13 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
… | |
… | |
111 | if ((port_fd = port_create ()) < 0) |
109 | if ((port_fd = port_create ()) < 0) |
112 | return 0; |
110 | return 0; |
113 | |
111 | |
114 | fcntl (port_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */ |
112 | fcntl (port_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */ |
115 | |
113 | |
116 | method_fudge = 1e-3; /* needed to compensate for port_getn returning early */ |
114 | backend_fudge = 1e-3; /* needed to compensate for port_getn returning early */ |
117 | method_modify = port_modify; |
115 | backend_modify = port_modify; |
118 | method_poll = port_poll; |
116 | backend_poll = port_poll; |
119 | |
117 | |
120 | port_eventmax = 64; /* intiial number of events receivable per poll */ |
118 | port_eventmax = 64; /* intiial number of events receivable per poll */ |
121 | port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); |
119 | port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); |
122 | |
120 | |
123 | return EVMETHOD_PORT; |
121 | return EVBACKEND_PORT; |
124 | } |
122 | } |
125 | |
123 | |
126 | static void |
124 | static void |
127 | port_destroy (EV_P) |
125 | port_destroy (EV_P) |
128 | { |
126 | { |