diff mbox

[1/2] linux-generic: make more readable debug messages

Message ID 1424780647-10250-1-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov Feb. 24, 2015, 12:24 p.m. UTC
Pkio tests also test for incorrect number. In log
there are messages about errors on ioctl. Make prints
for that errors more clean. Like:
odp_packet_socket.c:161:setup_pkt_sock():ioctl(SIOCGIFINDEX): No such device: "nothere".
odp_packet_socket.c:738:mmap_store_hw_addr():ioctl(SIOCGIFHWADDR): No such device: "nothere"

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 platform/linux-generic/odp_packet_socket.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c
index 41e57c1..55c212e 100644
--- a/platform/linux-generic/odp_packet_socket.c
+++ b/platform/linux-generic/odp_packet_socket.c
@@ -157,7 +157,8 @@  int setup_pkt_sock(pkt_sock_t *const pkt_sock, const char *netdev,
 	snprintf(ethreq.ifr_name, IFNAMSIZ, "%s", netdev);
 	err = ioctl(sockfd, SIOCGIFINDEX, &ethreq);
 	if (err != 0) {
-		ODP_ERR("ioctl(SIOCGIFINDEX): %s\n", strerror(errno));
+		ODP_ERR("ioctl(SIOCGIFINDEX): %s: \"%s\".\n", strerror(errno),
+			ethreq.ifr_name);
 		goto error;
 	}
 	if_idx = ethreq.ifr_ifindex;
@@ -732,7 +733,9 @@  static int mmap_store_hw_addr(pkt_sock_mmap_t *const pkt_sock,
 	ret = ioctl(pkt_sock->sockfd, SIOCGIFHWADDR, &ethreq);
 	if (ret != 0) {
 		__odp_errno = errno;
-		ODP_ERR("ioctl(SIOCGIFHWADDR): %s\n", strerror(errno));
+		ODP_ERR("ioctl(SIOCGIFHWADDR): %s: \"%s\".\n",
+			strerror(errno),
+			ethreq.ifr_name);
 		return -1;
 	}