Uname -m and arch

Geoffrey Noer noer@cygnus.com
Sat May 31 05:36:00 GMT 1997


[...]
> Perhaps a way to set this if you have a specific need, and default to i486
> or something otherwise?
[...]
Following is a replacement winsup/uname.cc for those who care.
-- 
Geoffrey Noer
noer@cygnus.com
------------------------------> snip <-----------------------------------
/* uname.cc: uname for WIN32.
 Copyright 1996, 1997 Cygnus Solutions
 Written by Steve Chamberlain of Cygnus Support
 Rewritten by Geoffrey Noer of Cygnus Solutions
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <string.h>
#include <stdio.h>
#include <sys/utsname.h>
#include "winsup.h"
extern "C"
int
uname (struct utsname *name)
{
 DWORD len, version;
 SYSTEM_INFO sysinfo;
 GetSystemInfo (&sysinfo);
 /* name of computer */
 memset (name, 0, sizeof (*name));
 len = sizeof (name->nodename) - 1;
 GetComputerNameA (name->nodename, &len);
 /* operating system type */
 if (windows_95 ())
 strcpy (name->sysname, "CYGWIN32/95");
 else
 strcpy (name->sysname, "CYGWIN32/NT");
 /* operating system revision */
 version = GetVersion ();
 sprintf (name->release, "%d.%d", version & 255, (version >> 8) & 255);
 /* Cygwin32 dll revision */
 sprintf (name->version, "%d.%d",
	 CYGWIN_DLL_VERSION_MAJOR, CYGWIN_DLL_VERSION_MINOR);
 /* CPU type */
 switch (sysinfo.u.s.wProcessorArchitecture)
 {
 case PROCESSOR_ARCHITECTURE_INTEL:
 /* But which of the x86 chips are we? */
 if (windows_95 ())
 {
 /* dwProcessorType only valid in Windows 95 */
 if ((sysinfo.dwProcessorType == PROCESSOR_INTEL_386) ||
 (sysinfo.dwProcessorType == PROCESSOR_INTEL_486) ||
 (sysinfo.dwProcessorType == PROCESSOR_INTEL_PENTIUM))
 sprintf (name->machine, "i%d", sysinfo.dwProcessorType);
 else
 strcpy (name->machine, "unknown");
 }
 else
 {
 /* wProcessorLevel only valid in Windows NT */
 sprintf (name->machine, "i%d86", sysinfo.wProcessorLevel);
 }
 break;
 case PROCESSOR_ARCHITECTURE_PPC:
 strcpy (name->machine, "ppc");
 break;
 case PROCESSOR_ARCHITECTURE_ALPHA:
 strcpy (name->machine, "alpha");
 break;
 case PROCESSOR_ARCHITECTURE_MIPS:
 strcpy (name->machine, "mips");
 break;
 default:
 sprintf (name->machine, "unknown");
 break;
 }
 return 0;
}
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /