LINUX programming error handling

xiaoxiao2021-03-05  23

The "GNU / Linux Programming Guide" is written in the error processing part.

Common content is as follows:

L supports the assert () function. Note that the ASSERT () checks that the abort () termination program execution is invoked when the conditions are not founded, and the application does not have the opportunity to make clear work.

The L C standard defines __line__ and __file__macromacromacromavers, the GNU C extension defines the __function__ macro.

L defines errno, pay attention to the function of errno, so clear errno before calling the function that may set Errno.

The Abort (), Exit () and the ATEXIT () function are defined in l .

l Function Abort () will lead to an exception termination, and there is no function of the ATEXIT () registration without the opportunity to terminate the program, and there is no program to perform some regular clear work. At the same time, Abort () also produces Core Dump if there is no Ulimit limit.

l Functions exit () and abort () are similar, but it terminates the program after completing the cleanup work.

l Function ATEXIT () Register the function to be called when the program is normally terminated.

Conifer (), defined in PERROR (), is defined in l .

Syslogd interface is defined in l .

转载请注明原文地址:https://www.9cbs.com/read-36207.html

New Post(0)