1 | /* |
1 | /* |
2 | * libev solaris event port backend |
2 | * libev solaris event port backend |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
84 | int res, i; |
84 | int res, i; |
85 | struct timespec ts; |
85 | struct timespec ts; |
86 | uint_t nget = 1; |
86 | uint_t nget = 1; |
87 | |
87 | |
88 | EV_RELEASE_CB; |
88 | EV_RELEASE_CB; |
89 | ts.tv_sec = (time_t)timeout; |
89 | EV_TS_SET (ts, timeout); |
90 | ts.tv_nsec = (long)(timeout - (ev_tstamp)ts.tv_sec) * 1e9; |
|
|
91 | res = port_getn (backend_fd, port_events, port_eventmax, &nget, &ts); |
90 | res = port_getn (backend_fd, port_events, port_eventmax, &nget, &ts); |
92 | EV_ACQUIRE_CB; |
91 | EV_ACQUIRE_CB; |
93 | |
92 | |
94 | if (res == -1) |
93 | if (res == -1) |
95 | { |
94 | { |
… | |
… | |
110 | fd, |
109 | fd, |
111 | (port_events [i].portev_events & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) |
110 | (port_events [i].portev_events & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) |
112 | | (port_events [i].portev_events & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) |
111 | | (port_events [i].portev_events & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) |
113 | ); |
112 | ); |
114 | |
113 | |
115 | port_associate_and_check (EV_A_ fd, anfds [fd].events); |
114 | fd_change (EV_A_ fd, EV__IOFDSET); |
116 | } |
115 | } |
117 | } |
116 | } |
118 | |
117 | |
119 | if (expect_false (nget == port_eventmax)) |
118 | if (expect_false (nget == port_eventmax)) |
120 | { |
119 | { |