Commit adca8809 authored by Pavel Emelyanov's avatar Pavel Emelyanov

sockets: Pass fd_parms into sockets dumping fns

This is required for proper close-on-exec handling (coming soon) and for fowners (coming soon
as well) and for file flags (yes, yes).
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 6af08c33
...@@ -294,7 +294,7 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk) ...@@ -294,7 +294,7 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk)
return 1; return 1;
} }
static int dump_one_inet(struct socket_desc *_sk, int fd, static int dump_one_inet(struct socket_desc *_sk, struct fd_parms *p,
const struct cr_fdset *cr_fdset) const struct cr_fdset *cr_fdset)
{ {
struct inet_sk_desc *sk = (struct inet_sk_desc *)_sk; struct inet_sk_desc *sk = (struct inet_sk_desc *)_sk;
...@@ -304,7 +304,7 @@ static int dump_one_inet(struct socket_desc *_sk, int fd, ...@@ -304,7 +304,7 @@ static int dump_one_inet(struct socket_desc *_sk, int fd,
if (!can_dump_inet_sk(sk)) if (!can_dump_inet_sk(sk))
goto err; goto err;
fe.fd = fd; fe.fd = p->fd;
fe.type = FDINFO_INETSK; fe.type = FDINFO_INETSK;
fe.id = sk->sd.ino; fe.id = sk->sd.ino;
...@@ -330,7 +330,7 @@ static int dump_one_inet(struct socket_desc *_sk, int fd, ...@@ -330,7 +330,7 @@ static int dump_one_inet(struct socket_desc *_sk, int fd,
if (write_img(fdset_fd(glob_fdset, CR_FD_INETSK), &ie)) if (write_img(fdset_fd(glob_fdset, CR_FD_INETSK), &ie))
goto err; goto err;
pr_info("Dumping inet socket at %d\n", fd); pr_info("Dumping inet socket at %d\n", p->fd);
show_one_inet("Dumping", sk); show_one_inet("Dumping", sk);
show_one_inet_img("Dumped", &ie); show_one_inet_img("Dumped", &ie);
sk->sd.already_dumped = 1; sk->sd.already_dumped = 1;
...@@ -365,8 +365,8 @@ static int can_dump_unix_sk(const struct unix_sk_desc *sk) ...@@ -365,8 +365,8 @@ static int can_dump_unix_sk(const struct unix_sk_desc *sk)
return 1; return 1;
} }
static int dump_one_unix(const struct socket_desc *_sk, int fd, int lfd, static int dump_one_unix(const struct socket_desc *_sk, struct fd_parms *p,
const struct cr_fdset *cr_fdset) int lfd, const struct cr_fdset *cr_fdset)
{ {
struct unix_sk_desc *sk = (struct unix_sk_desc *)_sk; struct unix_sk_desc *sk = (struct unix_sk_desc *)_sk;
struct fdinfo_entry fe; struct fdinfo_entry fe;
...@@ -375,7 +375,7 @@ static int dump_one_unix(const struct socket_desc *_sk, int fd, int lfd, ...@@ -375,7 +375,7 @@ static int dump_one_unix(const struct socket_desc *_sk, int fd, int lfd,
if (!can_dump_unix_sk(sk)) if (!can_dump_unix_sk(sk))
goto err; goto err;
fe.fd = fd; fe.fd = p->fd;
fe.type = FDINFO_UNIXSK; fe.type = FDINFO_UNIXSK;
fe.id = sk->sd.ino; fe.id = sk->sd.ino;
...@@ -452,7 +452,7 @@ static int dump_one_unix(const struct socket_desc *_sk, int fd, int lfd, ...@@ -452,7 +452,7 @@ static int dump_one_unix(const struct socket_desc *_sk, int fd, int lfd,
if (dump_socket_queue(lfd, ue.id)) if (dump_socket_queue(lfd, ue.id))
goto err; goto err;
pr_info("Dumping unix socket at %d\n", fd); pr_info("Dumping unix socket at %d\n", p->fd);
show_one_unix("Dumping", sk); show_one_unix("Dumping", sk);
show_one_unix_img("Dumped", &ue); show_one_unix_img("Dumped", &ue);
...@@ -475,9 +475,9 @@ int dump_socket(struct fd_parms *p, int lfd, const struct cr_fdset *cr_fdset) ...@@ -475,9 +475,9 @@ int dump_socket(struct fd_parms *p, int lfd, const struct cr_fdset *cr_fdset)
switch (sk->family) { switch (sk->family) {
case AF_UNIX: case AF_UNIX:
return dump_one_unix(sk, p->fd, lfd, cr_fdset); return dump_one_unix(sk, p, lfd, cr_fdset);
case AF_INET: case AF_INET:
return dump_one_inet(sk, p->fd, cr_fdset); return dump_one_inet(sk, p, cr_fdset);
default: default:
pr_err("BUG! Unknown socket collected\n"); pr_err("BUG! Unknown socket collected\n");
break; break;
......
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