nginx源码解析-ngx_strerror()/ngx_strerror_init()
将所有的错误码errno以及错误描述strerror(errno)提前存储到ngx_sys_errlist中,用于解决异步信号安全的问题。
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
/*
* The strerror() messages are copied because:
* strerror()的错误描述由于以下原因才被拷贝到ngx_sys_errlist中
*
* 1) strerror() and strerror_r() functions are not Async-Signal-Safe(异步信号安全),
* therefore, they cannot be used in signal handlers(信号处理);
*
* 2) a direct sys_errlist[] array may be used instead of these functions,
* but Linux linker(链接器) warns about its usage:
*
* warning: `sys_errlist' is deprecated(废弃); use `strerror' or `strerror_r' instead
* warning: `