2014-03-07 :-(
_ 午後
1300 デバッグしTARI
_ [CPU][アーキテクチャ][NetBSD][MACHINE_ARCH]MACHINE_ARCH とは
MACHINE_ARCH の一覧はどこかで取得できるのか?
build.sh では MACHINE_ARCH が設定されてなければ uname を呼び出す。
# Find information about the build platform. This should be # kept in sync with _HOST_OSNAME, _HOST_OSREL, and _HOST_ARCH # variables in share/mk/bsd.sys.mk. # # Note that "uname -p" is not part of POSIX, but we want uname_p # to be set to the host MACHINE_ARCH, if possible. On systems # where "uname -p" fails, prints "unknown", or prints a string # that does not look like an identifier, fall back to using the # output from "uname -m" instead. # uname_s=$(uname -s 2>/dev/null) uname_r=$(uname -r 2>/dev/null) uname_m=$(uname -m 2>/dev/null) uname_p=$(uname -p 2>/dev/null || echo "unknown") case "${uname_p}" in ''|unknown|*[^-_A-Za-z0-9]*) uname_p="${uname_m}" ;; esac
uname(1) (/usr/bin/uname) は uname(3) (libc) を呼び出している。
CVS log for src/usr.bin/uname/uname.c
if (uname(&u) != 0) { err(EXIT_FAILURE, "uname"); /* NOTREACHED */ }
uname(3) (libc) は sysctl を呼び出している
CVS log for src/lib/libc/gen/uname.c
int uname(struct utsname *name) { int mib[2]; size_t len; char *p; _DIAGASSERT(name != NULL); mib[0] = CTL_KERN; mib[1] = KERN_OSTYPE; len = sizeof(name->sysname); if (sysctl(mib, 2, &name->sysname, &len, NULL, 0) == -1) goto error; mib[0] = CTL_KERN; mib[1] = KERN_HOSTNAME; len = sizeof(name->nodename); if (sysctl(mib, 2, &name->nodename, &len, NULL, 0) == -1) goto error; mib[0] = CTL_KERN; mib[1] = KERN_OSRELEASE; len = sizeof(name->release); if (sysctl(mib, 2, &name->release, &len, NULL, 0) == -1) goto error; mib[0] = CTL_KERN; mib[1] = KERN_VERSION; len = sizeof(name->version); if (sysctl(mib, 2, &name->version, &len, NULL, 0) == -1) goto error; /* The version may have newlines in it, turn them into spaces. */ for (p = name->version; len--; ++p) { if (*p == '\n' || *p == '\t') { if (len > 1) *p = ' '; else *p = '\0'; } } mib[0] = CTL_HW; mib[1] = HW_MACHINE; len = sizeof(name->machine); if (sysctl(mib, 2, &name->machine, &len, NULL, 0) == -1) goto error; return (0); error: return (-1); }
ふうむ
アーキテクチャ一覧はここ
CVS log for src/sys/arch/README
port cpu の並び
ここにも同じものがあるんです
_ [CPU][アーキテクチャ][ruby][NetBSD][MACHINE_ARCH]アーキテクチャ一覧
#: coding utf-8 # # for NetBSD # # buildall.rb /usr/src/sys/arch/README # def get_all_arch(arch_readme) :ST_DELIM1 :ST_DELIM2 st = :ST_DELIM1 archs ||= [] lines = File.open(arch_readme).readlines() lines.each {|line| case st when :ST_DELIM1 if line =~ /\A\Z/ st = :ST_DELIM2 end when :ST_DELIM2 if line =~ /\A\Z/ break else sp = line.split() archs << sp[0] end end } return archs end def main(argv) arch_readme = argv[0] archs = get_all_arch(arch_readme) puts archs end main(ARGV)
% ruby buildall.rb /usr/src/sys/arch/README acorn26 acorn32 algor alpha amd64 amiga amigappc arc atari bebox cats cesfic cobalt dreamcast emips evbarm evbmips evbppc evbsh3 ews4800mips hp300 hp700 hpcarm hpcmips hpcsh i386 ia64 ibmnws iyonix landisk luna68k mac68k macppc mipsco mmeye mvme68k mvmeppc netwinder news68k newsmips next68k ofppc pmax prep rs6000 sandpoint sbmips sgimips shark sparc sparc64 sun2 sun3 vax x68k xen zaurus