Which files uname utility uses to get information?

Looks to me like it grabs it using sysctl(3).

See also /usr/src/usr.bin/uname/uname.c or your friendly, local snv server.

Additionally, look perhaps at the kern.version, kern.ostype, kern.osrelease, kern.osrevision sysctls, too.


Edit: So, I guess the answer is that uname(1) reads from a file called /boot/kernel/kernel . . .
 
It queries running kernel. You can alter the output via environ()ment variables.
Code:
$ [man]ktrace[/man] -ty uname -a
FreeBSD raphael.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r213322 22d6ef5-dirty Fri Oct  1 19:43:24 UTC 2010   holo@raphael.local:/a/objdir/a/dirty_build/sys/PHOENIX  amd64
$ [man]kdump[/man]
 40948 uname    SCTL  "kern.ostype"
 40948 uname    SCTL  "kern.hostname"
 40948 uname    SCTL  "kern.osrelease"
 40948 uname    SCTL  "kern.version"
 40948 uname    SCTL  "hw.machine"
$ export UNAME_m= UNAME_n= UNAME_r= UNAME_s= UNAME_v=
$ ktrace -ty uname -a

$ kdump
$ unset UNAME_m UNAME_n UNAME_r UNAME_s UNAME_v
 
franklin321 said:
By the way, I would like to change holo@raphael.local to something else, how can I bring that change?
It's the user account and hostname of the system that built the kernel.

NB. Please don't double post.
 
Back
Top