Process the cb synchronously */
| 178 | Process the cb synchronously |
| 179 | */ |
| 180 | void aio::synchronous(aiocb *cb) |
| 181 | { |
| 182 | intptr_t ret_len; |
| 183 | int err= 0; |
| 184 | switch (cb->m_opcode) |
| 185 | { |
| 186 | case aio_opcode::AIO_PREAD: |
| 187 | ret_len= pread(cb->m_fh, cb->m_buffer, cb->m_len, cb->m_offset); |
| 188 | break; |
| 189 | case aio_opcode::AIO_PWRITE: |
| 190 | ret_len= pwrite(cb->m_fh, cb->m_buffer, cb->m_len, cb->m_offset); |
| 191 | break; |
| 192 | default: |
| 193 | abort(); |
| 194 | } |
| 195 | |
| 196 | if (ret_len < 0) |
| 197 | { |
| 198 | #ifdef _WIN32 |
| 199 | err= GetLastError(); |
| 200 | #else |
| 201 | err= errno; |
| 202 | #endif |
| 203 | ret_len= 0; |
| 204 | } |
| 205 | cb->m_ret_len = ret_len; |
| 206 | cb->m_err = err; |
| 207 | if (ret_len) |
| 208 | finish_synchronous(cb); |
| 209 | } |
| 210 | |
| 211 | } // namespace tpool |
nothing calls this directly
no test coverage detected