Browse Source

In order to be a little more coherent, we only use -ENOMEM and not a mix of
ENOMEM and -ENOMEM which indicating an error.

Cédric Augonnet 14 years ago
parent
commit
e84341dbfa
3 changed files with 6 additions and 6 deletions
  1. 1 1
      src/datawizard/copy_driver.c
  2. 3 3
      src/datawizard/data_request.c
  3. 2 2
      src/datawizard/memalloc.c

+ 1 - 1
src/datawizard/copy_driver.c

@@ -251,7 +251,7 @@ int __attribute__((warn_unused_result)) _starpu_driver_copy_data_1_to_1(starpu_d
 	return 0;
 	return 0;
 
 
 nomem:
 nomem:
-	return ENOMEM;
+	return -ENOMEM;
 }
 }
 
 
 void _starpu_driver_wait_request_completion(starpu_async_channel *async_channel __attribute__ ((unused)),
 void _starpu_driver_wait_request_completion(starpu_async_channel *async_channel __attribute__ ((unused)),

+ 3 - 3
src/datawizard/data_request.c

@@ -296,12 +296,12 @@ static int starpu_handle_data_request(starpu_data_request_t r, unsigned may_allo
 	/* the header of the data must be locked by the worker that submitted the request */
 	/* the header of the data must be locked by the worker that submitted the request */
 	r->retval = _starpu_driver_copy_data_1_to_1(handle, r->src_node, r->dst_node, !(r->mode & STARPU_R), r, may_alloc);
 	r->retval = _starpu_driver_copy_data_1_to_1(handle, r->src_node, r->dst_node, !(r->mode & STARPU_R), r, may_alloc);
 
 
-	if (r->retval == ENOMEM)
+	if (r->retval == -ENOMEM)
 	{
 	{
 		_starpu_spin_unlock(&r->lock);
 		_starpu_spin_unlock(&r->lock);
 		_starpu_spin_unlock(&handle->header_lock);
 		_starpu_spin_unlock(&handle->header_lock);
 
 
-		return ENOMEM;
+		return -ENOMEM;
 	}
 	}
 
 
 	if (r->retval == EAGAIN)
 	if (r->retval == EAGAIN)
@@ -352,7 +352,7 @@ void _starpu_handle_node_data_requests(uint32_t src_node, unsigned may_alloc)
 		r = starpu_data_request_list_pop_back(local_list);
 		r = starpu_data_request_list_pop_back(local_list);
 
 
 		res = starpu_handle_data_request(r, may_alloc);
 		res = starpu_handle_data_request(r, may_alloc);
-		if (res == ENOMEM)
+		if (res == -ENOMEM)
 		{
 		{
                         PTHREAD_MUTEX_LOCK(&data_requests_list_mutex[src_node]);
                         PTHREAD_MUTEX_LOCK(&data_requests_list_mutex[src_node]);
 
 

+ 2 - 2
src/datawizard/memalloc.c

@@ -712,14 +712,14 @@ int _starpu_allocate_memory_on_node(starpu_data_handle handle, uint32_t dst_node
 		return 0;
 		return 0;
 
 
 	if (!may_alloc)
 	if (!may_alloc)
-		return ENOMEM;
+		return -ENOMEM;
 
 
 	void *interface = starpu_data_get_interface_on_node(handle, dst_node);
 	void *interface = starpu_data_get_interface_on_node(handle, dst_node);
 	allocated_memory = _starpu_allocate_interface(handle, interface, dst_node);
 	allocated_memory = _starpu_allocate_interface(handle, interface, dst_node);
 
 
 	/* perhaps we could really not handle that capacity misses */
 	/* perhaps we could really not handle that capacity misses */
 	if (allocated_memory == -ENOMEM)
 	if (allocated_memory == -ENOMEM)
-		return ENOMEM;
+		return -ENOMEM;
 
 
 	register_mem_chunk(handle, dst_node, allocated_memory, 1);
 	register_mem_chunk(handle, dst_node, allocated_memory, 1);