machid.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1993-1994, by Sun Microsystems, Inc.
*/
/*
* This program replicates the function of the links from a machine name
* knows the correct special cases.
*
* IMPORTANT NOTE:
*
* Do not modify this program to know about additional special cases or
* reflect new platforms or instruction set architectures. This is a
* deprecated interface and strictly for backwards compatibility. This
* is psarc/1992/171. Note the following excerpt from the opinion:
*
* It is most important to note that the manual page states in
* the NOTES section: "The machid family of commands is
* obsolete. Use uname -p and uname -m instead."
*
* The intent of Kernel Architecture Project team is to provide
* only enough functionality to mimic the existing definitions
* on the SPARC and Intel x86 versions of Solaris 2.x. No new
* identifiers will ever be added to the documented and
* undocumented identifiers listed above.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <sys/systeminfo.h>
static char static_buf[SYS_NMLN];
static char *progname;
/* ARGSUSED */
int
{
char *buf = &static_buf[0];
else
progname++;
/*
* First possible match is on the processor type.
*
* Special case for architectures: i386 matches i486 and visa versa.
*/
return (0);
return (0);
/*
* Next possible match is the machine, or more exactly, the value
* which would be returned by uname(2) in the machine field or uname(1)
* with the -m option. For historical reasons this is really is
* often a class of platforms which are identical to userland processes
* such as sun4c, sun4m, etc.
*/
return (0);
/*
* Finally, match the vendor. We hardwire in one historical match.
*/
return (0);
return (0);
return (255);
}
/*
* get_info_item is a wrapper around the sysinfo system call. It makes sure
* the buffer is large enough, returning a larger buffer if needed. On
* unrecoverable error, it exits. An error message doesn't help and makes
* this tiny program link stdio and maybe deal with internationalization,
* so the best thing is to die silently. Note that the larger buffer is
* retained for later use. Reality is that the buffer will always be big
* enough, but this is coded to the spec rather than implementation.
*/
static void
{
long error;
if (*buf != static_buf) {
}
}
if (error == -1)
exit(-1);
}