* Add an event source for a file descriptor. * * @param fd The file descriptor. * @param events Events to check for. * @param timeout Max time to wait before the callback is called, ignored if 0. * @param cb Callback function to add. Must not be NULL. * @param cb_data Data for the callback function. Can be NULL. * * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or *
| 394 | * SR_ERR_MALLOC upon memory allocation errors. |
| 395 | */ |
| 396 | SR_PRIV int sr_session_source_add(int fd, int events, int timeout, |
| 397 | sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi) |
| 398 | { |
| 399 | GPollFD p; |
| 400 | |
| 401 | p.fd = fd; |
| 402 | p.events = events; |
| 403 | |
| 404 | return _sr_session_source_add(&p, timeout, cb, sdi, (gintptr)fd); |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * Add an event source for a GPollFD. |
no test coverage detected