Commit 131f5a1d authored by Kinsbursky Stanislav's avatar Kinsbursky Stanislav Committed by Cyrill Gorcunov

dump: UNIX sockets queue support

Based on xemul@ patches.
Signed-off-by: 's avatarStanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent e6f39a41
......@@ -83,6 +83,24 @@ struct inet_sk_desc {
unsigned int src_addr[4];
};
static int unix_sk_queue_add(int fd, const struct unix_sk_desc *sd,
struct sk_queue *queue)
{
struct sk_queue_entry *next, *new;
new = xmalloc(sizeof(struct sk_queue_entry));
if (!new)
return -1;
new->item.fd = fd;
new->item.type = sd->type;
new->item.sk_id = sd->sd.ino;
new->next = queue->list;
queue->list = new;
queue->entries++;
return 0;
}
#define SK_HASH_SIZE 32
#define SK_HASH_LINK(head, key, elem) \
......@@ -260,17 +278,6 @@ static int can_dump_unix_sk(const struct unix_sk_desc *sk)
case TCP_LISTEN:
break;
case TCP_ESTABLISHED:
if (sk->rqlen) {
/*
* The hard case :( Currentl there's no way to
* clone the sk queue. Even the MSG_PEEK doesn't
* help, since it picks up the head of the queue
* always. Some more patches should go
*/
pr_err("Non empty queue\n");
return 0;
}
break;
case TCP_CLOSE:
if (sk->type != SOCK_DGRAM)
......@@ -340,6 +347,11 @@ static int dump_one_unix(const struct socket_desc *_sk, int fd,
if (write_img_buf(cr_fdset->fds[CR_FD_UNIXSK], sk->name, ue.namelen))
goto err;
if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM &&
sk->state == TCP_LISTEN))
if (unix_sk_queue_add(fd, sk, queue))
goto err;
pr_info("Dumping unix socket at %d\n", fd);
show_one_unix("Dumping", sk);
show_one_unix_img("Dumped", &ue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment