-static struct udebug_client_msg *
-send_and_wait(struct udebug *ctx, struct udebug_client_msg *msg, int *rfd)
-{
- int type = msg->type;
- int fd = -1;
-
- udebug_send_msg(ctx, msg, NULL, -1);
-
- do {
- if (fd >= 0)
- close(fd);
- fd = -1;
- msg = __udebug_poll(ctx, &fd, true);
- } while (msg && msg->type != type);
- if (!msg)
- return NULL;
-
- if (rfd)
- *rfd = fd;
- else if (fd >= 0)
- close(fd);
-
- return msg;
-}
-