glibc 关于进程完成状态的文档指出宏 WEXITSTATUS 返回完成状态的低位 8 字节。
宏:int WEXITSTATUS (int status)
如果 WIFEXITED 的状态为真,则该宏从子进程返回退出状态值的低 8 位。
然而,/usr/include/sys/wait.h
说:
# define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status))
并且,/usr/include/bits/waitstatus.h
提到:
/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
除非我的字节序概念都搞砸了,否则低8 位是怎么回事?还是 libc 假设数据以小端方式保存?