From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1012a6,5120b503df4ed78f X-Google-Attributes: gid1012a6,public X-Google-Thread: 10b612,5120b503df4ed78f X-Google-Attributes: gid10b612,public X-Google-Thread: 115614,5120b503df4ed78f X-Google-Attributes: gid115614,public X-Google-Thread: 11035d,5120b503df4ed78f X-Google-Attributes: gid11035d,public X-Google-Thread: 1070f0,5120b503df4ed78f X-Google-Attributes: gid1070f0,public X-Google-Thread: 1020c6,5120b503df4ed78f X-Google-Attributes: gid1020c6,public X-Google-Thread: 1164f8,5120b503df4ed78f X-Google-Attributes: gid1164f8,public From: guy@netapp.com (Guy Harris) Subject: Re: Portable startup files question.. Date: 1995/05/26 Message-ID: <3q5mhi$hdf@nova.netapp.com>#1/1 X-Deja-AN: 103352822 distribution: inet references: <3q2ikp$ju@nova.netapp.com> followup-to: comp.unix.shell organization: Network Appliance Corporation newsgroups: comp.unix.solaris,comp.unix.ultrix,comp.unix.admin,comp.unix.shell,comp.unix.aix,comp.sys.sun.admin,comp.sys.dec [followups to "comp.unix.shell", as that's probably the group in which this is most appropriate] Thanh Ma wrote: [unnecessarily-included copy of the entire previous posting deleted] >$ uname -s >UNIX_SV >$ uname -n >infcons >$ uname -r >4.2MP >$ uname -v >2.01 >$ uname -m >i386 >$ uname -p >x86at I.e., "uname -m" gives the instruction-set architecture, but "uname -p" gives some indication of the type of machine - if "x86at" means "x86-instruction-set-architecture-based machine remotely descended from the IBM PC/AT", i.e. "IBM-compatible PC", then I guess it counts as the "kernel architecture". I *thought* I'd remembered that x86 SVR4 swapped "uname -m" and "uname -p" from what at least some other flavors of SVR4 (e.g., SunOS 5.x) did on non-x86 platforms; alas, it appears I was correct. Sigh.... I suspect SunOS 5.x on IBM-compatible PC's does as other SVR4-flavored UNIXes do; if so, then the cases for SunOS 5.x, and for "UNIX_SV", should do something such as check whether "uname -m" is "i386" and, if so, use *that* as the architecture, and otherwise use "uname -p" - unless, of course, SVR4s on some *other* platforms act like x86 SVR4 rather than other SVR4's. Note that BSD/OS 1.1 doesn't support "uname -p", but has a "uname -m" that produces "i386", so it'd fall into the same category: % uname -p uname: illegal option -- p usage: uname [-snrvma] % uname -m i386 % uname -s BSD/386 (BSD/OS 1.x was called "BSD/386" as it was PC-only; 2.x may get a port to some SPARC machines and possibly others, and may call itself "BSD/OS"). However, on at least one Linux system, "uname -m" appears to say what *flavor* of x86 chip you have, rather than that you have a chip that supports the 32-bit version of the x86 architecture by saying "i386", so on Linux (on which, at least one Linux system, "uname -s" prints "Linux"), you have to handle "i586" and probably "i486" and map them to "i386" (unless you really give a damn about the tiny additions the 486 and Pentium made to the user-mode instruction set). At times, I want to send the folks who did "uname" commands and "uname()" calls on various flavors of Unix to the penal colony in Kafka's "In the Penal Colony", and set the machine to carve "give 'uname' an option to print out the ABI/instruction set architecture" into their backs.... (And, no, POSIX doesn't help. 1003.2-1992 says "uname -m" should "Write the name of the hardware type on which the system is running to standard output", but I don't see any mention of "hardware type" in the index, so I suspect they don't define it - probably so no system would actually have to fix its behavior, even if that renders "uname -m" not convenient to use in, oh, say, a *PORTABLE STARTUP SCRIPT* such as the original poster wanted. 1003.1b-1993 says pretty much the same thing for "uname()".)