/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/systeminfo.h>
#include <sys/cpuid_drv.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <errno.h>
#include <libintl.h>
#include <locale.h>
#include <fcntl.h>
#include <elfcap.h>
static char *pgmname;
static int mode = 0;
static char *
{
char *buf;
long ret;
return (NULL);
do {
if (ret == -1)
return (NULL);
} else
break;
return (buf);
}
/*
* Classify isa's as to bitness of the corresponding ABIs.
* isa's which have no "official" Solaris ABI are returned
* unrecognised i.e. "zero bit".
*/
static uint_t
{
return (32);
return (64);
return (0);
}
static char *
{
char *isa;
return (0);
gettext("%s: unable to identify isa '%s'!\n"),
exit(3);
}
if (mode & VERBOSE_MODE)
else
return (isa);
}
/*
* Classify isas as their machine type.
*/
static ushort_t
{
return (EM_SPARC);
return (EM_SPARCV9);
return (EM_386);
return (EM_AMD64);
return (0);
}
static void
{
return;
else
cap2[0] = '\0';
(void) printf(":");
(void) printf("\n");
} else {
char *p;
int linecnt = 0;
(void) printf("\n");
linecnt = 0;
}
if (linecnt == 0)
}
(void) printf("\n");
linecnt = 0;
}
if (linecnt == 0)
}
if (linecnt != 0)
(void) printf("\n");
}
}
#if !defined(TEXT_DOMAIN)
#endif
int
{
int errflg = 0;
int c;
char *vfmt;
int d = -1;
(void) textdomain(TEXT_DOMAIN);
else
pgmname++;
switch (c) {
case 'n':
if (mode & excl_modes)
errflg++;
mode |= NATIVE_MODE;
break;
case 'b':
if (mode & excl_modes)
errflg++;
break;
case 'k':
if (mode & excl_modes)
errflg++;
break;
case 'x':
errflg++;
break;
case 'v':
errflg++;
mode |= VERBOSE_MODE;
break;
case '?':
default:
errflg++;
break;
}
gettext("usage: %s [ [-v] [-b | -n | -k] | [-x] ]\n"),
pgmname);
return (1);
}
/*
* We use dev_cpu_self_cpuid for discovering hardware capabilities;
* but we only complain if we can't open it if we've been
* asked to report on those capabilities.
*/
return (0);
}
report_hwcap(d, isa);
} else {
report_hwcap(d, isa);
else
(void) putchar(' ');
}
report_hwcap(d, isa32);
}
(void) putchar('\n');
}
return (0);
}