delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/05/31/07:44:03

From: noer AT cygnus DOT com (Geoffrey Noer)
Subject: Re: Uname -m and arch
31 May 1997 07:44:03 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199705302340.QAA21886.cygnus.gnu-win32@cirdan.cygnus.com>
Original-To: loki AT dragoncat DOT net (Jeremy Blackman)
Original-Cc: gnu-win32 AT cygnus DOT com
In-Reply-To: <Pine.LNX.3.95.970529224053.3269B-100000@herne.dragoncat.net> from "Jeremy Blackman" at May 29, 97 10:43:24 pm
X-Mailer: ELM [version 2.4 PL23]
Original-Sender: owner-gnu-win32 AT cygnus DOT com

[...]
> 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 AT cygnus DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019