what is the purpose of the magic number in linux reboots? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
On the Wikipedia page for Linus Torvalds, it states that:
'The Linux kernel's reboot system call accepts their dates of birth (written in hexadecimal) as magic values'.
And documentation for the Linux reboot function shows that it needs two magic numbers, 'magic' and 'magic2' too reboot.
What is the purpose of these magic numbers? Why can't the function operate without them?
Thanks

A quick google of your question yields the answer;
http://www.eeggs.com/items/44291.html
In order to prevent the reboot() system call being
called inadvertently, you must pass it a pair of magic values in the first two parameters. The first magic value is 0xfee1dead. The second magic value
is one of:
$ grep LINUX_REBOOT_MAGIC include/linux/*.h
include/linux/reboot.h:#define LINUX_REBOOT_MAGIC1 0xfee1dead
include/linux/reboot.h:#define LINUX_REBOOT_MAGIC2 672274793
include/linux/reboot.h:#define LINUX_REBOOT_MAGIC2A 85072278
include/linux/reboot.h:#define LINUX_REBOOT_MAGIC2B 369367448
include/linux/reboot.h:#define LINUX_REBOOT_MAGIC2C 537993216
These are dates of significance to Linus; hint
you can use perl to convert them into dates:
$ perl -e 'print localtime(672274793). "\n";'
Sun Apr 21 18:59:53 1991
This is the date that Linus first started writing Linux. The significance of other dates is left as an exercise for the reader ;-)

Related

Linux/Debian equivalent of macOS's date -jf, set source date format? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I have a date in the format of 201908270700 but need to change it to yyyy/mm/dd hh:mm, when googling I find lots of solutions to do this with the macOS command line, but not many for linux, at least not a simple solution.
On macOS you can do date -jf "%Y%m%d%H%M" "201908270700" "+%Y/%m/%d %H:%M" and it'll return 2019/08/27 07:00, but looking at the GNU date man page, there is no equivalent option on Linux, or is there?
With the date in a variable, it's easy to format into a form the GNU coreutils date(1) understands:
$ dt=201908270700
$ date -d"${dt:0:8} ${dt:8:4}" "+%Y/%m/%d %H:%M"
2019/08/27 07:00
This splits the date and time up into separate elements, which can then be parsed according to the rules for pure numbers in the coreutils documentation.

What does the number in linux/Unix file permissions like "-rw-rw-r--. 1" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I am Linux student, I am learning Linux permission system for user and group. one thing is still unclear, when I check permission using ls -l command it shows a numerical value with permission detail like this
-rw-rw-r--. 1 ...
So my question is:
What does that numerical value means in ls -l output
Though it will be more pleasure to have some explanation with the answer as I am a new bee.
I have tried to find the answer from book, and searched the same question on stack-overflow. But not getting the understanding.
The 1 indicates the number of links. The definition of link varies among platforms, however you may assume it is the count of hard links to this entry.

Linux command needing translating [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have just started learning the Linux system and I need some help to translate the following to English:
grep WARNING readme.txt
and
grep WARNING readme.txt > warnings.txt
This is a homework question that i have researched myself but having trouble learning exactly what it means.
thanks in advance.
Try making a file on your computer named readme.txt. Put some lines of text in there, and make sure that some lines say "WARNING" while other lines do not.
Then run your first command and observe its output.
Then run your second command and observe its output and observe what was written to warnings.txt.

Why do different environtments contain different command line options when calling man -ls? (environments: codecademy, cb.vu) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Why do different environments contain different command line options when calling man ls?
codecademy
cb.vu
Does it mean that I should just use man command with options before using the bash options for each new environment which I use?
There's nothing magical about ls - it's a program just like any other program. Specifically, one that' been around for a long time. as such, different environments may have slightly different versions or even different forks of it. It's usually safe to assume the common options (such as -l) would be available anywhere, but when in doubt - you should double check.

how to get ptree visualize tool? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I saw a tutorial which use "ptree" tool to draw the tree graph (shown below)
but when I use the same tool, the result is not the same as above
my OS is ubuntu 11.10, does any one know about it??
google the keyword "ptree" does not return useful information
thank you
The command ptree on your second machine is a completely different tool which has (by coincidence) the same name as your ptree on the first machine.
On the first machine you are using a tool which parses an ascii representation of a tree and prints it in a graphical fashion.
On the second machine you are using a tool from the package adacontrol which is about the language Ada and can print the logical nestings of ASIS statements.
I guess these two tools are not the same.
Maybe you can find out where the tool on the first computer came from?

Resources