mirror of
https://passt.top/passt
synced 2025-08-13 02:33:12 +02:00
flow: Add flow_perror() helper
Our general logging helpers include a number of _perror() variants which, like perror(3) include the description of the current errno. We didn't have those for our flow specific logging helpers, though. Fill this gap with flow_perror() and flow_dbg_perror(), and use them where it's useful. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
ba0823f8a0
commit
adb46c11d0
6 changed files with 49 additions and 47 deletions
|
@ -164,7 +164,7 @@ static int tcp_splice_epoll_ctl(const struct ctx *c,
|
|||
if (epoll_ctl(c->epollfd, m, conn->s[0], &ev[0]) ||
|
||||
epoll_ctl(c->epollfd, m, conn->s[1], &ev[1])) {
|
||||
int ret = -errno;
|
||||
flow_err(conn, "ERROR on epoll_ctl(): %s", strerror_(errno));
|
||||
flow_perror(conn, "ERROR on epoll_ctl()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -317,8 +317,8 @@ static int tcp_splice_connect_finish(const struct ctx *c,
|
|||
|
||||
if (conn->pipe[sidei][0] < 0) {
|
||||
if (pipe2(conn->pipe[sidei], O_NONBLOCK | O_CLOEXEC)) {
|
||||
flow_err(conn, "cannot create %d->%d pipe: %s",
|
||||
sidei, !sidei, strerror_(errno));
|
||||
flow_perror(conn, "cannot create %d->%d pipe",
|
||||
sidei, !sidei);
|
||||
conn_flag(c, conn, CLOSING);
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -482,8 +482,7 @@ void tcp_splice_sock_handler(struct ctx *c, union epoll_ref ref,
|
|||
|
||||
rc = getsockopt(ref.fd, SOL_SOCKET, SO_ERROR, &err, &sl);
|
||||
if (rc)
|
||||
flow_err(conn, "Error retrieving SO_ERROR: %s",
|
||||
strerror_(errno));
|
||||
flow_perror(conn, "Error retrieving SO_ERROR");
|
||||
else
|
||||
flow_trace(conn, "Error event on socket: %s",
|
||||
strerror_(err));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue