summaryrefslogtreecommitdiff
path: root/benchmark/src/sapp_benchmark_utils.cpp
diff options
context:
space:
mode:
author杨威 <[email protected]>2023-05-08 20:31:19 +0800
committer杨威 <[email protected]>2023-05-16 17:47:35 +0800
commite725f5c8e14359c6e2d63fff833fc548e7523fd4 (patch)
treecbd8cec7a658d8a5d1097b9ec88e2c904dbbeaa4 /benchmark/src/sapp_benchmark_utils.cpp
parent7aee7340527eaba27c9f2c770900efe406de0c88 (diff)
🧪 test(inline test): 增加ioctl输出时的打印信息
Diffstat (limited to 'benchmark/src/sapp_benchmark_utils.cpp')
-rw-r--r--benchmark/src/sapp_benchmark_utils.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/benchmark/src/sapp_benchmark_utils.cpp b/benchmark/src/sapp_benchmark_utils.cpp
index 90a0f08..b3347dd 100644
--- a/benchmark/src/sapp_benchmark_utils.cpp
+++ b/benchmark/src/sapp_benchmark_utils.cpp
@@ -106,7 +106,7 @@ static int ifconfig_device_up(const char *interface_name)
sprintf(ifr.ifr_name, "%s", interface_name);
/* ��ýӿڵı�־ */
if ((err = ioctl(socket_fd, SIOCGIFFLAGS, (void *)&ifr)) < 0) {
- perror("ioctl SIOCGIFADDR");
+ fprintf(stderr, "ifconfig_device_up(%s), ioctl SIOCGIFFLAGS: %s\n", interface_name, strerror(errno));
close(socket_fd);
return -3;
}
@@ -145,7 +145,7 @@ int ifconfig_device_mtu(const char *interface_name, int mtu_val)
sprintf(ifr.ifr_name, "%s", interface_name);
/* ��ýӿڵı�־ */
if ((err = ioctl(socket_fd, SIOCGIFMTU, (void *)&ifr)) < 0) {
- perror("ioctl SIOCGIFMTU");
+ fprintf(stderr, "ifconfig_device_mtu(%s), ioctl SIOCGIFMTU: %s\n", interface_name, strerror(errno));
close(socket_fd);
return -3;
}
@@ -153,7 +153,7 @@ int ifconfig_device_mtu(const char *interface_name, int mtu_val)
ret = ioctl(socket_fd, SIOCSIFMTU, &ifr);
if (ret != 0)
{
- perror("ioctl SIOCSIFMTU");
+ fprintf(stderr, "ifconfig_device_mtu(%s), ioctl SIOCSIFMTU: %s\n", interface_name, strerror(errno));
close(socket_fd);
return -3;
}
@@ -184,7 +184,7 @@ static int tuntap_dev_create(char *dev, int flags)
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
}
if ((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0) {
- perror ("Error: ");
+ fprintf(stderr, "tuntap_dev_create(%s), ioctl TUNSETIFF: %s\n", dev, strerror(errno));
close(fd);
return err;
}