| 45 | |
| 46 | |
| 47 | int knictl_status(struct ff_knictl_args *knictl){ |
| 48 | int ret; |
| 49 | struct ff_msg *msg, *retmsg = NULL; |
| 50 | |
| 51 | msg = ff_ipc_msg_alloc(); |
| 52 | if (msg == NULL) { |
| 53 | errno = ENOMEM; |
| 54 | return -1; |
| 55 | } |
| 56 | |
| 57 | msg->msg_type = FF_KNICTL; |
| 58 | msg->knictl = *knictl; |
| 59 | ret = ff_ipc_send(msg); |
| 60 | if (ret < 0) { |
| 61 | errno = EPIPE; |
| 62 | ff_ipc_msg_free(msg); |
| 63 | return -1; |
| 64 | } |
| 65 | |
| 66 | do { |
| 67 | if (retmsg != NULL) { |
| 68 | ff_ipc_msg_free(retmsg); |
| 69 | } |
| 70 | |
| 71 | ret = ff_ipc_recv(&retmsg, msg->msg_type); |
| 72 | if (ret < 0) { |
| 73 | errno = EPIPE; |
| 74 | ff_ipc_msg_free(msg); |
| 75 | return -1; |
| 76 | } |
| 77 | } while (msg != retmsg); |
| 78 | |
| 79 | *knictl = retmsg->knictl; |
| 80 | |
| 81 | ff_ipc_msg_free(msg); |
| 82 | |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | int main(int argc, char **argv) |
| 87 | { |
no test coverage detected