Subject: Re: Uname -m and arch
From: [email-masked] (Geoffrey Noer)

31 May 1997 07:44:03 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Content-Type: text
Original-To: [email-masked] (Jeremy Blackman)
Original-Cc: [email-masked]
In-Reply-To: <[email-masked]> from "Jeremy Blackman" at May 29, 97 10:43:24 pm
X-Mailer: ELM [version 2.4 PL23]
Original-Sender: [email-masked]

[...]
> 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
[email-masked]

------------------------------> 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
"[email-masked]" with one line of text: "help".