Commit e5dc9dd3 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

selftests: bpf: correct perror strings

perror(str) is basically equivalent to
print("%s: %s\n", str, strerror(errno)).
New line or colon at the end of str is
a mistake/breaks formatting.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4b67c515
...@@ -240,14 +240,14 @@ static int sockmap_init_sockets(int verbose) ...@@ -240,14 +240,14 @@ static int sockmap_init_sockets(int verbose)
addr.sin_port = htons(S1_PORT); addr.sin_port = htons(S1_PORT);
err = bind(s1, (struct sockaddr *)&addr, sizeof(addr)); err = bind(s1, (struct sockaddr *)&addr, sizeof(addr));
if (err < 0) { if (err < 0) {
perror("bind s1 failed()\n"); perror("bind s1 failed()");
return errno; return errno;
} }
addr.sin_port = htons(S2_PORT); addr.sin_port = htons(S2_PORT);
err = bind(s2, (struct sockaddr *)&addr, sizeof(addr)); err = bind(s2, (struct sockaddr *)&addr, sizeof(addr));
if (err < 0) { if (err < 0) {
perror("bind s2 failed()\n"); perror("bind s2 failed()");
return errno; return errno;
} }
...@@ -255,14 +255,14 @@ static int sockmap_init_sockets(int verbose) ...@@ -255,14 +255,14 @@ static int sockmap_init_sockets(int verbose)
addr.sin_port = htons(S1_PORT); addr.sin_port = htons(S1_PORT);
err = listen(s1, 32); err = listen(s1, 32);
if (err < 0) { if (err < 0) {
perror("listen s1 failed()\n"); perror("listen s1 failed()");
return errno; return errno;
} }
addr.sin_port = htons(S2_PORT); addr.sin_port = htons(S2_PORT);
err = listen(s2, 32); err = listen(s2, 32);
if (err < 0) { if (err < 0) {
perror("listen s1 failed()\n"); perror("listen s1 failed()");
return errno; return errno;
} }
...@@ -270,14 +270,14 @@ static int sockmap_init_sockets(int verbose) ...@@ -270,14 +270,14 @@ static int sockmap_init_sockets(int verbose)
addr.sin_port = htons(S1_PORT); addr.sin_port = htons(S1_PORT);
err = connect(c1, (struct sockaddr *)&addr, sizeof(addr)); err = connect(c1, (struct sockaddr *)&addr, sizeof(addr));
if (err < 0 && errno != EINPROGRESS) { if (err < 0 && errno != EINPROGRESS) {
perror("connect c1 failed()\n"); perror("connect c1 failed()");
return errno; return errno;
} }
addr.sin_port = htons(S2_PORT); addr.sin_port = htons(S2_PORT);
err = connect(c2, (struct sockaddr *)&addr, sizeof(addr)); err = connect(c2, (struct sockaddr *)&addr, sizeof(addr));
if (err < 0 && errno != EINPROGRESS) { if (err < 0 && errno != EINPROGRESS) {
perror("connect c2 failed()\n"); perror("connect c2 failed()");
return errno; return errno;
} else if (err < 0) { } else if (err < 0) {
err = 0; err = 0;
...@@ -286,13 +286,13 @@ static int sockmap_init_sockets(int verbose) ...@@ -286,13 +286,13 @@ static int sockmap_init_sockets(int verbose)
/* Accept Connecrtions */ /* Accept Connecrtions */
p1 = accept(s1, NULL, NULL); p1 = accept(s1, NULL, NULL);
if (p1 < 0) { if (p1 < 0) {
perror("accept s1 failed()\n"); perror("accept s1 failed()");
return errno; return errno;
} }
p2 = accept(s2, NULL, NULL); p2 = accept(s2, NULL, NULL);
if (p2 < 0) { if (p2 < 0) {
perror("accept s1 failed()\n"); perror("accept s1 failed()");
return errno; return errno;
} }
...@@ -353,7 +353,7 @@ static int msg_loop_sendpage(int fd, int iov_length, int cnt, ...@@ -353,7 +353,7 @@ static int msg_loop_sendpage(int fd, int iov_length, int cnt,
int sent = sendfile(fd, fp, NULL, iov_length); int sent = sendfile(fd, fp, NULL, iov_length);
if (!drop && sent < 0) { if (!drop && sent < 0) {
perror("send loop error:"); perror("send loop error");
close(fp); close(fp);
return sent; return sent;
} else if (drop && sent >= 0) { } else if (drop && sent >= 0) {
...@@ -472,7 +472,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, ...@@ -472,7 +472,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
int sent = sendmsg(fd, &msg, flags); int sent = sendmsg(fd, &msg, flags);
if (!drop && sent < 0) { if (!drop && sent < 0) {
perror("send loop error:"); perror("send loop error");
goto out_errno; goto out_errno;
} else if (drop && sent >= 0) { } else if (drop && sent >= 0) {
printf("send loop error expected: %i\n", sent); printf("send loop error expected: %i\n", sent);
...@@ -508,7 +508,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, ...@@ -508,7 +508,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
total_bytes -= txmsg_pop_total; total_bytes -= txmsg_pop_total;
err = clock_gettime(CLOCK_MONOTONIC, &s->start); err = clock_gettime(CLOCK_MONOTONIC, &s->start);
if (err < 0) if (err < 0)
perror("recv start time: "); perror("recv start time");
while (s->bytes_recvd < total_bytes) { while (s->bytes_recvd < total_bytes) {
if (txmsg_cork) { if (txmsg_cork) {
timeout.tv_sec = 0; timeout.tv_sec = 0;
...@@ -552,7 +552,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, ...@@ -552,7 +552,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
if (recv < 0) { if (recv < 0) {
if (errno != EWOULDBLOCK) { if (errno != EWOULDBLOCK) {
clock_gettime(CLOCK_MONOTONIC, &s->end); clock_gettime(CLOCK_MONOTONIC, &s->end);
perror("recv failed()\n"); perror("recv failed()");
goto out_errno; goto out_errno;
} }
} }
...@@ -566,7 +566,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, ...@@ -566,7 +566,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
errno = msg_verify_data(&msg, recv, chunk_sz); errno = msg_verify_data(&msg, recv, chunk_sz);
if (errno) { if (errno) {
perror("data verify msg failed\n"); perror("data verify msg failed");
goto out_errno; goto out_errno;
} }
if (recvp) { if (recvp) {
...@@ -574,7 +574,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, ...@@ -574,7 +574,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
recvp, recvp,
chunk_sz); chunk_sz);
if (errno) { if (errno) {
perror("data verify msg_peek failed\n"); perror("data verify msg_peek failed");
goto out_errno; goto out_errno;
} }
} }
...@@ -663,7 +663,7 @@ static int sendmsg_test(struct sockmap_options *opt) ...@@ -663,7 +663,7 @@ static int sendmsg_test(struct sockmap_options *opt)
err = 0; err = 0;
exit(err ? 1 : 0); exit(err ? 1 : 0);
} else if (rxpid == -1) { } else if (rxpid == -1) {
perror("msg_loop_rx: "); perror("msg_loop_rx");
return errno; return errno;
} }
...@@ -690,7 +690,7 @@ static int sendmsg_test(struct sockmap_options *opt) ...@@ -690,7 +690,7 @@ static int sendmsg_test(struct sockmap_options *opt)
s.bytes_recvd, recvd_Bps, recvd_Bps/giga); s.bytes_recvd, recvd_Bps, recvd_Bps/giga);
exit(err ? 1 : 0); exit(err ? 1 : 0);
} else if (txpid == -1) { } else if (txpid == -1) {
perror("msg_loop_tx: "); perror("msg_loop_tx");
return errno; return errno;
} }
...@@ -724,7 +724,7 @@ static int forever_ping_pong(int rate, struct sockmap_options *opt) ...@@ -724,7 +724,7 @@ static int forever_ping_pong(int rate, struct sockmap_options *opt)
/* Ping/Pong data from client to server */ /* Ping/Pong data from client to server */
sc = send(c1, buf, sizeof(buf), 0); sc = send(c1, buf, sizeof(buf), 0);
if (sc < 0) { if (sc < 0) {
perror("send failed()\n"); perror("send failed()");
return sc; return sc;
} }
...@@ -757,7 +757,7 @@ static int forever_ping_pong(int rate, struct sockmap_options *opt) ...@@ -757,7 +757,7 @@ static int forever_ping_pong(int rate, struct sockmap_options *opt)
rc = recv(i, buf, sizeof(buf), 0); rc = recv(i, buf, sizeof(buf), 0);
if (rc < 0) { if (rc < 0) {
if (errno != EWOULDBLOCK) { if (errno != EWOULDBLOCK) {
perror("recv failed()\n"); perror("recv failed()");
return rc; return rc;
} }
} }
...@@ -769,7 +769,7 @@ static int forever_ping_pong(int rate, struct sockmap_options *opt) ...@@ -769,7 +769,7 @@ static int forever_ping_pong(int rate, struct sockmap_options *opt)
sc = send(i, buf, rc, 0); sc = send(i, buf, rc, 0);
if (sc < 0) { if (sc < 0) {
perror("send failed()\n"); perror("send failed()");
return sc; return sc;
} }
} }
......
...@@ -45,7 +45,7 @@ static int get_stats(int fd, __u16 count, __u32 raddr) ...@@ -45,7 +45,7 @@ static int get_stats(int fd, __u16 count, __u32 raddr)
printf("\nXDP RTT data:\n"); printf("\nXDP RTT data:\n");
if (bpf_map_lookup_elem(fd, &raddr, &pinginfo)) { if (bpf_map_lookup_elem(fd, &raddr, &pinginfo)) {
perror("bpf_map_lookup elem: "); perror("bpf_map_lookup elem");
return 1; return 1;
} }
......
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