前言
Nginx开发从入门到精通
reading-code-of-nginx-1.9.2
正文
//用最新的nginx版本和源码进行学习
[root@localhost ~]# nginx -v
nginx version: nginx/1.17.6
pid | process |
---|---|
9774 | master |
9775 | worker |
root 9774 0.0 0.0 46380 996 ? Ss 23:05 0:00 nginx: master process nginx
nginx 9775 0.0 0.0 46776 1944 ? S 23:05 0:00 nginx: worker process
root 10019 0.0 0.0 112676 976 pts/0 R+ 23:10 0:00 grep --color=auto nginx
nginx,9774
└─nginx,9775
stack 9775
#0 0x00007f39d163f763 in __epoll_wait_nocancel () from /lib64/libc.so.6
#1 0x00007f39d2d241c3 in ngx_epoll_process_events ()
#2 0x00007f39d2d1a8e4 in ngx_process_events_and_timers ()
#3 0x00007f39d2d226e1 in ngx_worker_process_cycle ()
#4 0x00007f39d2d20b8b in ngx_spawn_process ()
#5 0x00007f39d2d21d90 in ngx_start_worker_processes ()
#6 0x00007f39d2d230a3 in ngx_master_process_cycle ()
#7 0x00007f39d2cfa12f in main ()
stack 9774
#0 0x00007f39d157e916 in sigsuspend () from /lib64/libc.so.6
#1 0x00007f39d2d230f6 in ngx_master_process_cycle ()
#2 0x00007f39d2cfa12f in main ()
master
> main
ngx_int_t ngx_strerror_init(void);
函数作用:把系统错误信息保存到数组ngx_sys_errlist内,相当于重写了stderr:
NGX_SYS_NERR,这是一个宏定义,是在auto/unix脚本中设置的
ngx_sys_errlist:
len = 7, data = 0x6d0890 "Success"
len = 23, data = 0x6d08b0 "Operation not permitted"
len = 25, data = 0x6d08d0 "No such file or directory"
len = 15, data = 0x6d0900 "No such process"
len = 23, data = 0x6d0920 "Interrupted system call"
len = 18, data = 0x6d0940 "Input/output error"
len = 25, data = 0x6d0960 "No such device or address"
len = 22, data = 0x6d0990 "Argument list too long"
len = 17, data = 0x6d09b0 "Exec format error"
len = 19, data = 0x6d09d0 "Bad file descriptor"
len = 18, data = 0x6d09f0 "No child processes"
len = 32, data = 0x6d0a10 "Resource temporarily unavailable"
len = 22, data = 0x6d0a40 "Cannot allocate memory"
len = 17, data = 0x6d0a60 "Permission denied"
len = 11, data = 0x6d0a80 "Bad address"
len = 21, data = 0x6d0aa0 "Block device required"
len = 23, data = 0x6d0ac0 "Device or resource busy"
len = 11, data = 0x6d0ae0 "File exists"
... 数组大小135
linux错误码:
errno.00 is: Success
errno.01 is: Operation not permitted
errno.02 is: No such file or directory
errno.03 is: No such process
errno.04 is: Interrupted system call
errno.05 is: Input/output error
errno.06 is: No such device or address
errno.07 is: Argument list too long
errno.08 is: Exec format error
errno.09 is: Bad file descriptor
errno.10 is: No child processes
errno.11 is: Resource temporarily unavailable
errno.12 is: Cannot allocate memory
errno.13 is: Permission denied
errno.14 is: Bad address
errno.15 is: Block device required
errno.16 is: Device or resource busy
errno.17 is: File exists