… | |
… | |
101 | } |
101 | } |
102 | |
102 | |
103 | if (expect_false (nget == port_eventmax)) |
103 | if (expect_false (nget == port_eventmax)) |
104 | { |
104 | { |
105 | ev_free (port_events); |
105 | ev_free (port_events); |
106 | port_eventmax = array_roundsize (port_event_t, port_eventmax << 1); |
106 | port_eventmax = array_nextsize (sizeof (port_event_t), port_eventmax, port_eventmax + 1); |
107 | port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); |
107 | port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); |
108 | } |
108 | } |
109 | } |
109 | } |
110 | |
110 | |
111 | static int |
111 | int inline_size |
112 | port_init (EV_P_ int flags) |
112 | port_init (EV_P_ int flags) |
113 | { |
113 | { |
114 | /* Initalize the kernel queue */ |
114 | /* Initalize the kernel queue */ |
115 | if ((backend_fd = port_create ()) < 0) |
115 | if ((backend_fd = port_create ()) < 0) |
116 | return 0; |
116 | return 0; |
… | |
… | |
125 | port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); |
125 | port_events = (port_event_t *)ev_malloc (sizeof (port_event_t) * port_eventmax); |
126 | |
126 | |
127 | return EVBACKEND_PORT; |
127 | return EVBACKEND_PORT; |
128 | } |
128 | } |
129 | |
129 | |
130 | static void |
130 | void inline_size |
131 | port_destroy (EV_P) |
131 | port_destroy (EV_P) |
132 | { |
132 | { |
133 | close (backend_fd); |
|
|
134 | |
|
|
135 | ev_free (port_events); |
133 | ev_free (port_events); |
136 | } |
134 | } |
137 | |
135 | |
138 | static void |
136 | void inline_size |
139 | port_fork (EV_P) |
137 | port_fork (EV_P) |
140 | { |
138 | { |
141 | close (backend_fd); |
139 | close (backend_fd); |
142 | |
140 | |
143 | while ((backend_fd = port_create ()) < 0) |
141 | while ((backend_fd = port_create ()) < 0) |