On 19-07-10 09:04, Stephen Hemminger wrote: > External Email > > ---------------------------------------------------------------------- > On Wed, 10 Jul 2019 16:46:30 +0200 > <kka...@marvell.com> wrote: > > > > > +#define PMD_LOG_ERRNO(level, fmt, args...) \ > > + rte_log(RTE_LOG_ ## level, af_packet_logtype, \ > > + "%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno)) > > + > > static uint16_t > > eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > > { > > @@ -603,9 +609,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, > > return -1; > > } > > if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) { > > - PMD_LOG(ERR, > > - "%s: ioctl failed (SIOCGIFINDEX)", > > - name); > > + PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFINDEX)", name); > > return -1; > > This is wrong. > The ioctl sets errno not rte_errno. I was following the documentation on rte_strerror, which states:
For non-RTE-specific error codes, this function returns the value from the libc strerror function. > > > Why not? > PMD_LOG(ERR, "%s: ioctl failed (SIOCGIFINDEX): %s", > name, strerror(errno)); Ok, but rte_strerror uses strerror_r, although I am unsure this is required here. -- - Regards, Krzysztof(Chris) Kanas