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. More...
 

Detailed Description

linux_strerror implementation

Definition in file linux_strerror.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ linux_strerror()

const char* linux_strerror ( int  errnum)

Definition at line 158 of file linux_strerror.c.

159 {
160  static char errbuf[64];
161  static int errors_size = sizeof(errors) / sizeof(*errors);
162 
163  if (errnum >= errors_size || errnum < 0) {
164  snprintf(errbuf, sizeof(errbuf), "Error %#08x", errnum);
165  return errbuf;
166  } else {
167  return errors[errnum];
168  }
169 }
static const char * errors[]
Error names from glibc.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382

References errors, and snprintf().

Variable Documentation

◆ errors

const char* errors[]
static

Error names from glibc.

Definition at line 30 of file linux_strerror.c.

Referenced by linux_strerror().