Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3845 → Rev 3846

/branches/network/uspace/srv/net/err.h
27,20 → 27,37
*/
 
/** @addtogroup net
* @{
* @{
*/
 
/** @file
* Common error processing codes and routines.
*/
 
#ifndef __NET_ERR_H__
#define __NET_ERR_H__
 
#include <errno.h>
 
#define ERROR_CODE error_check_return_value
#define ERROR_DECLARE int ERROR_CODE
/** An actual stored error code.
*/
#define ERROR_CODE error_check_return_value
 
/** An error processing routines declaration.
* This has to be declared in the block where the error processing is desired.
*/
#define ERROR_DECLARE int ERROR_CODE
 
/** Stores the value as an error code and checks if an error occured.
* @param value The value to be checked. May be a function call. Input parameter.
* @returns FALSE if the value indicates success (EOK).
* @returns TRUE otherwise.
*/
#define ERROR_OCCURED( value ) (( ERROR_CODE = ( value )) != EOK )
 
/** Checks if an error occured and immediatelly exits the actual function returning the error code.
* @param value The value to be checked. May be a function call. Input parameter.
*/
#define ERROR_PROPAGATE( value ) if( ERROR_OCCURED( value )) return ERROR_CODE
 
#endif