Linux系统调用reboot中魔术参数背后鲜为人知的趣味
Linux系统调用reboot()中魔数参数背后鲜为人知的趣味事情:
看过Linux系统调用的童鞋可能会注意到reboot系统调用的第二个参数magic2的取值到底是何意义.
在任意终端敲入 man 2 reboot 回车就可以看到reboot系统调用的原型如下:
NAME
reboot - reboot or enable/disable Ctrl-Alt-Del
SYNOPSIS
/* For libc4 and libc5 the library call and the system call are identical, and since kernel version 2.1.30 there are symbolic names LINUX_REBOOT_* for the constants and a fourth argument to the call: */ #include <unistd.h> #include <linux/reboot.h> int reboot(int magic, int magic2, int cmd, void *arg); /* Under glibc some of the constants involved have gotten symbolic names RB_*, and the library call is a 1-argument wrapper around the 3-argument system call: */ #include <unistd.h> #include <sys/reboot.h> int reboot(int cmd);
DESCRIPTION
The reboot() call reboots the system, or enables/disables the reboot keystroke (abbreviated CAD, since the default is Ctrl-Alt-Delete; it can be changed using loadkeys(1)). This system call will fail (with EINVAL) unless magic equals LINUX_REBOOT_MAGIC1 (that is, 0xfee1dead) and magic2 equals LINUX_REBOOT_MAGIC2 (that is, 672274793). However, since 2.1.17 also LINUX_REBOOT_MAGIC2A (that is, 85072278) and since 2.1.97 also LINUX_REBOOT_MAGIC2B (that is, 369367448) and since 2.5.71 also LINUX_REBOOT_MAGIC2C (that is, 537993216) are permitted as value for magic2. (The hexadecimal values of these constants are meaningful.)
这其中的第二个参数magic2的取值有4个.分别是4个宏,且其值是一串数字.
LINUX_REBOOT_MAGIC2 (that is, 672274793) LINUX_REBOOT_MAGIC2A (that is, 85072278) LINUX_REBOOT_MAGIC2B (that is, 369367448) LINUX_REBOOT_MAGIC2C (that is, 537993216)
这不禁让我好奇这4个数字分别代表啥意思呢..这个数字是什么应该关系不大.这里特意用这几个数字肯定同时蕴含了别的小意义.
四个数字用十六进制表示分别是:
672274793 = 0x28121969
85072278 = 0x05121996
369367448 = 0x16041998
537993216 = 0x20112000
有没有发现什么特征啊.是不是都很像一个日期呢..day,month,year顺序.(⊙o⊙)哦.我知道了.是生日~!…哈哈..
可是这4个生日日期分别是谁的呢..很可能是开发人员或其妻子或儿女的生日…继续放狗搜索.恍然大悟,真相大白了..
原来这是Linux的作者Linus Torvalds自己和他三个女儿的生日. 太有爱了….说不定以后他再生一个女儿,可能某个版本中magic2的取值将也会新增一个宏,值为他小女儿的生日….那样的话.. 教主Tovalds也太高产了.
今天12月26日了.后天28日就是Linux Torvalds的生日了,预祝他生日快乐~.
Linus Torvalds
AKA Linus Benedict Torvalds
Born: 28-Dec-1969
Birthplace: Helsinki, Finland
Gender: Male
Religion: Atheist
Race or Ethnicity: White
Sexual orientation: Straight
Occupation: Computer Programmer
Nationality: Finland
Executive summary: Created the kernel for theGNU/Linux OS
Father: Nils Torvalds (reporter)
Mother: Anna Torvalds (translator)
Wife: Tove Torvalds (kindergarten teacher, karate champion, three daughters)
Daughter: Patricia Miranda Torvalds (b. 5-Dec-1996)
Daughter: Daniela Yolanda Torvalds (b. 16-Apr-1998)
Daughter: Celeste Amanda Torvalds (b. 20-Nov-2000)
University: MS Computer Science, University of Helsinki
Transmeta (1997-2003)
World Technology Network
EFF Pioneer Award 1998
Animal Bite fairy penguin, Australia (c. 1993)
Naturalized US Citizen 2010
FILMOGRAPHY AS ACTOR
Revolution OS (15-Feb-2002) · Himself
更多推荐
所有评论(0)