[dpdk-dev] [PATCH v16 3/9] eal/windows: translate Windows errors to errno-style errors
Thomas Monjalon
thomas at monjalon.net
Tue Nov 9 09:21:22 CET 2021
09/11/2021 03:02, Narcisa Ana Maria Vasile:
> On Tue, Oct 12, 2021 at 06:16:19PM +0200, Thomas Monjalon wrote:
> > 09/10/2021 09:41, Narcisa Ana Maria Vasile:
> > > From: Narcisa Vasile <navasile at microsoft.com>
> > > rte_thread_key_create(rte_thread_key *key,
> > > __rte_unused void (*destructor)(void *))
> > > {
> > > + int ret;
> > > +
> > > *key = malloc(sizeof(**key));
> > > if ((*key) == NULL) {
> > > RTE_LOG(DEBUG, EAL, "Cannot allocate TLS key.\n");
> > > - rte_errno = ENOMEM;
> > > - return -1;
> > > + return ENOMEM;
> > > }
> >
> > Why this change? rte_errno and negative error code are good.
> >
>
> This error could have been handled using rte_errno and negative return,
> but for consistency, a positive error number is returned. As different platforms
> have different error codes, the approach here is to translate the Windows error
> to POSIX-style ones to have uniformity over the values returned. All functions
> in this thread module return the possible error through the return value.
We can have the same consistency with rte_errno.
What others think? Should we use rte_errno?
More information about the dev
mailing list