Lely core libraries  2.2.5
errnum.c File Reference

This file is part of the utilities library; it contains the implementation of the error functions. More...

#include "util.h"
#include <lely/util/errnum.h>
#include <lely/util/util.h>
#include <string.h>
Include dependency graph for errnum.c:

Go to the source code of this file.

Functions

int errno2c (int errnum)
 Transforms a standard C error number to a native error code. More...
 
errnum_t errno2num (int errnum)
 Transforms a standard C error number to a platform-independent error number. More...
 
int errc2no (int errc)
 Transforms a native error code to a standard C error number. More...
 
errnum_t errc2num (int errc)
 Transforms a native error code to a platform-independent error number. More...
 
int errnum2no (errnum_t errnum)
 Transforms a platform-independent error number to a standard C error number. More...
 
int errnum2c (errnum_t errnum)
 Transforms a platform-independent error number to a native error code. More...
 
int get_errc (void)
 Returns the last (thread-specific) native error code set by a system call or library function. More...
 
void set_errc (int errc)
 Sets the current (thread-specific) native error code to errc. More...
 
const char * errno2str (int errnum)
 Returns a string describing a standard C error number. More...
 
const char * errc2str (int errc)
 Returns a string describing a native error code.
 

Detailed Description

This file is part of the utilities library; it contains the implementation of the error functions.

See also
lely/util/errnum.h
Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file errnum.c.

Function Documentation

◆ errno2c()

int errno2c ( int  errnum)

Transforms a standard C error number to a native error code.

This is equivalent to errnum2c(errno2num(errnum)) on Windows, or errnum on other platforms.

See also
errc2no()

Definition at line 43 of file errnum.c.

◆ errno2num()

errnum_t errno2num ( int  errnum)

Transforms a standard C error number to a platform-independent error number.

See also
errnum2no()

Definition at line 53 of file errnum.c.

◆ errc2no()

int errc2no ( int  errc)

Transforms a native error code to a standard C error number.

This is equivalent to errnum2no(errc2num(errc)) on Windows, or errc on other platforms (provided errc is positive).

See also
errc2no()

Definition at line 300 of file errnum.c.

◆ errc2num()

errnum_t errc2num ( int  errc)

Transforms a native error code to a platform-independent error number.

See also
errnum2c()

Definition at line 310 of file errnum.c.

◆ errnum2no()

int errnum2no ( errnum_t  errnum)

Transforms a platform-independent error number to a standard C error number.

See also
errno2num()

Definition at line 574 of file errnum.c.

◆ errnum2c()

int errnum2c ( errnum_t  errnum)

Transforms a platform-independent error number to a native error code.

See also
err2num()

Definition at line 825 of file errnum.c.

◆ get_errc()

int get_errc ( void  )

Returns the last (thread-specific) native error code set by a system call or library function.

This is equivalent to GetLastError()/WSAGetLastError() on Windows, or errno on other platforms.

This function returns the thread-specific error number.

See also
set_errc()

Definition at line 947 of file errnum.c.

◆ set_errc()

void set_errc ( int  errc)

Sets the current (thread-specific) native error code to errc.

This is equivalent to SetLastError(errc)/WSASetLastError(errc) on Windows, or errno = errc on other platforms.

See also
get_errc()

Definition at line 957 of file errnum.c.

◆ errno2str()

const char* errno2str ( int  errnum)

Returns a string describing a standard C error number.

This is equivalent to strerror(errnum).

Definition at line 967 of file errnum.c.