KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
errno.h File Reference

Errno helper functions. More...

#include <errno.h>

Go to the source code of this file.

Macros

#define errno_save_scoped()
 Save the current 'errno' value until the block exit.
 
#define errno_if_nonzero(x)
 Return errno if the value is non-zero, otherwise return zero.
 

Detailed Description

Errno helper functions.

This file contains functions and macros related to the 'errno' variable.

Author
Paul Cercueil

Macro Definition Documentation

◆ errno_if_nonzero

#define errno_if_nonzero ( x)
Value:
((x) ? errno : 0)

Return errno if the value is non-zero, otherwise return zero.

This simple macro can be used to interface the functions that return 0 on success and -1 on error, with the actual error code stored in the errno variable.

Parameters
xThe integer value to process
Returns
0 on success, a positive errno code on error

◆ errno_save_scoped

#define errno_save_scoped ( )
Value:
__errno_save_scoped(__LINE__)

Save the current 'errno' value until the block exit.

This macro will keep a copy of the current value of the errno variable, and will restore it once the execution exits the functional block in which the macro was called.