iPXE
Functions | Variables
linux_strerror.c File Reference

linux_strerror implementation More...

#include <linux_api.h>
#include <stdio.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
const char * linux_strerror (int errnum)

Variables

static const char * errors []
 Error names from glibc.

Detailed Description

linux_strerror implementation

Definition in file linux_strerror.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER  )
const char* linux_strerror ( int  errnum)

Definition at line 158 of file linux_strerror.c.

References errors, and snprintf().

{
        static char errbuf[64];
        static int errors_size = sizeof(errors) / sizeof(*errors);
        
        if (errnum >= errors_size || errnum < 0) {
                snprintf(errbuf, sizeof(errbuf), "Error %#08x", errnum);
                return errbuf;
        } else {
                return errors[errnum];
        }
}

Variable Documentation

const char* errors[] [static]

Error names from glibc.

Definition at line 30 of file linux_strerror.c.

Referenced by linux_strerror().