From owner-freebsd-arch Sat Jan 12 0:33:55 2002 Delivered-To: freebsd-arch@freebsd.org Received: from watery.cc.kogakuin.ac.jp (watery.cc.kogakuin.ac.jp [133.80.152.80]) by hub.freebsd.org (Postfix) with ESMTP id AC7F937B404; Sat, 12 Jan 2002 00:33:48 -0800 (PST) Received: from localhost (localhost [::1]) by watery.cc.kogakuin.ac.jp (8.11.5/8.11.5) with ESMTP id g0C8Xl568832; Sat, 12 Jan 2002 17:33:47 +0900 (JST) (envelope-from nyan@FreeBSD.org) Date: Sat, 12 Jan 2002 17:32:48 +0900 (JST) Message-Id: <20020112.173248.74673114.yosihiro@cc.kogakuin.ac.jp> To: ru@FreeBSD.org Cc: kato@FreeBSD.org, arch@FreeBSD.org Subject: Re: hw.machine on PC98 From: Takahashi Yoshihiro In-Reply-To: <20011217192100.A31562@sunbay.com> References: <20011214173056.A94075@sunbay.com> <20011217.233630.74667853.yosihiro@cc.kogakuin.ac.jp> <20011217192100.A31562@sunbay.com> X-Mailer: Mew version 2.2rc1 on Emacs 20.7 / Mule 4.0 =?iso-2022-jp?B?KBskQjJWMWMbKEIp?= Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Sat_Jan_12_17:32:48_2002_364)--" Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----Next_Part(Sat_Jan_12_17:32:48_2002_364)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit In article <20011217192100.A31562@sunbay.com> Ruslan Ermilov writes: > uname -m should print the value of hw.machine > uname -p should print the value of hw.machine_arch > > I will probably add the -p option handling, if nobody beats me to it. I have made a patch to add -p option to uname(1) for printing machine_arch. If it has no problem, I will commit it. --- TAKAHASHI Yoshihiro THE CENTER for INFORMATION SCIENCE, Kogakuin Univ. ----Next_Part(Sat_Jan_12_17:32:48_2002_364)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uname.diff" Index: uname.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/uname/uname.1,v retrieving revision 1.9 diff -u -r1.9 uname.1 --- uname.1 15 Aug 2001 09:09:44 -0000 1.9 +++ uname.1 12 Jan 2002 08:04:47 -0000 @@ -65,9 +65,7 @@ .It Fl n Write the name of the system to standard output. .It Fl p -Writes out the same value as -.Fl m . -This option is provided for backward compatibility with SVR4. +Write the type of the machine processor architecture to standard output. .It Fl r Write the current release level of the operating system to standard output. Index: uname.c =================================================================== RCS file: /home/ncvs/src/usr.bin/uname/uname.c,v retrieving revision 1.5 diff -u -r1.5 uname.c --- uname.c 11 Dec 2001 23:16:25 -0000 1.5 +++ uname.c 12 Jan 2002 08:05:52 -0000 @@ -62,9 +62,10 @@ { #define MFLAG 0x01 #define NFLAG 0x02 -#define RFLAG 0x04 -#define SFLAG 0x08 -#define VFLAG 0x10 +#define PFLAG 0x04 +#define RFLAG 0x08 +#define SFLAG 0x10 +#define VFLAG 0x20 u_int flags; int ch, mib[2]; size_t len, tlen; @@ -77,13 +78,15 @@ case 'a': flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG); break; - case 'p': case 'm': flags |= MFLAG; break; case 'n': flags |= NFLAG; break; + case 'p': + flags |= PFLAG; + break; case 'r': flags |= RFLAG; break; @@ -157,6 +160,15 @@ (void)printf("%s%.*s", prefix, (int)len, buf); prefix = " "; } + if (flags & PFLAG) { + mib[0] = CTL_HW; + mib[1] = HW_MACHINE_ARCH; + len = sizeof(buf); + if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1) + err(1, "sysctl"); + (void)printf("%s%.*s", prefix, (int)len, buf); + prefix = " "; + } (void)printf("\n"); exit (0); } @@ -164,6 +176,6 @@ void usage() { - (void)fprintf(stderr, "usage: uname [-amnrsv]\n"); + (void)fprintf(stderr, "usage: uname [-amnprsv]\n"); exit(1); } ----Next_Part(Sat_Jan_12_17:32:48_2002_364)---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message