Thread (290 messages) flat view 290 messages, 13 authors, 2022-04-12

Re: [dpdk-dev] [PATCH v16 3/9] eal/windows: translate Windows errors to errno-style errors

From: Thomas Monjalon <hidden>
Date: 2021-11-09 08:21:30

09/11/2021 03:02, Narcisa Ana Maria Vasile:
On Tue, Oct 12, 2021 at 06:16:19PM +0200, Thomas Monjalon wrote:
quoted
09/10/2021 09:41, Narcisa Ana Maria Vasile:
quoted
From: Narcisa Vasile <redacted>
 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?

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help