summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/lib/libstand/cd9660.c11
-rw-r--r--usr/src/boot/lib/libstand/net.h2
-rw-r--r--usr/src/boot/lib/libstand/nfs.c12
-rw-r--r--usr/src/boot/lib/libstand/nullfs.c28
-rw-r--r--usr/src/boot/lib/libstand/stand.h9
-rw-r--r--usr/src/boot/lib/libstand/tftp.c10
-rw-r--r--usr/src/boot/lib/libstand/ufs.c13
-rw-r--r--usr/src/boot/lib/libstand/write.c9
-rw-r--r--usr/src/boot/sys/boot/userboot/userboot/host.c15
-rw-r--r--usr/src/boot/sys/boot/zfs/zfs.c13
-rw-r--r--usr/src/cmd/awk/b.c3
-rw-r--r--usr/src/cmd/awk_xpg4/awk.h6
-rw-r--r--usr/src/cmd/awk_xpg4/awk1.c16
-rw-r--r--usr/src/cmd/awk_xpg4/awk3.c9
-rw-r--r--usr/src/cmd/awk_xpg4/awk4.c5
-rw-r--r--usr/src/cmd/boot/installgrub/pcfs_glue.c2
-rw-r--r--usr/src/cmd/dladm/dladm.c5
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/validate.c2
-rw-r--r--usr/src/cmd/oamuser/user/homedir.c2
-rw-r--r--usr/src/cmd/power/handlers.c2
-rw-r--r--usr/src/cmd/praudit/format.c158
-rw-r--r--usr/src/cmd/print/scripts/ppdmgr2
-rw-r--r--usr/src/cmd/uname/uname.c26
-rw-r--r--usr/src/cmd/zfs/zfs_main.c2
-rw-r--r--usr/src/cmd/zpool/zpool_main.c2
-rw-r--r--usr/src/common/ficl/float.c2
-rw-r--r--usr/src/head/rpcsvc/rusers.x2
-rw-r--r--usr/src/lib/brand/shared/zone/common.ksh2
-rw-r--r--usr/src/lib/gss_mechs/mech_krb5/krb5/os/accessor.c11
-rw-r--r--usr/src/lib/libast/common/RELEASE2
-rw-r--r--usr/src/lib/libdtrace/common/dt_parser.h2
-rw-r--r--usr/src/lib/libsqlite/src/expr.c8
-rw-r--r--usr/src/lib/libsqlite/src/insert.c5
-rw-r--r--usr/src/lib/libsqlite/src/select.c6
-rw-r--r--usr/src/lib/libsqlite/src/tokenize.c5
-rw-r--r--usr/src/lib/libsqlite/src/vdbe.c4
-rw-r--r--usr/src/lib/libsqlite/src/vdbeaux.c5
-rw-r--r--usr/src/lib/libsqlite/tool/lemon.c5
-rw-r--r--usr/src/lib/libv12n/sparc/libv12n.c2
-rw-r--r--usr/src/lib/libxcurses/h/posix/mkslocal.h4
-rw-r--r--usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c2
-rw-r--r--usr/src/man/man1/uname.1369
-rw-r--r--usr/src/man/man5/privileges.54
-rw-r--r--usr/src/pkg/manifests/diagnostic-cpu-counters.mf4
-rw-r--r--usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_pos.ksh3
-rw-r--r--usr/src/test/zfs-tests/tests/functional/refquota/refquota_004_pos.ksh2
-rw-r--r--usr/src/test/zfs-tests/tests/functional/refquota/refquota_005_pos.ksh2
-rw-r--r--usr/src/test/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh2
-rw-r--r--usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_003_neg.ksh2
-rw-r--r--usr/src/tools/scripts/nightly.sh7
-rw-r--r--usr/src/uts/common/avs/ns/sdbc/dynmem_readme.txt2
-rw-r--r--usr/src/uts/common/fs/ctfs/ctfs_root.c2
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_server.c2
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_acl.c2
-rw-r--r--usr/src/uts/common/io/fd.c6
-rw-r--r--usr/src/uts/common/io/fibre-channel/fca/qlge/qlge_dbg.c4
-rw-r--r--usr/src/uts/common/io/ksocket/ksocket.c2
-rw-r--r--usr/src/uts/common/os/zone.c3
-rw-r--r--usr/src/uts/common/sys/fs/ufs_lockfs.h4
-rw-r--r--usr/src/uts/common/vm/vpm.c2
-rw-r--r--usr/src/uts/intel/Makefile.files7
-rw-r--r--usr/src/uts/intel/Makefile.intel4
-rw-r--r--usr/src/uts/intel/ia32/os/sysi86.c2
-rw-r--r--usr/src/uts/intel/io/agpgart/agpgart.c2
-rw-r--r--usr/src/uts/intel/io/dktp/controller/ata/ata_common.c12
-rw-r--r--usr/src/uts/intel/io/dktp/controller/ata/sil3xxx.c9
-rw-r--r--usr/src/uts/intel/p123_pcbe/Makefile93
-rw-r--r--usr/src/uts/intel/pcbe/p123_pcbe.c1091
-rw-r--r--usr/src/uts/intel/sys/x86_archext.h23
70 files changed, 432 insertions, 1668 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index af557cc15f..6b7ed90fc4 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -33,4 +33,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2018.2.22.1
+BOOT_VERSION = $(LOADER_VERSION)-2018.2.24.1
diff --git a/usr/src/boot/lib/libstand/cd9660.c b/usr/src/boot/lib/libstand/cd9660.c
index 8b8aa36d6c..845df147cd 100644
--- a/usr/src/boot/lib/libstand/cd9660.c
+++ b/usr/src/boot/lib/libstand/cd9660.c
@@ -32,7 +32,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
/*
* Stand-alone ISO9660 file reading package.
@@ -66,8 +65,6 @@ static int cd9660_open(const char *path, struct open_file *f);
static int cd9660_close(struct open_file *f);
static int cd9660_read(struct open_file *f, void *buf, size_t size,
size_t *resid);
-static int cd9660_write(struct open_file *f, void *buf, size_t size,
- size_t *resid);
static off_t cd9660_seek(struct open_file *f, off_t offset, int where);
static int cd9660_stat(struct open_file *f, struct stat *sb);
static int cd9660_readdir(struct open_file *f, struct dirent *d);
@@ -86,7 +83,7 @@ struct fs_ops cd9660_fsops = {
cd9660_open,
cd9660_close,
cd9660_read,
- cd9660_write,
+ null_write,
cd9660_seek,
cd9660_stat,
cd9660_readdir
@@ -556,12 +553,6 @@ again:
return (0);
}
-static int
-cd9660_write(struct open_file *f __unused, void *start __unused, size_t size __unused, size_t *resid __unused)
-{
- return EROFS;
-}
-
static off_t
cd9660_seek(struct open_file *f, off_t offset, int where)
{
diff --git a/usr/src/boot/lib/libstand/net.h b/usr/src/boot/lib/libstand/net.h
index 87228f5592..733206ec92 100644
--- a/usr/src/boot/lib/libstand/net.h
+++ b/usr/src/boot/lib/libstand/net.h
@@ -125,6 +125,4 @@ char *inet_ntoa(struct in_addr);
char *intoa(n_long); /* similar to inet_ntoa */
n_long inet_addr(char *);
-/* Machine-dependent functions: */
-time_t getsecs(void);
#endif /* ! _STAND_NET_H */
diff --git a/usr/src/boot/lib/libstand/nfs.c b/usr/src/boot/lib/libstand/nfs.c
index 27f7f182f4..1cf8f5af0b 100644
--- a/usr/src/boot/lib/libstand/nfs.c
+++ b/usr/src/boot/lib/libstand/nfs.c
@@ -125,7 +125,6 @@ struct nfs_iodesc {
int nfs_open(const char *path, struct open_file *f);
static int nfs_close(struct open_file *f);
static int nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid);
-static int nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid);
static off_t nfs_seek(struct open_file *f, off_t offset, int where);
static int nfs_stat(struct open_file *f, struct stat *sb);
static int nfs_readdir(struct open_file *f, struct dirent *d);
@@ -137,7 +136,7 @@ struct fs_ops nfs_fsops = {
nfs_open,
nfs_close,
nfs_read,
- nfs_write,
+ null_write,
nfs_seek,
nfs_stat,
nfs_readdir
@@ -704,15 +703,6 @@ ret:
return (0);
}
-/*
- * Not implemented.
- */
-int
-nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
-{
- return (EROFS);
-}
-
off_t
nfs_seek(struct open_file *f, off_t offset, int where)
{
diff --git a/usr/src/boot/lib/libstand/nullfs.c b/usr/src/boot/lib/libstand/nullfs.c
index e4c0b7cbc4..78b0940ba8 100644
--- a/usr/src/boot/lib/libstand/nullfs.c
+++ b/usr/src/boot/lib/libstand/nullfs.c
@@ -1,6 +1,6 @@
/* $NetBSD: nullfs.c,v 1.1 1996/01/13 22:25:39 leo Exp $ */
-/*-
+/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -15,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -61,45 +61,51 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include "stand.h"
/*
* Null filesystem
*/
-int null_open (const char *path, struct open_file *f)
+int
+null_open(const char *path, struct open_file *f)
{
return EINVAL;
}
-int null_close(struct open_file *f)
+int
+null_close(struct open_file *f)
{
return 0;
}
-int null_read (struct open_file *f, void *buf, size_t size, size_t *resid)
+int
+null_read(struct open_file *f, void *buf, size_t size, size_t *resid)
{
return EIO;
}
-int null_write (struct open_file *f, void *buf, size_t size, size_t *resid)
+int
+null_write(struct open_file *f, const void *buf, size_t size, size_t *resid)
{
- return EIO;
+ return EROFS;
}
-off_t null_seek (struct open_file *f, off_t offset, int where)
+off_t
+null_seek(struct open_file *f, off_t offset, int where)
{
errno = EIO;
return -1;
}
-int null_stat (struct open_file *f, struct stat *sb)
+int
+null_stat(struct open_file *f, struct stat *sb)
{
return EIO;
}
-int null_readdir(struct open_file *f, struct dirent *d)
+int
+null_readdir(struct open_file *f, struct dirent *d)
{
return EIO;
}
diff --git a/usr/src/boot/lib/libstand/stand.h b/usr/src/boot/lib/libstand/stand.h
index 00b4ac210c..c445d684a1 100644
--- a/usr/src/boot/lib/libstand/stand.h
+++ b/usr/src/boot/lib/libstand/stand.h
@@ -27,7 +27,7 @@
* From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $
*/
-/*-
+/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -104,7 +104,7 @@ struct fs_ops {
int (*fo_close)(struct open_file *f);
int (*fo_read)(struct open_file *f, void *buf,
size_t size, size_t *resid);
- int (*fo_write)(struct open_file *f, void *buf,
+ int (*fo_write)(struct open_file *f, const void *buf,
size_t size, size_t *resid);
off_t (*fo_seek)(struct open_file *f, off_t offset, int where);
int (*fo_stat)(struct open_file *f, struct stat *sb);
@@ -282,7 +282,7 @@ extern int open(const char *, int);
extern int close(int);
extern void closeall(void);
extern ssize_t read(int, void *, size_t);
-extern ssize_t write(int, void *, size_t);
+extern ssize_t write(int, const void *, size_t);
extern struct dirent *readdirfd(int);
extern void srandom(u_long seed);
@@ -369,7 +369,7 @@ extern void nullsys(void);
extern int null_open(const char *path, struct open_file *f);
extern int null_close(struct open_file *f);
extern int null_read(struct open_file *f, void *buf, size_t size, size_t *resid);
-extern int null_write(struct open_file *f, void *buf, size_t size, size_t *resid);
+extern int null_write(struct open_file *f, const void *buf, size_t size, size_t *resid);
extern off_t null_seek(struct open_file *f, off_t offset, int where);
extern int null_stat(struct open_file *f, struct stat *sb);
extern int null_readdir(struct open_file *f, struct dirent *d);
@@ -385,6 +385,7 @@ extern void putchar(int);
extern int devopen(struct open_file *, const char *, const char **);
extern int devclose(struct open_file *f);
extern void panic(const char *, ...) __dead2 __printflike(1, 2);
+extern time_t getsecs(void);
extern struct fs_ops *file_system[];
extern struct fs_ops *exclusive_file_system;
extern struct devsw *devsw[];
diff --git a/usr/src/boot/lib/libstand/tftp.c b/usr/src/boot/lib/libstand/tftp.c
index 39cd1466fe..c1ce0e3b80 100644
--- a/usr/src/boot/lib/libstand/tftp.c
+++ b/usr/src/boot/lib/libstand/tftp.c
@@ -65,7 +65,6 @@ static int tftp_open(const char *path, struct open_file *f);
static int tftp_close(struct open_file *f);
static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len);
static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid);
-static int tftp_write(struct open_file *f, void *buf, size_t size, size_t *resid);
static off_t tftp_seek(struct open_file *f, off_t offset, int where);
static int tftp_set_blksize(struct tftp_handle *h, const char *str);
static int tftp_stat(struct open_file *f, struct stat *sb);
@@ -80,7 +79,7 @@ struct fs_ops tftp_fsops = {
tftp_open,
tftp_close,
tftp_read,
- tftp_write,
+ null_write,
tftp_seek,
tftp_stat,
null_readdir
@@ -563,13 +562,6 @@ tftp_close(struct open_file *f)
return (0);
}
-static int
-tftp_write(struct open_file *f __unused, void *start __unused, size_t size __unused,
- size_t *resid __unused /* out */)
-{
- return (EROFS);
-}
-
static int
tftp_stat(struct open_file *f, struct stat *sb)
{
diff --git a/usr/src/boot/lib/libstand/ufs.c b/usr/src/boot/lib/libstand/ufs.c
index 9a16c6b6e6..e31d9d55c9 100644
--- a/usr/src/boot/lib/libstand/ufs.c
+++ b/usr/src/boot/lib/libstand/ufs.c
@@ -1,6 +1,6 @@
/* $NetBSD: ufs.c,v 1.20 1998/03/01 07:15:39 ross Exp $ */
-/*-
+/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
* All rights reserved.
*
@@ -83,7 +83,8 @@
#include "string.h"
static int ufs_open(const char *path, struct open_file *f);
-static int ufs_write(struct open_file *f, void *buf, size_t size, size_t *resid);
+static int ufs_write(struct open_file *f, const void *buf, size_t size,
+ size_t *resid);
static int ufs_close(struct open_file *f);
static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid);
static off_t ufs_seek(struct open_file *f, off_t offset, int where);
@@ -130,7 +131,7 @@ struct file {
static int read_inode(ino_t, struct open_file *);
static int block_map(struct open_file *, ufs2_daddr_t, ufs2_daddr_t *);
static int buf_read_file(struct open_file *, char **, size_t *);
-static int buf_write_file(struct open_file *, char *, size_t *);
+static int buf_write_file(struct open_file *, const char *, size_t *);
static int search_directory(char *, struct open_file *, ino_t *);
/*
@@ -300,7 +301,7 @@ block_map(f, file_block, disk_block_p)
static int
buf_write_file(f, buf_p, size_p)
struct open_file *f;
- char *buf_p;
+ const char *buf_p;
size_t *size_p; /* out */
{
struct file *fp = (struct file *)f->f_fsdata;
@@ -758,14 +759,14 @@ ufs_read(f, start, size, resid)
static int
ufs_write(f, start, size, resid)
struct open_file *f;
- void *start;
+ const void *start;
size_t size;
size_t *resid; /* out */
{
struct file *fp = (struct file *)f->f_fsdata;
size_t csize;
int rc = 0;
- char *addr = start;
+ const char *addr = start;
csize = size;
while ((size != 0) && (csize != 0)) {
diff --git a/usr/src/boot/lib/libstand/write.c b/usr/src/boot/lib/libstand/write.c
index 9e02f083f2..96fc5c3457 100644
--- a/usr/src/boot/lib/libstand/write.c
+++ b/usr/src/boot/lib/libstand/write.c
@@ -61,16 +61,12 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include "stand.h"
ssize_t
-write(fd, dest, bcount)
- int fd;
- void *dest;
- size_t bcount;
+write(int fd, const void *dest, size_t bcount)
{
struct open_file *f = &files[fd];
size_t resid;
@@ -82,7 +78,8 @@ write(fd, dest, bcount)
if (f->f_flags & F_RAW) {
twiddle(4);
errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE,
- btodb(f->f_offset), bcount, dest, &resid);
+ btodb(f->f_offset), bcount, __DECONST(void *, dest),
+ &resid);
if (errno)
return (-1);
f->f_offset += resid;
diff --git a/usr/src/boot/sys/boot/userboot/userboot/host.c b/usr/src/boot/sys/boot/userboot/userboot/host.c
index db88c61eca..c15d9d7e41 100644
--- a/usr/src/boot/sys/boot/userboot/userboot/host.c
+++ b/usr/src/boot/sys/boot/userboot/userboot/host.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 2011 Google, Inc.
* All rights reserved.
*
@@ -25,7 +25,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
/*
* Read from the host filesystem
@@ -74,16 +73,6 @@ host_read(struct open_file *f, void *start, size_t size, size_t *resid)
return (CALLBACK(read, f->f_fsdata, start, size, resid));
}
-/*
- * Don't be silly - the bootstrap has no business writing anything.
- */
-static int
-host_write(struct open_file *f, void *start, size_t size, size_t *resid)
-{
-
- return (EROFS);
-}
-
static off_t
host_seek(struct open_file *f, off_t offset, int where)
{
@@ -183,7 +172,7 @@ struct fs_ops host_fsops = {
host_open,
host_close,
host_read,
- host_write,
+ null_write,
host_seek,
host_stat,
host_readdir
diff --git a/usr/src/boot/sys/boot/zfs/zfs.c b/usr/src/boot/sys/boot/zfs/zfs.c
index 3dbb955e55..3efd491431 100644
--- a/usr/src/boot/sys/boot/zfs/zfs.c
+++ b/usr/src/boot/sys/boot/zfs/zfs.c
@@ -50,7 +50,6 @@
#define ZFS_BE_LAST 8
static int zfs_open(const char *path, struct open_file *f);
-static int zfs_write(struct open_file *f, void *buf, size_t size, size_t *resid);
static int zfs_close(struct open_file *f);
static int zfs_read(struct open_file *f, void *buf, size_t size, size_t *resid);
static off_t zfs_seek(struct open_file *f, off_t offset, int where);
@@ -64,7 +63,7 @@ struct fs_ops zfs_fsops = {
zfs_open,
zfs_close,
zfs_read,
- zfs_write,
+ null_write,
zfs_seek,
zfs_stat,
zfs_readdir
@@ -170,16 +169,6 @@ zfs_read(struct open_file *f, void *start, size_t size, size_t *resid /* out */)
return (0);
}
-/*
- * Don't be silly - the bootstrap has no business writing anything.
- */
-static int
-zfs_write(struct open_file *f, void *start, size_t size, size_t *resid /* out */)
-{
-
- return (EROFS);
-}
-
static off_t
zfs_seek(struct open_file *f, off_t offset, int where)
{
diff --git a/usr/src/cmd/awk/b.c b/usr/src/cmd/awk/b.c
index e1bed57ab1..9caee4e9d3 100644
--- a/usr/src/cmd/awk/b.c
+++ b/usr/src/cmd/awk/b.c
@@ -28,8 +28,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#define DEBUG
#include "awk.h"
@@ -639,6 +637,7 @@ primary(void)
ERROR "syntax error in regular expression %s at %s",
lastre, prestr FATAL;
}
+ /* FALLTHROUGH */
default:
ERROR "illegal primary in regular expression %s at %s",
lastre, prestr FATAL;
diff --git a/usr/src/cmd/awk_xpg4/awk.h b/usr/src/cmd/awk_xpg4/awk.h
index 91e07c884c..595a2a029f 100644
--- a/usr/src/cmd/awk_xpg4/awk.h
+++ b/usr/src/cmd/awk_xpg4/awk.h
@@ -34,8 +34,6 @@
*
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <ctype.h>
#include <string.h>
@@ -275,7 +273,7 @@ int yyparse(void);
#pragma aux awkperr aborts;
#endif
void yyerror(char *msg, ...);
-void awkerr(char *fmt, ...);
+void awkerr(char *fmt, ...) __NORETURN;
void awkperr(char *fmt, ...);
void uexit(NODE *);
int yylex(void);
@@ -286,7 +284,7 @@ wchar_t *erealloc(wchar_t *, unsigned);
/* Global functions -- awk2.c */
void awk(void);
void dobegin(void);
-void doend(int status);
+void doend(int status) __NORETURN;
int nextrecord(wchar_t *buf, FILE *fp);
wchar_t *defrecord(wchar_t *bp, int lim, FILE *fp);
wchar_t *charrecord(wchar_t *bp, int lim, FILE *fp);
diff --git a/usr/src/cmd/awk_xpg4/awk1.c b/usr/src/cmd/awk_xpg4/awk1.c
index 0d54ebde58..bed7998fbb 100644
--- a/usr/src/cmd/awk_xpg4/awk1.c
+++ b/usr/src/cmd/awk_xpg4/awk1.c
@@ -67,7 +67,7 @@ static void awkvarinit(void);
static wint_t lexgetc(void);
static void lexungetc(wint_t c);
static size_t lexescape(wint_t endc, int regx, int cmd_line_operand);
-static void awkierr(int perr, char *fmt, va_list ap);
+static void awkierr(int perr, char *fmt, va_list ap) __NORETURN;
static int usage(void);
void strescape(wchar_t *str);
static const char *toprint(wint_t);
@@ -544,7 +544,7 @@ yylex()
c = ';';
break;
}
- /*FALLTHRU*/
+ /* FALLTHROUGH */
case AND:
case OR:
case COMMA:
@@ -557,6 +557,7 @@ yylex()
case '}':
if (nbrace != 0)
continue;
+ /* FALLTHROUGH */
default:
c = ';';
@@ -678,7 +679,7 @@ yylex()
if (!catterm || lexlast != CONSTANT || wasfield)
break;
- /*FALLTHRU*/
+ /* FALLTHROUGH */
case UFUNC:
case FUNC:
case GETLINE:
@@ -695,10 +696,10 @@ yylex()
case '}':
if (nbrace == 0)
savetoken = ';';
- /*FALLTHRU*/
+ /* FALLTHROUGH */
case ';':
inprint = 0;
- /*FALLTHRU*/
+ /* FALLTHROUGH */
default:
if (c == DEFFUNC)
isfuncdef = 1;
@@ -795,6 +796,7 @@ lexid(wint_t c)
case PRINT:
case PRINTF:
++inprint;
+ /* FALLTHROUGH */
default:
return ((int)np->n_keywtype);
}
@@ -831,7 +833,7 @@ do_funparm:
needsplit = 1;
} else if (np == varENVIRON)
needenviron = 1;
- /*FALLTHRU*/
+ /* FALLTHROUGH */
case PARM:
return (VAR);
@@ -840,7 +842,7 @@ do_funparm:
* It is ok to redefine functions as parameters
*/
if (funparm) goto do_funparm;
- /*FALLTHRU*/
+ /* FALLTHROUGH */
case FUNC:
case GETLINE:
/*
diff --git a/usr/src/cmd/awk_xpg4/awk3.c b/usr/src/cmd/awk_xpg4/awk3.c
index 584a54e561..ca72a82ab0 100644
--- a/usr/src/cmd/awk_xpg4/awk3.c
+++ b/usr/src/cmd/awk_xpg4/awk3.c
@@ -29,8 +29,6 @@
* Based on MKS awk(1) ported to be /usr/xpg4/bin/awk with POSIX/XCU4 changes
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "awk.h"
#include "y.tab.h"
@@ -250,7 +248,7 @@ top:
switch (left->n_type) {
case INDEX:
left = exprreduce(left);
- /*FALLTHRU*/
+ /* FALLTHROUGH */
case VAR:
return (nassign(left, right));
@@ -701,7 +699,7 @@ action(NODE *wp)
case NEXT:
loopexit = NEXT;
- /*FALLTHRU*/
+ /* FALLTHROUGH */
case BREAK:
case CONTINUE:
return (np->n_type);
@@ -748,6 +746,7 @@ action(NODE *wp)
if (isstring(l->n_flags) &&
l->n_string == _null)
break;
+ /* FALLTHROUGH */
default:
awkerr(gettext(
"may delete only array element or array"));
@@ -1224,11 +1223,9 @@ do_asn_op:
case ARRAY:
awkerr(badarray, np->n_name);
- /*FALLTHRU*/
case UFUNC:
awkerr(varnotfunc, np->n_name);
- /*FALLTHRU*/
default:
awkerr(gettext("panic: exprreduce(%d)"), t);
/* NOTREACHED */
diff --git a/usr/src/cmd/awk_xpg4/awk4.c b/usr/src/cmd/awk_xpg4/awk4.c
index 96c168bbf1..96ec3d26ec 100644
--- a/usr/src/cmd/awk_xpg4/awk4.c
+++ b/usr/src/cmd/awk_xpg4/awk4.c
@@ -30,8 +30,6 @@
* Based on MKS awk(1) ported to be /usr/xpg4/bin/awk with POSIX/XCU4 changes
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "awk.h"
#include "y.tab.h"
#include <time.h>
@@ -386,10 +384,11 @@ f_split(NODE *np)
case VAR:
if (isstring(tnp->n_flags) && tnp->n_string==_null)
break;
+ /* FALLTHROUGH */
+
default:
awkerr(gettext(
"second parameter to \"split\" must be an array"));
- /*NOTREACHED*/
}
/*
* If an argument has been passed in to be used as the
diff --git a/usr/src/cmd/boot/installgrub/pcfs_glue.c b/usr/src/cmd/boot/installgrub/pcfs_glue.c
index d687c02f45..99e8eacc68 100644
--- a/usr/src/cmd/boot/installgrub/pcfs_glue.c
+++ b/usr/src/cmd/boot/installgrub/pcfs_glue.c
@@ -49,7 +49,7 @@ int bootrd_debug = 0;
static unsigned int *blocklist;
-/* diskread_callback is set in filesytem module (pcfs.c) */
+/* diskread_callback is set in filesystem module (pcfs.c) */
int (*diskread_callback)(int, int);
int (*fileread_callback)(int, int);
diff --git a/usr/src/cmd/dladm/dladm.c b/usr/src/cmd/dladm/dladm.c
index c4fe45cf40..1edd13b0cb 100644
--- a/usr/src/cmd/dladm/dladm.c
+++ b/usr/src/cmd/dladm/dladm.c
@@ -4097,6 +4097,8 @@ iptun_process_addrarg(char *addrarg, iptun_params_t *params)
while (*addrarg != '\0') {
switch (getsubopt(&addrarg, iptun_addropts, &addrval)) {
case IPTUN_LOCAL:
+ if (addrval == NULL)
+ die("tunnel source address value is missing");
params->iptun_param_flags |= IPTUN_PARAM_LADDR;
if (strlcpy(params->iptun_param_laddr, addrval,
sizeof (params->iptun_param_laddr)) >=
@@ -4104,6 +4106,9 @@ iptun_process_addrarg(char *addrarg, iptun_params_t *params)
die("tunnel source address is too long");
break;
case IPTUN_REMOTE:
+ if (addrval == NULL)
+ die("tunnel destination address value "
+ "is missing");
params->iptun_param_flags |= IPTUN_PARAM_RADDR;
if (strlcpy(params->iptun_param_raddr, addrval,
sizeof (params->iptun_param_raddr)) >=
diff --git a/usr/src/cmd/lp/cmd/lpsched/validate.c b/usr/src/cmd/lp/cmd/lpsched/validate.c
index 377b0d67e1..aa4b9bc646 100644
--- a/usr/src/cmd/lp/cmd/lpsched/validate.c
+++ b/usr/src/cmd/lp/cmd/lpsched/validate.c
@@ -903,7 +903,7 @@ _chkopts(RSTATUS *prs, CANDIDATE *pc, FSTATUS *pfs)
ret |= chk;
/*
- * If the sytem is labeled, then user who wants 'nolabels' must
+ * If the system is labeled, then user who wants 'nolabels' must
* have PRINT_UNLABELED_AUTH authorizations to allow it.
*/
if (is_system_labeled() && (wants_nolabels == 1)) {
diff --git a/usr/src/cmd/oamuser/user/homedir.c b/usr/src/cmd/oamuser/user/homedir.c
index 770cba25c1..dde62c9474 100644
--- a/usr/src/cmd/oamuser/user/homedir.c
+++ b/usr/src/cmd/oamuser/user/homedir.c
@@ -305,7 +305,7 @@ get_default_zfs_flags()
return (flags);
}
-/* Get the name of a mounted filesytem */
+/* Get the name of a mounted filesystem */
char *
get_mnt_special(char *mountp, char *fstype)
{
diff --git a/usr/src/cmd/power/handlers.c b/usr/src/cmd/power/handlers.c
index da56c14218..40db5e4621 100644
--- a/usr/src/cmd/power/handlers.c
+++ b/usr/src/cmd/power/handlers.c
@@ -882,7 +882,7 @@ static char open_fmt[] = "cannot open \"%s\", %s\n";
/*
* Verify the filesystem type for a regular statefile is "ufs"
- * or verify a block device is not in use as a mounted filesytem.
+ * or verify a block device is not in use as a mounted filesystem.
* Returns 1 if any error, otherwise 0.
*/
static int
diff --git a/usr/src/cmd/praudit/format.c b/usr/src/cmd/praudit/format.c
index 3acd370513..c2ea6c0ef6 100644
--- a/usr/src/cmd/praudit/format.c
+++ b/usr/src/cmd/praudit/format.c
@@ -64,6 +64,116 @@ static int do_mtime64(pr_context_t *context, int status, int flag,
uint64_t scale);
/*
+ * for uid/gid caches
+ */
+static uid_t lastuid = (uid_t)-1;
+static gid_t lastgid = (gid_t)-1;
+static char *lastuname = NULL;
+static char *lastgname = NULL;
+static char *getname(uid_t);
+static char *getgroup(gid_t);
+static struct cachenode *findincache(struct cachenode **, long);
+#include <utmpx.h>
+
+struct utmpx utmp;
+
+#define NMAX (sizeof (utmp.ut_name))
+#define SCPYN(a, b) (void) strncpy(a, b, NMAX)
+
+struct cachenode { /* this struct must be zeroed before using */
+ struct cachenode *lesschild; /* subtree whose entries < val */
+ struct cachenode *grtrchild; /* subtree whose entries > val */
+ long val; /* the uid or gid of this entry */
+ int initted; /* name has been filled in */
+ char name[NMAX+1]; /* the string that val maps to */
+};
+static struct cachenode *names, *groups;
+
+static struct cachenode *
+findincache(struct cachenode **head, long val)
+{
+ struct cachenode **parent = head;
+ struct cachenode *c = *parent;
+
+ while (c != NULL) {
+ if (val == c->val) {
+ /* found it */
+ return (c);
+ } else if (val < c->val) {
+ parent = &c->lesschild;
+ c = c->lesschild;
+ } else {
+ parent = &c->grtrchild;
+ c = c->grtrchild;
+ }
+ }
+
+ /* not in the cache, make a new entry for it */
+ c = calloc(1, sizeof (struct cachenode));
+ if (c == NULL) {
+ perror("praudit");
+ exit(2);
+ }
+ *parent = c;
+ c->val = val;
+ return (c);
+}
+
+/*
+ * get name from cache, or passwd file for a given uid;
+ * lastuid is set to uid.
+ */
+static char *
+getname(uid_t uid)
+{
+ struct passwd *pwent;
+ struct cachenode *c;
+
+ if ((uid == lastuid) && lastuname)
+ return (lastuname);
+
+ c = findincache(&names, uid);
+ if (c->initted == 0) {
+ if ((pwent = getpwuid(uid)) != NULL) {
+ SCPYN(&c->name[0], pwent->pw_name);
+ } else {
+ (void) sprintf(&c->name[0], "%u", (int)uid);
+ }
+ c->initted = 1;
+ }
+ lastuid = uid;
+ lastuname = &c->name[0];
+ return (lastuname);
+}
+
+/*
+ * get name from cache, or group file for a given gid;
+ * lastgid is set to gid.
+ */
+static char *
+getgroup(gid_t gid)
+{
+ struct group *grent;
+ struct cachenode *c;
+
+ if ((gid == lastgid) && lastgname)
+ return (lastgname);
+
+ c = findincache(&groups, gid);
+ if (c->initted == 0) {
+ if ((grent = getgrgid(gid)) != NULL) {
+ SCPYN(&c->name[0], grent->gr_name);
+ } else {
+ (void) sprintf(&c->name[0], "%u", (int)gid);
+ }
+ c->initted = 1;
+ }
+ lastgid = gid;
+ lastgname = &c->name[0];
+ return (lastgname);
+}
+
+/*
* ------------------------------------------------------
* field widths for arbitrary data token type
* ------------------------------------------------------
@@ -1862,9 +1972,6 @@ done:
if (wstat == 0)
wstat = do_newline(context, flag);
- if (wstat == 0 && context->data_mode == FILEMODE)
- (void) fflush(stdout);
-
return ((rstat != 0 || wstat != 0) ? -1 : 0);
}
@@ -2014,28 +2121,21 @@ static int
pa_print_uid(pr_context_t *context, uid_t uid, int status, int flag)
{
int returnstat;
- struct passwd *pw;
uval_t uval;
if (status < 0)
return (status);
- if (!(context->format & PRF_RAWM)) {
- /* get password file entry */
- if ((pw = getpwuid(uid)) == NULL) {
- returnstat = 1;
- } else {
- /* print in ASCII form */
- uval.uvaltype = PRA_STRING;
- uval.string_val = pw->pw_name;
- returnstat = pa_print(context, &uval, flag);
- }
- }
- /* print in integer form */
- if ((context->format & PRF_RAWM) || (returnstat == 1)) {
+ if (context->format & PRF_RAWM) {
+ /* print in integer form */
uval.uvaltype = PRA_INT32;
uval.int32_val = uid;
returnstat = pa_print(context, &uval, flag);
+ } else {
+ /* print in ASCII form */
+ uval.uvaltype = PRA_STRING;
+ uval.string_val = getname(uid);
+ returnstat = pa_print(context, &uval, flag);
}
return (returnstat);
}
@@ -2070,28 +2170,21 @@ static int
pa_print_gid(pr_context_t *context, gid_t gid, int status, int flag)
{
int returnstat;
- struct group *gr;
uval_t uval;
if (status < 0)
return (status);
- if (!(context->format & PRF_RAWM)) {
- /* get group file entry */
- if ((gr = getgrgid(gid)) == NULL) {
- returnstat = 1;
- } else {
- /* print in ASCII form */
- uval.uvaltype = PRA_STRING;
- uval.string_val = gr->gr_name;
- returnstat = pa_print(context, &uval, flag);
- }
- }
- /* print in integer form */
- if ((context->format & PRF_RAWM) || (returnstat == 1)) {
+ if (context->format & PRF_RAWM) {
+ /* print in integer form */
uval.uvaltype = PRA_INT32;
uval.int32_val = gid;
returnstat = pa_print(context, &uval, flag);
+ } else {
+ /* print in ASCII form */
+ uval.uvaltype = PRA_STRING;
+ uval.string_val = getgroup(gid);
+ returnstat = pa_print(context, &uval, flag);
}
return (returnstat);
}
@@ -2835,9 +2928,6 @@ pa_print(pr_context_t *context, uval_t *uval, int flag)
returnstat = pr_putchar(context, '\n');
}
}
- if ((returnstat == 0) && (context->data_mode == FILEMODE))
- (void) fflush(stdout);
-
return (returnstat);
}
diff --git a/usr/src/cmd/print/scripts/ppdmgr b/usr/src/cmd/print/scripts/ppdmgr
index 335c01da7d..65112b29a1 100644
--- a/usr/src/cmd/print/scripts/ppdmgr
+++ b/usr/src/cmd/print/scripts/ppdmgr
@@ -1422,7 +1422,7 @@ VENDOR=vendor
ADMIN=admin
USER=user
-# Sytem PPD cache name used by printmgr
+# System PPD cache name used by printmgr
GOLDCACHE=${USERREP}/ppdcache
# Delivered caches directory
diff --git a/usr/src/cmd/uname/uname.c b/usr/src/cmd/uname/uname.c
index 2c43b50cd6..8fde32d24f 100644
--- a/usr/src/cmd/uname/uname.c
+++ b/usr/src/cmd/uname/uname.c
@@ -17,13 +17,13 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- */
-/*
+ *
+ * Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
@@ -49,6 +49,8 @@
#include <sys/utsname.h>
#include <sys/systeminfo.h>
+#define OS_NAME "illumos"
+
static void usage(void);
/* ARGSUSED */
@@ -56,9 +58,9 @@ int
main(int argc, char *argv[], char *envp[])
{
char *nodename;
- char *optstring = "asnrpvmiS:X";
+ char *optstring = "asnrpvmioS:X";
int sflg = 0, nflg = 0, rflg = 0, vflg = 0, mflg = 0;
- int pflg = 0, iflg = 0, Sflg = 0;
+ int pflg = 0, iflg = 0, oflg = 0, Sflg = 0;
int errflg = 0, optlet;
int Xflg = 0;
struct utsname unstr, *un;
@@ -104,6 +106,9 @@ main(int argc, char *argv[], char *envp[])
case 'i':
iflg++;
break;
+ case 'o':
+ oflg++;
+ break;
case 'S':
Sflg++;
nodename = optarg;
@@ -121,7 +126,7 @@ main(int argc, char *argv[], char *envp[])
if ((Sflg > 1) ||
(Sflg && (sflg || nflg || rflg || vflg || mflg || pflg || iflg ||
- Xflg))) {
+ oflg || Xflg))) {
usage();
}
@@ -148,7 +153,8 @@ main(int argc, char *argv[], char *envp[])
/*
* "uname -s" is the default
*/
- if (!(sflg || nflg || rflg || vflg || mflg || pflg || iflg || Xflg))
+ if (!(sflg || nflg || rflg || vflg || mflg || pflg || iflg ||
+ oflg || Xflg))
sflg++;
if (sflg) {
(void) fprintf(stdout, fs, sizeof (un->sysname),
@@ -189,6 +195,10 @@ main(int argc, char *argv[], char *envp[])
(void) fprintf(stdout, fs, strlen(procbuf), procbuf);
fs = fmt_string;
}
+ if (oflg) {
+ (void) fprintf(stdout, fs, strlen(OS_NAME), OS_NAME);
+ fs = fmt_string;
+ }
if (Xflg) {
int val;
@@ -224,7 +234,7 @@ usage(void)
{
{
(void) fprintf(stderr, gettext(
- "usage: uname [-snrvmapiX]\n"
+ "usage: uname [-snrvmapioX]\n"
" uname [-S system_name]\n"));
}
exit(1);
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index 8d8a9d67be..7dac2f2237 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -2255,7 +2255,7 @@ zfs_do_upgrade(int argc, char **argv)
if (cb.cb_numfailed != 0)
ret = 1;
} else {
- /* List old-version filesytems */
+ /* List old-version filesystems */
boolean_t found;
(void) printf(gettext("This system is currently running "
"ZFS filesystem version %llu.\n\n"), ZPL_VERSION);
diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c
index f3a313907b..1ddd8bcf50 100644
--- a/usr/src/cmd/zpool/zpool_main.c
+++ b/usr/src/cmd/zpool/zpool_main.c
@@ -1827,7 +1827,7 @@ show_import(nvlist_t *config)
case ZPOOL_STATUS_UNSUP_FEAT_READ:
(void) printf(gettext("status: The pool uses the following "
- "feature(s) not supported on this sytem:\n"));
+ "feature(s) not supported on this system:\n"));
zpool_print_unsup_feat(config);
break;
diff --git a/usr/src/common/ficl/float.c b/usr/src/common/ficl/float.c
index 02f64b8c9b..c19648c040 100644
--- a/usr/src/common/ficl/float.c
+++ b/usr/src/common/ficl/float.c
@@ -402,7 +402,7 @@ ficlPrimitiveF2LocalParen(ficlVm *vm)
/*
* Add float words to a system's dictionary.
- * system -- Pointer to the Ficl sytem to add float words to.
+ * system -- Pointer to the Ficl system to add float words to.
*/
void
ficlSystemCompileFloat(ficlSystem *system)
diff --git a/usr/src/head/rpcsvc/rusers.x b/usr/src/head/rpcsvc/rusers.x
index 4a44ca3da6..e193c9a7c6 100644
--- a/usr/src/head/rpcsvc/rusers.x
+++ b/usr/src/head/rpcsvc/rusers.x
@@ -90,7 +90,7 @@ program RUSERSPROG {
%
%/*
% * This is the structure used in version 2 of the rusersd RPC service.
-% * It corresponds to the utmp structure for BSD sytems.
+% * It corresponds to the utmp structure for BSD systems.
% */
%struct ru_utmp {
% char ut_line[8]; /* tty name */
diff --git a/usr/src/lib/brand/shared/zone/common.ksh b/usr/src/lib/brand/shared/zone/common.ksh
index 0f87686414..9d1bbbb2d6 100644
--- a/usr/src/lib/brand/shared/zone/common.ksh
+++ b/usr/src/lib/brand/shared/zone/common.ksh
@@ -570,7 +570,7 @@ install_flar()
#
# c) inside the zonepath root: We'll see all the top level dirs, ./etc,
# ./var, ./usr.... This is also the case we see when we get an archive
-# of a physical sytem. We must be in ZONEROOT when we unpack the archive.
+# of a physical system. We must be in ZONEROOT when we unpack the archive.
#
# Note that there can be a directory named "root" under the ZONEPATH/root
# directory.
diff --git a/usr/src/lib/gss_mechs/mech_krb5/krb5/os/accessor.c b/usr/src/lib/gss_mechs/mech_krb5/krb5/os/accessor.c
index 1eb12be1dd..e3d4074197 100644
--- a/usr/src/lib/gss_mechs/mech_krb5/krb5/os/accessor.c
+++ b/usr/src/lib/gss_mechs/mech_krb5/krb5/os/accessor.c
@@ -30,11 +30,14 @@
/* If this trick gets used elsewhere, move it to k5-platform.h. */
#ifndef DESIGNATED_INITIALIZERS
-#define DESIGNATED_INITIALIZERS \
- /* ANSI/ISO C 1999 supports this... */ \
- (__STDC_VERSION__ >= 199901L \
+/* ANSI/ISO C 1999 supports this... */
+#if __STDC_VERSION__ >= 199901L \
/* ...as does GCC, since version 2.something. */ \
- || (!defined __cplusplus && __GNUC__ >= 3))
+ || (!defined __cplusplus && __GNUC__ >= 3)
+#define DESIGNATED_INITIALIZERS 1
+#else
+#define DESIGNATED_INITIALIZERS 0
+#endif
#endif
krb5_error_code KRB5_CALLCONV
diff --git a/usr/src/lib/libast/common/RELEASE b/usr/src/lib/libast/common/RELEASE
index 9c3b6de78d..4480985146 100644
--- a/usr/src/lib/libast/common/RELEASE
+++ b/usr/src/lib/libast/common/RELEASE
@@ -912,7 +912,7 @@
01-10-05 misc/glob.c: fix `\(x/*' GLOB_NOMATCH bug that returned `(x'
misc/optget.c: fix localization lookup that didn't drop doubled : ? ]
01-10-04 comp/setlocale.c: handle sizeof(wchar_t)!=4 in debug locale
- comp/conf.sh: handle sytems where _SC_* is both an enum and a macro
+ comp/conf.sh: handle systems where _SC_* is both an enum and a macro
01-09-25 astconf: add LIBPREFIX
01-09-20 features/common: add __DYNAMIC__() for dll externs
01-09-19 cdt: kpv update
diff --git a/usr/src/lib/libdtrace/common/dt_parser.h b/usr/src/lib/libdtrace/common/dt_parser.h
index 3a146c5d25..f5f60a518e 100644
--- a/usr/src/lib/libdtrace/common/dt_parser.h
+++ b/usr/src/lib/libdtrace/common/dt_parser.h
@@ -279,7 +279,7 @@ typedef enum {
extern void dnerror(const dt_node_t *, dt_errtag_t, const char *, ...);
extern void dnwarn(const dt_node_t *, dt_errtag_t, const char *, ...);
-extern void xyerror(dt_errtag_t, const char *, ...);
+extern void xyerror(dt_errtag_t, const char *, ...) __NORETURN;
extern void xywarn(dt_errtag_t, const char *, ...);
extern void xyvwarn(dt_errtag_t, const char *, va_list);
diff --git a/usr/src/lib/libsqlite/src/expr.c b/usr/src/lib/libsqlite/src/expr.c
index 1155d045f6..f1b187974e 100644
--- a/usr/src/lib/libsqlite/src/expr.c
+++ b/usr/src/lib/libsqlite/src/expr.c
@@ -1,6 +1,3 @@
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** 2001 September 15
**
@@ -652,6 +649,7 @@ int sqliteExprResolveIds(
}
/* A lone identifier is the name of a columnd.
*/
+ /* FALLTHROUGH */
case TK_ID: {
if( lookupName(pParse, 0, 0, &pExpr->token, pSrcList, pEList, pExpr) ){
return 1;
@@ -894,6 +892,7 @@ int sqliteExprCheck(Parse *pParse, Expr *pExpr, int allowAgg, int *pIsAgg){
pExpr->dataType = SQLITE_SO_TEXT;
}
}
+ /* FALLTHROUGH */
default: {
if( pExpr->pLeft ){
nErr = sqliteExprCheck(pParse, pExpr->pLeft, allowAgg, pIsAgg);
@@ -1081,8 +1080,8 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){
if( pParse->db->file_format>=4 && sqliteExprType(pExpr)==SQLITE_SO_TEXT ){
op += 6; /* Convert numeric opcodes to text opcodes */
}
- /* Fall through into the next case */
}
+ /* FALLTHROUGH */
case TK_AND:
case TK_OR:
case TK_PLUS:
@@ -1127,6 +1126,7 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){
}
/* Fall through into TK_NOT */
}
+ /* FALLTHROUGH */
case TK_BITNOT:
case TK_NOT: {
sqliteExprCode(pParse, pExpr->pLeft);
diff --git a/usr/src/lib/libsqlite/src/insert.c b/usr/src/lib/libsqlite/src/insert.c
index 334acbf941..c6080a9a3c 100644
--- a/usr/src/lib/libsqlite/src/insert.c
+++ b/usr/src/lib/libsqlite/src/insert.c
@@ -1,6 +1,3 @@
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** 2001 September 15
**
@@ -722,8 +719,8 @@ void sqliteGenerateConstraintChecks(
switch( onError ){
default: {
onError = OE_Abort;
- /* Fall thru into the next case */
}
+ /* FALLTHROUGH */
case OE_Rollback:
case OE_Abort:
case OE_Fail: {
diff --git a/usr/src/lib/libsqlite/src/select.c b/usr/src/lib/libsqlite/src/select.c
index 92acc32c98..8b5c941075 100644
--- a/usr/src/lib/libsqlite/src/select.c
+++ b/usr/src/lib/libsqlite/src/select.c
@@ -1,6 +1,3 @@
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** 2001 September 15
**
@@ -19,7 +16,6 @@
*/
#include "sqliteInt.h"
-
/*
** Allocate a new Select structure and return a pointer to that
** structure.
@@ -1347,8 +1343,8 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
if( rc ) return rc;
break;
}
- /* For UNION ALL ... ORDER BY fall through to the next case */
}
+ /* FALLTHROUGH */
case TK_EXCEPT:
case TK_UNION: {
int unionTab; /* Cursor number of the temporary table holding result */
diff --git a/usr/src/lib/libsqlite/src/tokenize.c b/usr/src/lib/libsqlite/src/tokenize.c
index c7a6da42cb..914326708c 100644
--- a/usr/src/lib/libsqlite/src/tokenize.c
+++ b/usr/src/lib/libsqlite/src/tokenize.c
@@ -1,6 +1,3 @@
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** 2001 September 15
**
@@ -443,8 +440,8 @@ int sqliteRunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
}
case TK_SEMI: {
pParse->zTail = &zSql[i];
- /* Fall thru into the default case */
}
+ /* FALLTHROUGH */
default: {
sqliteParser(pEngine, tokenType, pParse->sLastToken, pParse);
lastTokenParsed = tokenType;
diff --git a/usr/src/lib/libsqlite/src/vdbe.c b/usr/src/lib/libsqlite/src/vdbe.c
index d631a98543..35683a44ff 100644
--- a/usr/src/lib/libsqlite/src/vdbe.c
+++ b/usr/src/lib/libsqlite/src/vdbe.c
@@ -3,8 +3,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** 2001 September 15
**
@@ -2200,8 +2198,8 @@ case OP_Transaction: {
}
case SQLITE_READONLY: {
rc = SQLITE_OK;
- /* Fall thru into the next case */
}
+ /* FALLTHROUGH */
case SQLITE_OK: {
p->inTempTrans = 0;
busy = 0;
diff --git a/usr/src/lib/libsqlite/src/vdbeaux.c b/usr/src/lib/libsqlite/src/vdbeaux.c
index aea32dd8f8..014cd3d32e 100644
--- a/usr/src/lib/libsqlite/src/vdbeaux.c
+++ b/usr/src/lib/libsqlite/src/vdbeaux.c
@@ -1,6 +1,3 @@
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** 2003 September 6
**
@@ -864,8 +861,8 @@ int sqliteVdbeReset(Vdbe *p, char **pzErrMsg){
}
break;
}
- /* Fall through to ROLLBACK */
}
+ /* FALLTHROUGH */
case OE_Rollback: {
sqliteRollbackAll(db);
db->flags &= ~SQLITE_InTrans;
diff --git a/usr/src/lib/libsqlite/tool/lemon.c b/usr/src/lib/libsqlite/tool/lemon.c
index d0321b0f55..03d96e3922 100644
--- a/usr/src/lib/libsqlite/tool/lemon.c
+++ b/usr/src/lib/libsqlite/tool/lemon.c
@@ -1,6 +1,3 @@
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** This file contains all sources (including headers) to the LEMON
** LALR(1) parser generator. The sources have been combined into a
@@ -1915,7 +1912,7 @@ struct pstate *psp;
psp->preccounter = 0;
psp->firstrule = psp->lastrule = 0;
psp->gp->nrule = 0;
- /* Fall thru to next case */
+ /* FALLTHROUGH */
case WAITING_FOR_DECL_OR_RULE:
if( x[0]=='%' ){
psp->state = WAITING_FOR_DECL_KEYWORD;
diff --git a/usr/src/lib/libv12n/sparc/libv12n.c b/usr/src/lib/libv12n/sparc/libv12n.c
index 3fbfdf267c..b8d1480547 100644
--- a/usr/src/lib/libv12n/sparc/libv12n.c
+++ b/usr/src/lib/libv12n/sparc/libv12n.c
@@ -537,7 +537,7 @@ v12n_domain_uuid(uuid_t uuid)
}
/*
- * Send 'agent-sytem' request message.
+ * Send 'agent-system' request message.
*/
static int
v12n_ldma_send_request()
diff --git a/usr/src/lib/libxcurses/h/posix/mkslocal.h b/usr/src/lib/libxcurses/h/posix/mkslocal.h
index a02b5419d1..fe07860b70 100644
--- a/usr/src/lib/libxcurses/h/posix/mkslocal.h
+++ b/usr/src/lib/libxcurses/h/posix/mkslocal.h
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* <mkslocal.h>, POSIX Version - local <mks.h> requirements
*
@@ -814,7 +812,7 @@ char **m_setenv ANSI((void));/* for use of the environment variables via
/* this pathname identifies a file that
* is similar to M_FSMOUNT, but instead of
* the actively mounted file systems, it
- * has a list of ALL possible filesytems
+ * has a list of ALL possible filesystems
* that could be mounted.
* This file normally used by the mount
* command to find all the file systems
diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c
index 4c574786d5..ba0d70aaae 100644
--- a/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c
+++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c
@@ -1849,7 +1849,7 @@ adjoin_cleanup:
struct xlate_table {
int err;
- const char const *msg;
+ const char * const msg;
};
static const struct xlate_table
diff --git a/usr/src/man/man1/uname.1 b/usr/src/man/man1/uname.1
index 422252ea1d..12ed819805 100644
--- a/usr/src/man/man1/uname.1
+++ b/usr/src/man/man1/uname.1
@@ -43,238 +43,163 @@
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
.\"
-.TH UNAME 1 "May 13, 2017"
-.SH NAME
-uname \- print name of current system
-.SH SYNOPSIS
-.LP
-.nf
-\fBuname\fR [\fB-aimnprsvX\fR]
-.fi
-
-.LP
-.nf
-\fBuname\fR [\fB-S\fR \fIsystem_name\fR]
-.fi
-
-.SH DESCRIPTION
-.LP
-The \fBuname\fR utility prints information about the current system on the
-standard output. When options are specified, symbols representing one or more
-system characteristics will be written to the standard output. If no options
-are specified, \fBuname\fR prints the current operating system's name. The
-options print selected information returned by \fBuname\fR(2),
-\fBsysinfo\fR(2), or both.
-.SH OPTIONS
-.LP
+.Dd February 9, 2018
+.Dt UNAME 1
+.Os
+.Sh NAME
+.Nm uname
+.Nd print name of current system
+.Sh SYNOPSIS
+.Nm
+.Op Fl aimnoprsvX
+.Nm
+.Fl S Ar system_name
+.Sh DESCRIPTION
+The
+.Nm
+utility prints information about the current system on the standard output.
+When options are specified, symbols representing one or more system
+characteristics will be written to the standard output.
+If no options are specified,
+.Nm
+prints the current operating system's name.
+The options print selected information returned by
+.Xr uname 2 ,
+.Xr sysinfo 2 ,
+or both.
+.Sh OPTIONS
The following options are supported:
-.sp
-.ne 2
-.na
-\fB\fB-a\fR\fR
-.ad
-.RS 18n
+.Bl -tag -width Ds
+.It Fl a
Prints basic information currently available from the system.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-i\fR\fR
-.ad
-.RS 18n
+.It Fl i
Prints the name of the platform.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-m\fR\fR
-.ad
-.RS 18n
-Prints the machine hardware name (class). Use of this option is discouraged.
-Use \fBuname\fR \fB-p\fR instead. See NOTES section below.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-n\fR\fR
-.ad
-.RS 18n
+.It Fl m
+Prints the machine hardware name (class).
+Use of this option is discouraged.
+Use
+.Nm Fl p
+instead.
+See
+.Sx NOTES
+section below.
+.It Fl n
Prints the nodename (the nodename is the name by which the system is known to a
communications network).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-p\fR\fR
-.ad
-.RS 18n
-Prints the current host's \fBISA\fR or processor type.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-r\fR\fR
-.ad
-.RS 18n
+.It Fl o
+Prints the name of the kernel/OS.
+.It Fl p
+Prints the current host's ISA or processor type.
+.It Fl r
Prints the operating system release level.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-s\fR\fR
-.ad
-.RS 18n
-Prints the name of the operating system. This is the default.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-S\fR \fIsystem_name\fR\fR
-.ad
-.RS 18n
-The nodename may be changed by specifying a system name argument. The system
-name argument is restricted to \fBSYS_NMLN\fR characters. \fBSYS_NMLN\fR is an
-implementation specific value defined in \fB<sys/utsname.h>\fR\&. Only the
-super-user is allowed this capability. This change does not persist across
-reboots of the system. See \fBnodename\fR(4) for details of how to change a
-host's name permanently.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-v\fR\fR
-.ad
-.RS 18n
+.It Fl s
+Prints the name of the operating system.
+This is the default.
+.It Fl S Ar system_name
+The nodename may be changed by specifying a system name argument.
+The system name argument is restricted to
+.Dv SYS_NMLN
+characters.
+.Dv SYS_NMLN
+is an implementation specific value defined in
+.In sys/utsname.h .
+Only the super-user is allowed this capability.
+This change does not persist across reboots of the system.
+See
+.Xr nodename 4
+for details of how to change a host's name permanently.
+.It Fl v
Prints the operating system version.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-X\fR \fR
-.ad
-.RS 18n
+.It Fl X
Prints expanded system information, one information element per line, as
-expected by SCO UNIX. The displayed information includes:
-.RS +4
-.TP
-.ie t \(bu
-.el o
+expected by SCO UNIX.
+The displayed information includes:
+.Bl -bullet
+.It
system name, node, release, version, machine, and number of CPUs.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
+.It
BusType, Serial, and Users (set to "unknown" in Solaris)
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-OEM# and Origin# (set to \fB0\fR and \fB1\fR, respectively)
-.RE
-.RE
-
-.SH EXAMPLES
-.LP
-\fBExample 1 \fRPrinting the OS name and release level
-.sp
-.LP
+.It
+OEM# and Origin# (set to 0 and 1, respectively)
+.El
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+.Bl -tag -width Ds
+.It Sy Example 1 No Printing the OS name and release level
The following command:
-
-.sp
-.in +2
-.nf
-example% \fBuname \(misr\fR
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-prints the operating system name and release level, separated by one SPACE
+.Bd -literal
+$ uname -sr
+.Ed
+.Pp
+\&...prints the operating system name and release level, separated by one SPACE
character.
-
-.SH ENVIRONMENT VARIABLES
-.LP
-See \fBenviron\fR(5) for descriptions of the following environment variables
-that affect the execution of \fBuname\fR: \fBLANG\fR, \fBLC_ALL\fR,
-\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
-
-.SH EXIT STATUS
-.LP
-The following exit values are returned:
-.sp
-.ne 2
-.na
-\fB\fB0\fR \fR
-.ad
-.RS 7n
-Successful completion.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB>0\fR \fR
-.ad
-.RS 7n
-An error occurred.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability Standard
-.TE
-
-.SH SEE ALSO
-.LP
-\fBarch\fR(1), \fBisalist\fR(1), \fBsysinfo\fR(2),
-\fBuname\fR(2), \fBnodename\fR(4), \fBattributes\fR(5), \fBenviron\fR(5),
-\fBstandards\fR(5)
-.SH NOTES
-.LP
-Independent software vendors (\fBISV\fRs) and others who need to determine
-detailed characteristics of the platform on which their software is either
-being installed or executed should use the \fBuname\fR command.
-.sp
-.LP
-To determine the operating system name and release level, use \fBuname
-\fR\fB-sr\fR. To determine only the operating system release level, use
-\fBuname \fR\fB-r\fR. Notice that operating system release levels are not
-guaranteed to be in \fIx.y\fR format (such as 5.3, 5.4, 5.5, and so forth);
-but could be in the \fIx.y.z\fR format (such as 5.5.1).
-.sp
-.LP
-In SunOS 4.\fIx\fR releases, the \fBarch\fR(1) command was often used to obtain
-information similar to that obtained by using the \fBuname\fR command. The
-\fBarch\fR(1) command output "sun4" was often incorrectly interpreted to
-signify a SunOS SPARC system. If hardware platform information is desired, use
-\fBuname \fR\fB-sp\fR.
-.sp
-.LP
-The \fBarch\fR \fB-k\fR and \fBuname\fR \fB-m\fR commands return equivalent
-values; however, the use of either of these commands by third party programs is
-discouraged, as is the use of the \fBarch\fR command in general. To determine
-the machine's Instruction Set Architecture (\fBISA\fR or processor type), use
-\fBuname\fR with the \fB-p\fR option.
+.El
+.Sh ENVIRONMENT VARIABLES
+See
+.Xr environ 5
+for descriptions of the following environment variables that affect the
+execution of
+.Nm :
+.Ev LANG , LC_ALL , LC_CTYPE , LC_MESSAGES ,
+and
+.Ev NLSPATH .
+.Sh INTERFACE STABILITY
+.Sy Standard
+.Sh SEE ALSO
+.Xr arch 1 ,
+.Xr isalist 1 ,
+.Xr sysinfo 2 ,
+.Xr uname 2 ,
+.Xr nodename 4 ,
+.Xr attributes 5 ,
+.Xr environ 5 ,
+.Xr standards 5
+.Sh NOTES
+Independent software vendors (ISVs) and others who need to determine detailed
+characteristics of the platform on which their software is either being
+installed or executed should use the
+.Nm
+command.
+.Pp
+To determine the operating system name and release level, use
+.Nm Fl sr .
+To determine only the operating system release level, use
+.Nm Fl r .
+Notice that operating system release levels are not guaranteed to be in
+.Em x.y
+format (such as 5.3, 5.4, 5.5, and so forth); but could be in the
+.Em x.y.z
+format (such as 5.5.1).
+.Pp
+In SunOS 4.x releases, the
+.Xr arch 1
+command was often used to obtain information similar to that obtained by using
+the
+.Nm
+command.
+The
+.Xr arch 1
+command output
+.Ql sun4
+was often incorrectly interpreted to signify a SunOS SPARC system.
+If hardware platform information is desired, use
+.Nm Fl sp .
+.Pp
+The
+.Nm arch Fl k
+and
+.Nm Fl m
+commands return equivalent values; however, the use of either of these commands
+by third party programs is discouraged, as is the use of the
+.Nm arch
+command in general.
+To determine the machine's Instruction Set Architecture (ISA or processor type),
+use
+.Nm
+with the
+.Fl p
+option.
diff --git a/usr/src/man/man5/privileges.5 b/usr/src/man/man5/privileges.5
index 9074cada11..0f3f28d8c1 100644
--- a/usr/src/man/man5/privileges.5
+++ b/usr/src/man/man5/privileges.5
@@ -4,7 +4,7 @@
.\" 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 or http://www.opensolaris.org/os/licensing.
.\" 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]
-.TH PRIVILEGES 5 "May 13, 2017"
+.TH PRIVILEGES 5 "Feb 28, 2018"
.SH NAME
privileges \- process privilege model
.SH DESCRIPTION
@@ -277,7 +277,7 @@ Extensions.
.ad
.sp .6
.RS 4n
-Allow a process to open objects in the filesytem for writing, or otherwise
+Allow a process to open objects in the filesystem for writing, or otherwise
modify them. This privilege is not necessary to write to an already open file
which was opened before dropping the \fBPRIV_FILE_WRITE\fR privilege.
.RE
diff --git a/usr/src/pkg/manifests/diagnostic-cpu-counters.mf b/usr/src/pkg/manifests/diagnostic-cpu-counters.mf
index c2a9fe822b..072531050a 100644
--- a/usr/src/pkg/manifests/diagnostic-cpu-counters.mf
+++ b/usr/src/pkg/manifests/diagnostic-cpu-counters.mf
@@ -56,8 +56,6 @@ $(i386_ONLY)file path=usr/kernel/pcbe/$(ARCH64)/pcbe.AuthenticAMD group=sys \
mode=0755
$(i386_ONLY)file path=usr/kernel/pcbe/$(ARCH64)/pcbe.GenuineIntel.15 group=sys \
mode=0755
-$(i386_ONLY)file path=usr/kernel/pcbe/$(ARCH64)/pcbe.GenuineIntel.6 group=sys \
- mode=0755
$(i386_ONLY)file path=usr/kernel/pcbe/$(ARCH64)/pcbe.GenuineIntel.6.15 \
group=sys mode=0755
file path=usr/lib/$(ARCH64)/libcpc.so.1
@@ -100,8 +98,6 @@ file path=usr/share/man/man3lib/libpctx.3lib
hardlink path=usr/bin/cputrack target=../lib/isaexec
$(sparc_ONLY)hardlink path=usr/kernel/pcbe/$(ARCH64)/pcbe.23 target=pcbe.62
$(sparc_ONLY)hardlink path=usr/kernel/pcbe/$(ARCH64)/pcbe.4.7 target=pcbe.4.6
-$(i386_ONLY)hardlink path=usr/kernel/pcbe/$(ARCH64)/pcbe.GenuineIntel.5 \
- target=pcbe.GenuineIntel.6
legacy pkg=SUNWcpcu desc="CPU Performance Counter libraries and utilities" \
name="CPU Performance Counter libraries and utilities"
license cr_Sun license=cr_Sun
diff --git a/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_pos.ksh b/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_pos.ksh
index d3ceee5a71..1f8d96e9ea 100644
--- a/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_pos.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/bootfs/bootfs_008_pos.ksh
@@ -38,7 +38,8 @@
#
# STRATEGY:
# 1. create pools based on a valid vdev
-# 2. create a filesytem on this pool and set the compression property to gzip1-9
+# 2. create a filesystem on this pool and set the compression property to
+# gzip1-9
# 3. set the pool's bootfs property to filesystem we just configured which
# should not fail
#
diff --git a/usr/src/test/zfs-tests/tests/functional/refquota/refquota_004_pos.ksh b/usr/src/test/zfs-tests/tests/functional/refquota/refquota_004_pos.ksh
index 291cfbd25c..0691c36309 100644
--- a/usr/src/test/zfs-tests/tests/functional/refquota/refquota_004_pos.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/refquota/refquota_004_pos.ksh
@@ -37,7 +37,7 @@
#
# STRATEGY:
# 1. Setting refquota < quota
-# 2. Create file in filesytem, take snapshot and remove the file
+# 2. Create file in filesystem, take snapshot and remove the file
# 3. Verify snapshot will not consume refquota
#
diff --git a/usr/src/test/zfs-tests/tests/functional/refquota/refquota_005_pos.ksh b/usr/src/test/zfs-tests/tests/functional/refquota/refquota_005_pos.ksh
index 16c2ae7851..13977bc3b4 100644
--- a/usr/src/test/zfs-tests/tests/functional/refquota/refquota_005_pos.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/refquota/refquota_005_pos.ksh
@@ -37,7 +37,7 @@
#
# STRATEGY:
# 1. Setting refquota < quota for parent
-# 2. Create file in sub-filesytem, take snapshot and remove the file
+# 2. Create file in sub-filesystem, take snapshot and remove the file
# 3. Verify sub-filesystem snapshot will not consume refquota
#
diff --git a/usr/src/test/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh b/usr/src/test/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh
index 29651b2f5d..7bbdff45d0 100644
--- a/usr/src/test/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/refreserv/refreserv_005_pos.ksh
@@ -37,7 +37,7 @@
#
# STRATEGY:
# 1. Create volume on filesystem
-# 2. Setting quota for parenet filesytem
+# 2. Setting quota for parenet filesystem
# 3. Verify volume refreservation is only limited by volsize
# 4. Verify volume refreservation can be changed when volsize changed
#
diff --git a/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_003_neg.ksh b/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_003_neg.ksh
index 5fd8027f89..2a057f51e7 100644
--- a/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_003_neg.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/rootpool/rootpool_003_neg.ksh
@@ -47,7 +47,7 @@
#
verify_runnable "global"
-log_assert "system related filesytems can not be renamed or destroyed"
+log_assert "system related filesystems can not be renamed or destroyed"
typeset rootpool=$(get_rootpool)
typeset rootfs=$(get_rootfs)
diff --git a/usr/src/tools/scripts/nightly.sh b/usr/src/tools/scripts/nightly.sh
index 91168264d2..272ed4ebe8 100644
--- a/usr/src/tools/scripts/nightly.sh
+++ b/usr/src/tools/scripts/nightly.sh
@@ -27,6 +27,7 @@
# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
# Copyright 2018 (c) Joyent, Inc. All rights reserved.
# Copyright (c) 2017 by Delphix. All rights reserved.
+# Copyright 2018 Joyent, Inc.
#
# Based on the nightly script from the integration folks,
# Mostly modified and owned by mike_s.
@@ -1024,7 +1025,9 @@ function logshuffle {
if [ -f $LLOG -o -d $LLOG ]; then
LLOG=$LLOG.$$
fi
- mkdir $LLOG
+
+ rm -f "$ATLOG/latest" 2>/dev/null
+ mkdir -p $LLOG
export LLOG
if [ "$build_ok" = "y" ]; then
@@ -1106,6 +1109,8 @@ function logshuffle {
fi
mv $LOGFILE $LLOG
+
+ ln -s "$LLOG" "$ATLOG/latest"
}
#
diff --git a/usr/src/uts/common/avs/ns/sdbc/dynmem_readme.txt b/usr/src/uts/common/avs/ns/sdbc/dynmem_readme.txt
index 6ff1eee235..d5fba71d7d 100644
--- a/usr/src/uts/common/avs/ns/sdbc/dynmem_readme.txt
+++ b/usr/src/uts/common/avs/ns/sdbc/dynmem_readme.txt
@@ -48,7 +48,7 @@ in module sd_bcache.c. When a request is received for cache and system
resources it is broken down and each piece catagorized both as an
independent entity and as a member of a group with close neighbors. Cache
resources comprise cache control entries (ccent), write control entries
-(wctrl for FWC support) and sytem memory. The current allocation algorithim
+(wctrl for FWC support) and system memory. The current allocation algorithim
for ccent and wrctl remains the same. The memory allocation has been modified
and falls into two general catagories - single page and multi-page
allocations.
diff --git a/usr/src/uts/common/fs/ctfs/ctfs_root.c b/usr/src/uts/common/fs/ctfs/ctfs_root.c
index cf96908450..aa4d4a9102 100644
--- a/usr/src/uts/common/fs/ctfs/ctfs_root.c
+++ b/usr/src/uts/common/fs/ctfs/ctfs_root.c
@@ -53,7 +53,7 @@
* ctfs, the contract filesystem.
*
* Exposes the construct subsystem to userland. The structure of the
- * filesytem is a public interface, but the behavior of the files is
+ * filesystem is a public interface, but the behavior of the files is
* private and unstable. Contract consumers are expected to use
* libcontract(3lib) to operate on ctfs file descriptors.
*
diff --git a/usr/src/uts/common/fs/smbsrv/smb_server.c b/usr/src/uts/common/fs/smbsrv/smb_server.c
index 55dad2f5d0..46b852f0fb 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_server.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_server.c
@@ -1408,7 +1408,7 @@ smb_server_legacy_kstat_update(kstat_t *ksp, int rw)
rc = 0;
break;
}
- _NOTE(FALLTHRU)
+ /* FALLTHROUGH */
default:
rc = EIO;
break;
diff --git a/usr/src/uts/common/fs/zfs/zfs_acl.c b/usr/src/uts/common/fs/zfs/zfs_acl.c
index e7a32575ee..5906db3656 100644
--- a/usr/src/uts/common/fs/zfs/zfs_acl.c
+++ b/usr/src/uts/common/fs/zfs/zfs_acl.c
@@ -2371,7 +2371,7 @@ slow:
/*
* Determine whether Access should be granted/denied.
*
- * The least priv subsytem is always consulted as a basic privilege
+ * The least priv subsystem is always consulted as a basic privilege
* can define any form of access.
*/
int
diff --git a/usr/src/uts/common/io/fd.c b/usr/src/uts/common/io/fd.c
index e378bf75d5..fadd776414 100644
--- a/usr/src/uts/common/io/fd.c
+++ b/usr/src/uts/common/io/fd.c
@@ -305,6 +305,7 @@ fd_probe(dev_info_t *dip)
* So fall through
*/
#endif /* CMOS_CONF_MEM */
+ /* FALLTHROUGH */
default: /* need to check conf file */
len = sizeof (density);
if (ddi_prop_op(DDI_DEV_T_ANY, dip, PROP_LEN_AND_VAL_BUF,
@@ -381,6 +382,7 @@ fd_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
* So fall through
*/
#endif /* CMOS_CONF_MEM */
+ /* FALLTHROUGH */
default: /* need to check .conf file */
drive_type = 0;
len = sizeof (density);
@@ -600,7 +602,7 @@ fd_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
* (We guess this by looking for a block open. Character
* opens are fine.) This limits some of the usability of
* suspend/resume, but it certainly avoids this
- * potential filesytem corruption from pilot error.
+ * potential filesystem corruption from pilot error.
* Given the decreasing popularity of floppy media, we
* don't see this as much of a limitation.
*/
@@ -1269,7 +1271,7 @@ fdstart(struct fcu_obj *fjp)
/* ARGSUSED */
static int
fd_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cred_p,
- int *rval_p)
+ int *rval_p)
{
union {
struct dk_cinfo dki;
diff --git a/usr/src/uts/common/io/fibre-channel/fca/qlge/qlge_dbg.c b/usr/src/uts/common/io/fibre-channel/fca/qlge/qlge_dbg.c
index 695d254d63..c5bf3b1535 100644
--- a/usr/src/uts/common/io/fibre-channel/fca/qlge/qlge_dbg.c
+++ b/usr/src/uts/common/io/fibre-channel/fca/qlge/qlge_dbg.c
@@ -743,9 +743,9 @@ ql_dump_pci_config(qlge_t *qlge)
qlge->pci_cfg.pci_doorbell_mem_base_address_lower);
ql_printf("\tpci_doorbell_mem_base_address_upper =0x%x.\n",
qlge->pci_cfg.pci_doorbell_mem_base_address_upper);
- ql_printf("\tSubsytem Vendor Id =0x%x.\n",
+ ql_printf("\tSubsystem Vendor Id =0x%x.\n",
qlge->pci_cfg.sub_vendor_id);
- ql_printf("\tSubsytem Id =0x%x.\n",
+ ql_printf("\tSubsystem Id =0x%x.\n",
qlge->pci_cfg.sub_device_id);
ql_printf("\tExpansion ROM Base Register =0x%x.\n",
qlge->pci_cfg.expansion_rom);
diff --git a/usr/src/uts/common/io/ksocket/ksocket.c b/usr/src/uts/common/io/ksocket/ksocket.c
index 393e0aa5d6..d96bfd3d75 100644
--- a/usr/src/uts/common/io/ksocket/ksocket.c
+++ b/usr/src/uts/common/io/ksocket/ksocket.c
@@ -68,7 +68,7 @@ ksocket_socket(ksocket_t *ksp, int domain, int type, int protocol, int flags,
char *mod = NULL;
/*
- * Could be that root file sytem is not loaded or
+ * Could be that root file system is not loaded or
* soconfig has not run yet.
*/
if (type == SOCK_STREAM && (domain == AF_INET ||
diff --git a/usr/src/uts/common/os/zone.c b/usr/src/uts/common/os/zone.c
index 90e5e27d5c..a161fb85a2 100644
--- a/usr/src/uts/common/os/zone.c
+++ b/usr/src/uts/common/os/zone.c
@@ -23,6 +23,7 @@
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2018, Joyent Inc.
* Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
*/
/*
@@ -6272,6 +6273,8 @@ zone_getattr(zoneid_t zoneid, int attr, void *buf, size_t bufsize)
error = EFAULT;
break;
case ZONE_ATTR_NETWORK:
+ bufsize = MIN(bufsize, PIPE_BUF + sizeof (zone_net_data_t));
+ size = bufsize;
zbuf = kmem_alloc(bufsize, KM_SLEEP);
if (copyin(buf, zbuf, bufsize) != 0) {
error = EFAULT;
diff --git a/usr/src/uts/common/sys/fs/ufs_lockfs.h b/usr/src/uts/common/sys/fs/ufs_lockfs.h
index a91334af32..6e2ef0aa9c 100644
--- a/usr/src/uts/common/sys/fs/ufs_lockfs.h
+++ b/usr/src/uts/common/sys/fs/ufs_lockfs.h
@@ -27,8 +27,6 @@
#ifndef _SYS_FS_UFS_LOCKFS_H
#define _SYS_FS_UFS_LOCKFS_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/lockfs.h>
#ifdef __cplusplus
@@ -55,7 +53,7 @@ extern "C" {
*
* ufs_vnodeops(es) that conflict with the above file system lock types
* will get either suspended, or get a EAGAIN error,
- * or get an EIO error if the file sytem is hard locked,
+ * or get an EIO error if the file system is hard locked,
* or will block if the file system is error locked.
*
* There are exceptions.
diff --git a/usr/src/uts/common/vm/vpm.c b/usr/src/uts/common/vm/vpm.c
index db5fdeda85..f3d14613aa 100644
--- a/usr/src/uts/common/vm/vpm.c
+++ b/usr/src/uts/common/vm/vpm.c
@@ -871,7 +871,7 @@ vpm_map_pages(
* If we did not find the page or if this page was not
* in vpm cache(p_vpmref == 0), then let VOP_GETPAGE get
* all the pages.
- * We need to call VOP_GETPAGE so that filesytems can do some
+ * We need to call VOP_GETPAGE so that filesystems can do some
* (un)necessary tracking for sequential access.
*/
diff --git a/usr/src/uts/intel/Makefile.files b/usr/src/uts/intel/Makefile.files
index f9406097c6..54c3af3637 100644
--- a/usr/src/uts/intel/Makefile.files
+++ b/usr/src/uts/intel/Makefile.files
@@ -22,7 +22,7 @@
#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2017, Joyent, Inc.
-# Copyright 2017 Nexenta Systems, Inc.
+# Copyright 2018 Nexenta Systems, Inc.
#
#
@@ -260,11 +260,6 @@ SDT_OBJS += sdt.o
AMD8111S_OBJS += amd8111s_main.o amd8111s_hw.o
#
-# Pentium Performance Counter BackEnd module
-#
-P123_PCBE_OBJS = p123_pcbe.o
-
-#
# Pentium 4 Performance Counter BackEnd module
#
P4_PCBE_OBJS = p4_pcbe.o
diff --git a/usr/src/uts/intel/Makefile.intel b/usr/src/uts/intel/Makefile.intel
index 2d8aed1846..32d8867883 100644
--- a/usr/src/uts/intel/Makefile.intel
+++ b/usr/src/uts/intel/Makefile.intel
@@ -23,7 +23,7 @@
# Copyright (c) 2013 Andrew Stormont. All rights reserved.
# Copyright 2016 Joyent, Inc.
# Copyright 2016 Garrett D'Amore <garrett@damore.org>
-# Copyright 2017 Nexenta Systems, Inc.
+# Copyright 2018 Nexenta Systems, Inc.
#
#
@@ -711,7 +711,7 @@ GENUNIX_KMODS += genunix
#
# Performance Counter BackEnd modules (/usr/kernel/pcbe)
#
-PCBE_KMODS += p123_pcbe p4_pcbe opteron_pcbe core_pcbe
+PCBE_KMODS += p4_pcbe opteron_pcbe core_pcbe
#
# MAC-Type Plugin Modules (/kernel/mac)
diff --git a/usr/src/uts/intel/ia32/os/sysi86.c b/usr/src/uts/intel/ia32/os/sysi86.c
index 308cdddf4f..7be9ec20fd 100644
--- a/usr/src/uts/intel/ia32/os/sysi86.c
+++ b/usr/src/uts/intel/ia32/os/sysi86.c
@@ -293,7 +293,7 @@ ssd_to_usd(struct ssd *ssd, user_desc_t *usd)
/*
* 64-bit code selectors are never allowed in the LDT.
- * Reserved bit is always 0 on 32-bit sytems.
+ * Reserved bit is always 0 on 32-bit systems.
*/
#if defined(__amd64)
usd->usd_long = 0;
diff --git a/usr/src/uts/intel/io/agpgart/agpgart.c b/usr/src/uts/intel/io/agpgart/agpgart.c
index 7df05184e3..64827d58a5 100644
--- a/usr/src/uts/intel/io/agpgart/agpgart.c
+++ b/usr/src/uts/intel/io/agpgart/agpgart.c
@@ -2321,7 +2321,7 @@ err3:
* array and set up the agp aperture page to physical memory page
* translation.
* Arguments:
- * type valid sytem arc types ARC_AMD64AGP, ARC_INTELAGP,
+ * type valid system arc types ARC_AMD64AGP, ARC_INTELAGP,
* ARC_AMD64AGP
* pfnarray allocated physical page frame number array
* pg_offset agp aperture start page to be bound
diff --git a/usr/src/uts/intel/io/dktp/controller/ata/ata_common.c b/usr/src/uts/intel/io/dktp/controller/ata/ata_common.c
index bd0b2e5374..dcd0cbf8d3 100644
--- a/usr/src/uts/intel/io/dktp/controller/ata/ata_common.c
+++ b/usr/src/uts/intel/io/dktp/controller/ata/ata_common.c
@@ -22,6 +22,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2018 RackTop Systems.
*/
#include <sys/types.h>
@@ -3469,7 +3471,7 @@ ata_spec_init_controller(dev_info_t *dip)
*/
static int
ata_prop_lookup_int(dev_t match_dev, dev_info_t *dip,
- uint_t flags, char *name, int defvalue)
+ uint_t flags, char *name, int defvalue)
{
char *bufp, *cp;
@@ -3499,6 +3501,9 @@ ata_prop_lookup_int(dev_t match_dev, dev_info_t *dip,
static void
ata_init_pm(dev_info_t *dip)
{
+ int instance;
+ ata_ctl_t *ata_ctlp;
+#ifdef ATA_USE_AUTOPM
char pmc_name[16];
char *pmc[] = {
NULL,
@@ -3506,8 +3511,7 @@ ata_init_pm(dev_info_t *dip)
"3=PowerOn (PCI D0 State)",
NULL
};
- int instance;
- ata_ctl_t *ata_ctlp;
+#endif
instance = ddi_get_instance(dip);
@@ -3518,10 +3522,10 @@ ata_init_pm(dev_info_t *dip)
if (!ata_is_pci(dip))
return;
+#ifdef ATA_USE_AUTOPM
(void) sprintf(pmc_name, "NAME=ata%d", instance);
pmc[0] = pmc_name;
-#ifdef ATA_USE_AUTOPM
if (ddi_prop_update_string_array(DDI_DEV_T_NONE, dip,
"pm-components", pmc, 3) != DDI_PROP_SUCCESS) {
return;
diff --git a/usr/src/uts/intel/io/dktp/controller/ata/sil3xxx.c b/usr/src/uts/intel/io/dktp/controller/ata/sil3xxx.c
index e358a6e1a7..1865c2abf1 100644
--- a/usr/src/uts/intel/io/dktp/controller/ata/sil3xxx.c
+++ b/usr/src/uts/intel/io/dktp/controller/ata/sil3xxx.c
@@ -22,6 +22,8 @@
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2018 RackTop Systems.
*/
/*
* Silicon Image 3XXX controller specific processing
@@ -55,8 +57,7 @@ sil3xxx_init_controller(dev_info_t *dip, ushort_t vendor_id, ushort_t device_id)
uint32_t fifo_cnt_ctl;
int ports, i;
-#ifdef DEBUG
- /* LINTED */
+#ifdef ATA_DEBUG
ushort_t sfiscfg_val __unused;
#endif
@@ -122,7 +123,7 @@ sil3xxx_init_controller(dev_info_t *dip, ushort_t vendor_id, ushort_t device_id)
/*
* Correct default setting for FIS0cfg
*/
-#ifdef DEBUG
+#ifdef ATA_DEBUG
GET_BAR5_INDIRECT(pci_conf_handle, sfiscfg[i],
sfiscfg_val);
ADBG_WARN(("sil3xxx_init_controller: old val SFISCfg "
@@ -130,7 +131,7 @@ sil3xxx_init_controller(dev_info_t *dip, ushort_t vendor_id, ushort_t device_id)
#endif
PUT_BAR5_INDIRECT(pci_conf_handle, sfiscfg[i],
SFISCFG_ERRATA);
-#ifdef DEBUG
+#ifdef ATA_DEBUG
GET_BAR5_INDIRECT(pci_conf_handle, sfiscfg[i],
sfiscfg_val);
ADBG_WARN(("sil3xxx_init_controller: new val SFISCfg "
diff --git a/usr/src/uts/intel/p123_pcbe/Makefile b/usr/src/uts/intel/p123_pcbe/Makefile
deleted file mode 100644
index d591d52e62..0000000000
--- a/usr/src/uts/intel/p123_pcbe/Makefile
+++ /dev/null
@@ -1,93 +0,0 @@
-#
-# 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
-# or http://www.opensolaris.org/os/licensing.
-# 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 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# This Makefile builds the Pentium 1, 2, and 3 Performance Counter BackEnd (PCBE)
-#
-
-UTSBASE = ../..
-
-#
-# Define module and object file sets.
-#
-MODULE = pcbe.GenuineIntel.6
-OBJECTS = $(P123_PCBE_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(P123_PCBE_OBJS:%.o=$(LINTS_DIR)/%.ln)
-ROOTMODULE = $(ROOT_PSM_PCBE_DIR)/$(MODULE)
-ROOTLINK = $(ROOT_PSM_PCBE_DIR)/pcbe.GenuineIntel.5
-
-#
-# Include common rules.
-#
-include $(UTSBASE)/intel/Makefile.intel
-
-#
-# Define targets.
-#
-ALL_TARGET = $(BINARY)
-LINT_MODULE = p123_pcbe
-LINT_TARGET = $(LINT_MODULE).lint
-INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK)
-
-#
-# For now, disable these lint checks; maintainers should endeavor
-# to investigate and remove these for maximum lint coverage.
-# Please do not carry these forward to new Makefiles.
-#
-LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON
-LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
-LINTTAGS += -erroff=E_STATIC_UNUSED
-
-CERRWARN += -_gcc=-Wno-type-limits
-CERRWARN += -_gcc=-Wno-unused-function
-
-#
-# Default build targets.
-#
-.KEEP_STATE:
-
-def: $(DEF_DEPS)
-
-all: $(ALL_DEPS)
-
-clean: $(CLEAN_DEPS)
-
-clobber: $(CLOBBER_DEPS)
-
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
-install: $(INSTALL_DEPS)
-
-$(ROOTLINK): $(ROOTMODULE)
- -$(RM) $@; ln $(ROOTMODULE) $@
-
-#
-# Include common targets.
-#
-include $(UTSBASE)/intel/Makefile.targ
diff --git a/usr/src/uts/intel/pcbe/p123_pcbe.c b/usr/src/uts/intel/pcbe/p123_pcbe.c
deleted file mode 100644
index bd5cfb7386..0000000000
--- a/usr/src/uts/intel/pcbe/p123_pcbe.c
+++ /dev/null
@@ -1,1091 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/*
- * This file contains preset event names from the Performance Application
- * Programming Interface v3.5 which included the following notice:
- *
- * Copyright (c) 2005,6
- * Innovative Computing Labs
- * Computer Science Department,
- * University of Tennessee,
- * Knoxville, TN.
- * All Rights Reserved.
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the University of Tennessee nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * This open source software license conforms to the BSD License template.
- */
-
-/*
- * Performance Counter Back-End for Pentiums I, II, and III.
- */
-
-#include <sys/cpuvar.h>
-#include <sys/param.h>
-#include <sys/cpc_impl.h>
-#include <sys/cpc_pcbe.h>
-#include <sys/modctl.h>
-#include <sys/inttypes.h>
-#include <sys/systm.h>
-#include <sys/cmn_err.h>
-#include <sys/x86_archext.h>
-#include <sys/sdt.h>
-#include <sys/archsystm.h>
-#include <sys/privregs.h>
-#include <sys/ddi.h>
-#include <sys/sunddi.h>
-
-static int64_t diff3931(uint64_t sample, uint64_t old);
-static uint64_t trunc3931(uint64_t value);
-
-static int ptm_pcbe_init(void);
-static uint_t ptm_pcbe_ncounters(void);
-static const char *ptm_pcbe_impl_name(void);
-static const char *ptm_pcbe_cpuref(void);
-static char *ptm_pcbe_list_events(uint_t picnum);
-static char *ptm_pcbe_list_attrs(void);
-static uint64_t ptm_pcbe_event_coverage(char *event);
-static int ptm_pcbe_pic_index(char *picname);
-static uint64_t ptm_pcbe_overflow_bitmap(void);
-static int ptm_pcbe_configure(uint_t picnum, char *event, uint64_t preset,
- uint32_t flags, uint_t nattrs, kcpc_attr_t *attrs, void **data,
- void *token);
-static void ptm_pcbe_program(void *token);
-static void ptm_pcbe_allstop(void);
-static void ptm_pcbe_sample(void *token);
-static void ptm_pcbe_free(void *config);
-
-pcbe_ops_t ptm_pcbe_ops = {
- PCBE_VER_1,
- 0,
- ptm_pcbe_ncounters,
- ptm_pcbe_impl_name,
- ptm_pcbe_cpuref,
- ptm_pcbe_list_events,
- ptm_pcbe_list_attrs,
- ptm_pcbe_event_coverage,
- ptm_pcbe_overflow_bitmap,
- ptm_pcbe_configure,
- ptm_pcbe_program,
- ptm_pcbe_allstop,
- ptm_pcbe_sample,
- ptm_pcbe_free
-};
-
-typedef enum _ptm_ver {
- PTM_VER_P5,
- PTM_VER_P6
-} ptm_ver_t;
-
-static ptm_ver_t ptm_ver;
-static const char *ptm_impl_name;
-static const char *ptm_cpuref;
-static char *pic_events[2] = { NULL, NULL };
-
-/*
- * Indicates whether the "rdpmc" instruction is available on this processor.
- */
-static int ptm_rdpmc_avail = 0;
-
-#define ALL_STOPPED 0ULL
-
-typedef struct _ptm_pcbe_config {
- uint8_t ptm_picno; /* 0 for pic0 or 1 for pic1 */
- uint32_t ptm_ctl; /* P6: PerfEventSelect; P5: cesr, shifted */
- uint64_t ptm_rawpic;
-} ptm_pcbe_config_t;
-
-struct nametable {
- uint8_t bits;
- const char *name;
-};
-
-typedef struct _ptm_generic_events {
- char *name;
- char *event;
- uint8_t umask;
-} ptm_generic_event_t;
-
-#define NT_END 0xFF
-#define CPC_GEN_END { NULL, NULL }
-
-/*
- * Basic Pentium events
- */
-#define P5_EVENTS \
- {0x0, "data_read"}, \
- {0x1, "data_write"}, \
- {0x2, "data_tlb_miss"}, \
- {0x3, "data_read_miss"}, \
- {0x4, "data_write_miss"}, \
- {0x5, "write_hit_to_M_or_E"}, \
- {0x6, "dcache_lines_wrback"}, \
- {0x7, "external_snoops"}, \
- {0x8, "external_dcache_snoop_hits"}, \
- {0x9, "memory_access_in_both_pipes"}, \
- {0xa, "bank_conflicts"}, \
- {0xb, "misaligned_ref"}, \
- {0xc, "code_read"}, \
- {0xd, "code_tlb_miss"}, \
- {0xe, "code_cache_miss"}, \
- {0xf, "any_segreg_loaded"}, \
- {0x12, "branches"}, \
- {0x13, "btb_hits"}, \
- {0x14, "taken_or_btb_hit"}, \
- {0x15, "pipeline_flushes"}, \
- {0x16, "instr_exec"}, \
- {0x17, "instr_exec_V_pipe"}, \
- {0x18, "clks_bus_cycle"}, \
- {0x19, "clks_full_wbufs"}, \
- {0x1a, "pipe_stall_read"}, \
- {0x1b, "stall_on_write_ME"}, \
- {0x1c, "locked_bus_cycle"}, \
- {0x1d, "io_rw_cycles"}, \
- {0x1e, "reads_noncache_mem"}, \
- {0x1f, "pipeline_agi_stalls"}, \
- {0x22, "flops"}, \
- {0x23, "bp_match_dr0"}, \
- {0x24, "bp_match_dr1"}, \
- {0x25, "bp_match_dr2"}, \
- {0x26, "bp_match_dr3"}, \
- {0x27, "hw_intrs"}, \
- {0x28, "data_rw"}, \
- {0x29, "data_rw_miss"}
-
-static const struct nametable P5mmx_names0[] = {
- P5_EVENTS,
- {0x2a, "bus_ownership_latency"},
- {0x2b, "mmx_instr_upipe"},
- {0x2c, "cache_M_line_sharing"},
- {0x2d, "emms_instr"},
- {0x2e, "bus_util_processor"},
- {0x2f, "sat_mmx_instr"},
- {0x30, "clks_not_HLT"},
- {0x31, "mmx_data_read"},
- {0x32, "clks_fp_stall"},
- {0x33, "d1_starv_fifo_0"},
- {0x34, "mmx_data_write"},
- {0x35, "pipe_flush_wbp"},
- {0x36, "mmx_misalign_data_refs"},
- {0x37, "rets_pred_incorrect"},
- {0x38, "mmx_multiply_unit_interlock"},
- {0x39, "rets"},
- {0x3a, "btb_false_entries"},
- {0x3b, "clocks_stall_full_wb"},
- {NT_END, ""}
-};
-
-static const struct nametable P5mmx_names1[] = {
- P5_EVENTS,
- {0x2a, "bus_ownership_transfers"},
- {0x2b, "mmx_instr_vpipe"},
- {0x2c, "cache_lint_sharing"},
- {0x2d, "mmx_fp_transitions"},
- {0x2e, "writes_noncache_mem"},
- {0x2f, "sats_performed"},
- {0x30, "clks_dcache_tlb_miss"},
- {0x31, "mmx_data_read_miss"},
- {0x32, "taken_br"},
- {0x33, "d1_starv_fifo_1"},
- {0x34, "mmx_data_write_miss"},
- {0x35, "pipe_flush_wbp_wb"},
- {0x36, "mmx_pipe_stall_data_read"},
- {0x37, "rets_pred"},
- {0x38, "movd_movq_stall"},
- {0x39, "rsb_overflow"},
- {0x3a, "btb_mispred_nt"},
- {0x3b, "mmx_stall_write_ME"},
- {NT_END, ""}
-};
-
-static const struct nametable *P5mmx_names[2] = {
- P5mmx_names0,
- P5mmx_names1
-};
-
-/*
- * Pentium Pro and Pentium II events
- */
-static const struct nametable _P6_names[] = {
- /*
- * Data cache unit
- */
- {0x43, "data_mem_refs"},
- {0x45, "dcu_lines_in"},
- {0x46, "dcu_m_lines_in"},
- {0x47, "dcu_m_lines_out"},
- {0x48, "dcu_miss_outstanding"},
-
- /*
- * Instruction fetch unit
- */
- {0x80, "ifu_ifetch"},
- {0x81, "ifu_ifetch_miss"},
- {0x85, "itlb_miss"},
- {0x86, "ifu_mem_stall"},
- {0x87, "ild_stall"},
-
- /*
- * L2 cache
- */
- {0x28, "l2_ifetch"},
- {0x29, "l2_ld"},
- {0x2a, "l2_st"},
- {0x24, "l2_lines_in"},
- {0x26, "l2_lines_out"},
- {0x25, "l2_m_lines_inm"},
- {0x27, "l2_m_lines_outm"},
- {0x2e, "l2_rqsts"},
- {0x21, "l2_ads"},
- {0x22, "l2_dbus_busy"},
- {0x23, "l2_dbus_busy_rd"},
-
- /*
- * External bus logic
- */
- {0x62, "bus_drdy_clocks"},
- {0x63, "bus_lock_clocks"},
- {0x60, "bus_req_outstanding"},
- {0x65, "bus_tran_brd"},
- {0x66, "bus_tran_rfo"},
- {0x67, "bus_trans_wb"},
- {0x68, "bus_tran_ifetch"},
- {0x69, "bus_tran_inval"},
- {0x6a, "bus_tran_pwr"},
- {0x6b, "bus_trans_p"},
- {0x6c, "bus_trans_io"},
- {0x6d, "bus_tran_def"},
- {0x6e, "bus_tran_burst"},
- {0x70, "bus_tran_any"},
- {0x6f, "bus_tran_mem"},
- {0x64, "bus_data_rcv"},
- {0x61, "bus_bnr_drv"},
- {0x7a, "bus_hit_drv"},
- {0x7b, "bus_hitm_drv"},
- {0x7e, "bus_snoop_stall"},
-
- /*
- * Floating point unit
- */
- {0xc1, "flops"}, /* 0 only */
- {0x10, "fp_comp_ops_exe"}, /* 0 only */
- {0x11, "fp_assist"}, /* 1 only */
- {0x12, "mul"}, /* 1 only */
- {0x13, "div"}, /* 1 only */
- {0x14, "cycles_div_busy"}, /* 0 only */
-
- /*
- * Memory ordering
- */
- {0x3, "ld_blocks"},
- {0x4, "sb_drains"},
- {0x5, "misalign_mem_ref"},
-
- /*
- * Instruction decoding and retirement
- */
- {0xc0, "inst_retired"},
- {0xc2, "uops_retired"},
- {0xd0, "inst_decoder"},
-
- /*
- * Interrupts
- */
- {0xc8, "hw_int_rx"},
- {0xc6, "cycles_int_masked"},
- {0xc7, "cycles_int_pending_and_masked"},
-
- /*
- * Branches
- */
- {0xc4, "br_inst_retired"},
- {0xc5, "br_miss_pred_retired"},
- {0xc9, "br_taken_retired"},
- {0xca, "br_miss_pred_taken_ret"},
- {0xe0, "br_inst_decoded"},
- {0xe2, "btb_misses"},
- {0xe4, "br_bogus"},
- {0xe6, "baclears"},
-
- /*
- * Stalls
- */
- {0xa2, "resource_stalls"},
- {0xd2, "partial_rat_stalls"},
-
- /*
- * Segment register loads
- */
- {0x6, "segment_reg_loads"},
-
- /*
- * Clocks
- */
- {0x79, "cpu_clk_unhalted"},
-
- /*
- * MMX
- */
- {0xb0, "mmx_instr_exec"},
- {0xb1, "mmx_sat_instr_exec"},
- {0xb2, "mmx_uops_exec"},
- {0xb3, "mmx_instr_type_exec"},
- {0xcc, "fp_mmx_trans"},
- {0xcd, "mmx_assists"},
- {0xce, "mmx_instr_ret"},
- {0xd4, "seg_rename_stalls"},
- {0xd5, "seg_reg_renames"},
- {0xd6, "ret_seg_renames"},
-
- {NT_END, ""}
-};
-
-static const struct nametable *P6_names[2] = {
- _P6_names,
- _P6_names
-};
-
-#define P5_GENERIC_EVENTS \
- { "PAPI_tot_ins", "instr_exec", 0x0 }, \
- { "PAPI_tlb_dm", "data_tlb_miss", 0x0 }, \
- { "PAPI_tlb_im", "code_tlb_miss", 0x0 }, \
- { "PAPI_fp_ops", "flops" }
-
-static const ptm_generic_event_t P5mmx_generic_names0[] = {
- P5_GENERIC_EVENTS,
- { "PAPI_tot_cyc", "clks_not_HLT", 0x0 },
- CPC_GEN_END
-};
-
-static const ptm_generic_event_t P5mmx_generic_names1[] = {
- P5_GENERIC_EVENTS,
- { "PAPI_br_ins", "taken_br", 0x0 },
- CPC_GEN_END
-};
-
-static const ptm_generic_event_t *P5mmx_generic_names[2] = {
- P5mmx_generic_names0,
- P5mmx_generic_names1
-};
-
-static const ptm_generic_event_t _P6_generic_names[] = {
- { "PAPI_ca_shr", "l2_ifetch", 0xf },
- { "PAPI_ca_cln", "bus_tran_rfo", 0x0 },
- { "PAPI_ca_itv", "bus_tran_inval", 0x0 },
- { "PAPI_tlb_im", "itlb_miss", 0x0 },
- { "PAPI_btac_m", "btb_misses", 0x0 },
- { "PAPI_hw_int", "hw_int_rx", 0x0 },
- { "PAPI_br_cn", "br_inst_retired", 0x0 },
- { "PAPI_br_tkn", "br_taken_retired", 0x0 },
- { "PAPI_br_msp", "br_miss_pred_taken_ret", 0x0 },
- { "PAPI_br_ins", "br_inst_retired", 0x0 },
- { "PAPI_res_stl", "resource_stalls", 0x0 },
- { "PAPI_tot_iis", "inst_decoder", 0x0 },
- { "PAPI_tot_ins", "inst_retired", 0x0 },
- { "PAPI_tot_cyc", "cpu_clk_unhalted", 0x0 },
- { "PAPI_l1_dcm", "dcu_lines_in", 0x0 },
- { "PAPI_l1_icm", "l2_ifetch", 0xf },
- { "PAPI_l1_tcm", "l2_rqsts", 0xf },
- { "PAPI_l1_dca", "data_mem_refs", 0x0 },
- { "PAPI_l1_stm", "l2_st", 0xf },
- { "PAPI_l2_icm", "bus_tran_ifetch", 0x0 },
- { "PAPI_l2_dcr", "l2_ld", 0xf },
- { "PAPI_l2_dcw", "l2_st", 0xf },
- { "PAPI_l2_tcm", "l2_lines_in", 0x0 },
- { "PAPI_l2_tca", "l2_rqsts", 0xf },
- { "PAPI_l2_tcw", "l2_st", 0xf },
- { "PAPI_l2_stm", "l2_m_lines_inm", 0x0 },
- { "PAPI_fp_ins", "flops", 0x0 },
- { "PAPI_fp_ops", "flops", 0x0 },
- { "PAPI_fml_ins", "mul", 0x0 },
- { "PAPI_fdv_ins", "div", 0x0 },
- CPC_GEN_END
-};
-
-static const ptm_generic_event_t *P6_generic_names[2] = {
- _P6_generic_names,
- _P6_generic_names
-};
-
-static const struct nametable **events;
-static const ptm_generic_event_t **generic_events;
-
-#define BITS(v, u, l) \
- (((v) >> (l)) & ((1 << (1 + (u) - (l))) - 1))
-
-/*
- * "Well known" bit fields in the Pentium CES register
- * The interfaces in libcpc should make these #defines uninteresting.
- */
-#define CPC_P5_CESR_ES0_SHIFT 0
-#define CPC_P5_CESR_ES0_MASK 0x3f
-#define CPC_P5_CESR_ES1_SHIFT 16
-#define CPC_P5_CESR_ES1_MASK 0x3f
-
-#define CPC_P5_CESR_OS0 6
-#define CPC_P5_CESR_USR0 7
-#define CPC_P5_CESR_CLK0 8
-#define CPC_P5_CESR_PC0 9
-#define CPC_P5_CESR_OS1 (CPC_P5_CESR_OS0 + 16)
-#define CPC_P5_CESR_USR1 (CPC_P5_CESR_USR0 + 16)
-#define CPC_P5_CESR_CLK1 (CPC_P5_CESR_CLK0 + 16)
-#define CPC_P5_CESR_PC1 (CPC_P5_CESR_PC0 + 16)
-
-/*
- * "Well known" bit fields in the Pentium Pro PerfEvtSel registers
- * The interfaces in libcpc should make these #defines uninteresting.
- */
-#define CPC_P6_PES_INV 23
-#define CPC_P6_PES_EN 22
-#define CPC_P6_PES_INT 20
-#define CPC_P6_PES_PC 19
-#define CPC_P6_PES_E 18
-#define CPC_P6_PES_OS 17
-#define CPC_P6_PES_USR 16
-
-#define CPC_P6_PES_UMASK_SHIFT 8
-#define CPC_P6_PES_UMASK_MASK (0xffu)
-
-#define CPC_P6_PES_CMASK_SHIFT 24
-#define CPC_P6_PES_CMASK_MASK (0xffu)
-
-#define CPC_P6_PES_PIC0_MASK (0xffu)
-#define CPC_P6_PES_PIC1_MASK (0xffu)
-
-#define P6_PES_EN (UINT32_C(1) << CPC_P6_PES_EN)
-#define P6_PES_INT (UINT32_C(1) << CPC_P6_PES_INT)
-#define P6_PES_OS (UINT32_C(1) << CPC_P6_PES_OS)
-
-/*
- * Pentium 5 attributes
- */
-#define P5_NOEDGE 0x1 /* "noedge" - no edge detection */
-#define P5_PC 0x2 /* "pc" - pin control */
-
-/*
- * Pentium 6 attributes
- */
-#define P6_NOEDGE 0x1
-#define P6_PC 0x2
-#define P6_INV 0x4 /* "inv" - count inverted transitions */
-#define P6_INT 0x8 /* "int" - interrupt on overflow */
-
-/*
- * CPU reference strings
- */
-
-#define P5_CPUREF "See Appendix A.4 of the \"IA-32 Intel Architecture " \
- "Software Developer's Manual Volume 3: System " \
- "Programming Guide,\" Order # 245472-012, 2003"
-
-#define P6_CPUREF "See Appendix A.3 of the \"IA-32 Intel Architecture " \
- "Software Developer's Manual Volume 3: System " \
- "Programming Guide,\" Order # 245472-012, 2003"
-
-static int
-ptm_pcbe_init(void)
-{
- const struct nametable *n;
- const ptm_generic_event_t *gevp;
- int i;
- size_t size;
-
- if (is_x86_feature(x86_featureset, X86FSET_MMX))
- ptm_rdpmc_avail = 1;
-
- /*
- * Discover type of CPU and set events pointer appropriately.
- *
- * Map family and model into the performance
- * counter architectures we currently understand.
- *
- * See application note AP485 (from developer.intel.com)
- * for further explanation.
- */
- if (cpuid_getvendor(CPU) != X86_VENDOR_Intel)
- return (-1);
- switch (cpuid_getfamily(CPU)) {
- case 5: /* Pentium and Pentium with MMX */
- events = P5mmx_names;
- generic_events = P5mmx_generic_names;
- ptm_ver = PTM_VER_P5;
- ptm_cpuref = P5_CPUREF;
- if (cpuid_getmodel(CPU) < 4)
- ptm_impl_name = "Pentium";
- else
- ptm_impl_name = "Pentium with MMX";
- break;
- case 6: /* Pentium Pro and Pentium II and III */
- events = P6_names;
- generic_events = P6_generic_names;
- ptm_ver = PTM_VER_P6;
- ptm_cpuref = P6_CPUREF;
- ptm_pcbe_ops.pcbe_caps = CPC_CAP_OVERFLOW_INTERRUPT;
- if (is_x86_feature(x86_featureset, X86FSET_MMX))
- ptm_impl_name = "Pentium Pro with MMX, Pentium II";
- else
- ptm_impl_name = "Pentium Pro, Pentium II";
- break;
- default:
- return (-1);
- }
-
- /*
- * Initialize the list of events for each PIC.
- * Do two passes: one to compute the size necessary and another
- * to copy the strings. Need room for event, comma, and NULL terminator.
- */
- for (i = 0; i < 2; i++) {
- size = 0;
- for (n = events[i]; n->bits != NT_END; n++)
- size += strlen(n->name) + 1;
- for (gevp = generic_events[i]; gevp->name != NULL; gevp++)
- size += strlen(gevp->name) + 1;
- pic_events[i] = kmem_alloc(size + 1, KM_SLEEP);
- *pic_events[i] = '\0';
- for (n = events[i]; n->bits != NT_END; n++) {
- (void) strcat(pic_events[i], n->name);
- (void) strcat(pic_events[i], ",");
- }
- for (gevp = generic_events[i]; gevp->name != NULL; gevp++) {
- (void) strcat(pic_events[i], gevp->name);
- (void) strcat(pic_events[i], ",");
- }
-
- /*
- * Remove trailing comma.
- */
- pic_events[i][size - 1] = '\0';
- }
-
- return (0);
-}
-
-static uint_t
-ptm_pcbe_ncounters(void)
-{
- return (2);
-}
-
-static const char *
-ptm_pcbe_impl_name(void)
-{
- return (ptm_impl_name);
-}
-
-static const char *
-ptm_pcbe_cpuref(void)
-{
- return (ptm_cpuref);
-}
-
-static char *
-ptm_pcbe_list_events(uint_t picnum)
-{
- ASSERT(picnum >= 0 && picnum < cpc_ncounters);
-
- if (pic_events[0] == NULL) {
- ASSERT(pic_events[1] == NULL);
- }
-
- return (pic_events[picnum]);
-}
-
-static char *
-ptm_pcbe_list_attrs(void)
-{
- if (ptm_ver == PTM_VER_P5)
- return ("noedge,pc");
- else
- return ("noedge,pc,inv,int,umask,cmask");
-}
-
-static const ptm_generic_event_t *
-find_generic_event(int regno, char *name)
-{
- const ptm_generic_event_t *gevp;
-
- for (gevp = generic_events[regno]; gevp->name != NULL; gevp++)
- if (strcmp(name, gevp->name) == 0)
- return (gevp);
-
- return (NULL);
-}
-
-static const struct nametable *
-find_event(int regno, char *name)
-{
- const struct nametable *n;
-
- n = events[regno];
-
- for (; n->bits != NT_END; n++)
- if (strcmp(name, n->name) == 0)
- return (n);
-
- return (NULL);
-}
-
-static uint64_t
-ptm_pcbe_event_coverage(char *event)
-{
- uint64_t bitmap = 0;
-
- if ((find_event(0, event) != NULL) ||
- (find_generic_event(0, event) != NULL))
- bitmap = 0x1;
- if ((find_event(1, event) != NULL) ||
- (find_generic_event(1, event) != NULL))
- bitmap |= 0x2;
-
- return (bitmap);
-}
-
-static uint64_t
-ptm_pcbe_overflow_bitmap(void)
-{
- uint64_t ret = 0;
- uint64_t pes[2];
-
- /*
- * P5 is not capable of generating interrupts.
- */
- ASSERT(ptm_ver == PTM_VER_P6);
-
- /*
- * CPC could have caused an interrupt provided that
- *
- * 1) Counters are enabled
- * 2) Either counter has requested an interrupt
- */
-
- pes[0] = rdmsr(REG_PERFEVNT0);
- if (((uint32_t)pes[0] & P6_PES_EN) != P6_PES_EN)
- return (0);
-
- /*
- * If a particular counter requested an interrupt, assume it caused
- * this interrupt. There is no way to determine which counter overflowed
- * on this hardware other than by using unreliable heuristics.
- */
-
- pes[1] = rdmsr(REG_PERFEVNT1);
- if ((uint32_t)pes[0] & P6_PES_INT)
- ret |= 0x1;
- if ((uint32_t)pes[1] & P6_PES_INT)
- ret |= 0x2;
-
- return (ret);
-}
-
-/*ARGSUSED*/
-static int
-ptm_pcbe_configure(uint_t picnum, char *eventname, uint64_t preset,
- uint32_t flags, uint_t nattrs, kcpc_attr_t *attrs, void **data,
- void *token)
-{
- ptm_pcbe_config_t *conf;
- const struct nametable *n;
- const ptm_generic_event_t *gevp;
- struct nametable nt_raw = { 0, "raw" };
- int i;
- int ptm_flags = 0;
-
- /*
- * If we've been handed an existing configuration, we need only preset
- * the counter value.
- */
- if (*data != NULL) {
- conf = *data;
- conf->ptm_rawpic = trunc3931(preset);
- return (0);
- }
-
- if (picnum != 0 && picnum != 1)
- return (CPC_INVALID_PICNUM);
-
- conf = kmem_alloc(sizeof (ptm_pcbe_config_t), KM_SLEEP);
-
- conf->ptm_picno = picnum;
- conf->ptm_rawpic = trunc3931(preset);
- conf->ptm_ctl = 0;
-
- if ((n = find_event(picnum, eventname)) == NULL) {
- if ((gevp = find_generic_event(picnum, eventname)) != NULL) {
- n = find_event(picnum, gevp->event);
- ASSERT(n != NULL);
-
- if (nattrs > 0) {
- kmem_free(conf, sizeof (ptm_pcbe_config_t));
- return (CPC_ATTRIBUTE_OUT_OF_RANGE);
- }
-
- if (ptm_ver == PTM_VER_P6)
- conf->ptm_ctl |= gevp->umask <<
- CPC_P6_PES_UMASK_SHIFT;
- } else {
- long tmp;
-
- /*
- * If ddi_strtol() likes this event, use it as a raw
- * event code.
- */
- if (ddi_strtol(eventname, NULL, 0, &tmp) != 0) {
- kmem_free(conf, sizeof (ptm_pcbe_config_t));
- return (CPC_INVALID_EVENT);
- }
-
- nt_raw.bits = tmp;
-
- if (ptm_ver == PTM_VER_P5)
- nt_raw.bits &= CPC_P5_CESR_ES0_MASK;
- else
- nt_raw.bits &= CPC_P6_PES_PIC0_MASK;
-
- n = &nt_raw;
- }
- }
-
- if (ptm_ver == PTM_VER_P5) {
- int picshift;
- picshift = (picnum == 0) ? 0 : 16;
-
- for (i = 0; i < nattrs; i++) {
- /*
- * Value of these attributes is ignored; their presence
- * alone tells us to set the corresponding flag.
- */
- if (strncmp(attrs[i].ka_name, "noedge", 7) == 0) {
- if (attrs[i].ka_val != 0)
- ptm_flags |= P5_NOEDGE;
- } else if (strncmp(attrs[i].ka_name, "pc", 3) == 0) {
- if (attrs[i].ka_val != 0)
- ptm_flags |= P5_PC;
- } else {
- kmem_free(conf, sizeof (ptm_pcbe_config_t));
- return (CPC_INVALID_ATTRIBUTE);
- }
- }
-
- if (flags & CPC_COUNT_USER)
- conf->ptm_ctl |= (1 << (CPC_P5_CESR_USR0 + picshift));
- if (flags & CPC_COUNT_SYSTEM)
- conf->ptm_ctl |= (1 << (CPC_P5_CESR_OS0 + picshift));
- if (ptm_flags & P5_NOEDGE)
- conf->ptm_ctl |= (1 << (CPC_P5_CESR_CLK0 + picshift));
- if (ptm_flags & P5_PC)
- conf->ptm_ctl |= (1 << (CPC_P5_CESR_PC0 + picshift));
-
- ASSERT((n->bits | CPC_P5_CESR_ES0_MASK) ==
- CPC_P5_CESR_ES0_MASK);
-
- conf->ptm_ctl |= (n->bits << picshift);
- } else {
- for (i = 0; i < nattrs; i++) {
- if (strncmp(attrs[i].ka_name, "noedge", 6) == 0) {
- if (attrs[i].ka_val != 0)
- ptm_flags |= P6_NOEDGE;
- } else if (strncmp(attrs[i].ka_name, "pc", 2) == 0) {
- if (attrs[i].ka_val != 0)
- ptm_flags |= P6_PC;
- } else if (strncmp(attrs[i].ka_name, "inv", 3) == 0) {
- if (attrs[i].ka_val != 0)
- ptm_flags |= P6_INV;
- } else if (strncmp(attrs[i].ka_name, "umask", 5) == 0) {
- if ((attrs[i].ka_val | CPC_P6_PES_UMASK_MASK) !=
- CPC_P6_PES_UMASK_MASK) {
- kmem_free(conf,
- sizeof (ptm_pcbe_config_t));
- return (CPC_ATTRIBUTE_OUT_OF_RANGE);
- }
- conf->ptm_ctl |= (uint8_t)attrs[i].ka_val <<
- CPC_P6_PES_UMASK_SHIFT;
- } else if (strncmp(attrs[i].ka_name, "cmask", 5) == 0) {
- if ((attrs[i].ka_val | CPC_P6_PES_CMASK_MASK) !=
- CPC_P6_PES_CMASK_MASK) {
- kmem_free(conf,
- sizeof (ptm_pcbe_config_t));
- return (CPC_ATTRIBUTE_OUT_OF_RANGE);
- }
- conf->ptm_ctl |= (uint8_t)attrs[i].ka_val <<
- CPC_P6_PES_CMASK_SHIFT;
- } else if (strncmp(attrs[i].ka_name, "int", 3) == 0) {
- if (attrs[i].ka_val != 0)
- ptm_flags |= P6_INT;
- } else {
- kmem_free(conf, sizeof (ptm_pcbe_config_t));
- return (CPC_INVALID_ATTRIBUTE);
- }
- }
-
- if (flags & CPC_OVF_NOTIFY_EMT)
- /*
- * If the user has requested notification of overflows,
- * we automatically program the hardware to generate
- * overflow interrupts.
- */
- ptm_flags |= P6_INT;
- if (flags & CPC_COUNT_USER)
- conf->ptm_ctl |= (1 << CPC_P6_PES_USR);
- if (flags & CPC_COUNT_SYSTEM)
- conf->ptm_ctl |= (1 << CPC_P6_PES_OS);
- if ((ptm_flags & P6_NOEDGE) == 0)
- conf->ptm_ctl |= (1 << CPC_P6_PES_E);
- if (ptm_flags & P6_PC)
- conf->ptm_ctl |= (1 << CPC_P6_PES_PC);
- if (ptm_flags & P6_INV)
- conf->ptm_ctl |= (1 << CPC_P6_PES_INV);
- if (ptm_flags & P6_INT)
- conf->ptm_ctl |= (1 << CPC_P6_PES_INT);
-
- ASSERT((n->bits | CPC_P6_PES_PIC0_MASK) ==
- CPC_P6_PES_PIC0_MASK);
-
- conf->ptm_ctl |= n->bits;
- }
-
- *data = conf;
- return (0);
-}
-
-static void
-ptm_pcbe_program(void *token)
-{
- ptm_pcbe_config_t *pic0;
- ptm_pcbe_config_t *pic1;
- ptm_pcbe_config_t *tmp;
- ptm_pcbe_config_t empty = { 1, 0, 0 }; /* assume pic1 to start */
-
- if ((pic0 = kcpc_next_config(token, NULL, NULL)) == NULL)
- panic("ptm_pcbe: token %p has no configs", token);
-
- if ((pic1 = kcpc_next_config(token, pic0, NULL)) == NULL)
- pic1 = &empty;
-
- if (pic0->ptm_picno != 0) {
- empty.ptm_picno = 0;
- tmp = pic1;
- pic1 = pic0;
- pic0 = tmp;
- }
-
- ASSERT(pic0->ptm_picno == 0 && pic1->ptm_picno == 1);
-
- if (ptm_rdpmc_avail) {
- ulong_t curcr4 = getcr4();
- if (kcpc_allow_nonpriv(token))
- setcr4(curcr4 | CR4_PCE);
- else
- setcr4(curcr4 & ~CR4_PCE);
- }
-
- if (ptm_ver == PTM_VER_P5) {
- wrmsr(P5_CESR, ALL_STOPPED);
- wrmsr(P5_CTR0, pic0->ptm_rawpic);
- wrmsr(P5_CTR1, pic1->ptm_rawpic);
- wrmsr(P5_CESR, pic0->ptm_ctl | pic1->ptm_ctl);
- pic0->ptm_rawpic = rdmsr(P5_CTR0);
- pic1->ptm_rawpic = rdmsr(P5_CTR1);
- } else {
- uint64_t pes;
- wrmsr(REG_PERFEVNT0, ALL_STOPPED);
- wrmsr(REG_PERFCTR0, pic0->ptm_rawpic);
- wrmsr(REG_PERFCTR1, pic1->ptm_rawpic);
- pes = pic1->ptm_ctl;
- DTRACE_PROBE1(ptm__pes1, uint64_t, pes);
- wrmsr(REG_PERFEVNT1, pes);
- pes = pic0->ptm_ctl | (1 << CPC_P6_PES_EN);
- DTRACE_PROBE1(ptm__pes0, uint64_t, pes);
- wrmsr(REG_PERFEVNT0, pes);
- }
-}
-
-static void
-ptm_pcbe_allstop(void)
-{
- if (ptm_ver == PTM_VER_P5)
- wrmsr(P5_CESR, ALL_STOPPED);
- else {
- wrmsr(REG_PERFEVNT0, ALL_STOPPED);
- setcr4(getcr4() & ~CR4_PCE);
- }
-}
-
-static void
-ptm_pcbe_sample(void *token)
-{
- ptm_pcbe_config_t *pic0;
- ptm_pcbe_config_t *pic1;
- ptm_pcbe_config_t *swap;
- ptm_pcbe_config_t empty = { 1, 0, 0 }; /* assume pic1 to start */
- uint64_t tmp;
- uint64_t *pic0_data;
- uint64_t *pic1_data;
- uint64_t *dtmp;
- uint64_t curpic[2];
-
- if ((pic0 = kcpc_next_config(token, NULL, &pic0_data)) == NULL)
- panic("ptm_pcbe: token %p has no configs", token);
-
- if ((pic1 = kcpc_next_config(token, pic0, &pic1_data)) == NULL) {
- pic1 = &empty;
- pic1_data = &tmp;
- }
-
- if (pic0->ptm_picno != 0) {
- empty.ptm_picno = 0;
- swap = pic0;
- pic0 = pic1;
- pic1 = swap;
- dtmp = pic0_data;
- pic0_data = pic1_data;
- pic1_data = dtmp;
- }
-
- ASSERT(pic0->ptm_picno == 0 && pic1->ptm_picno == 1);
-
- if (ptm_ver == PTM_VER_P5) {
- curpic[0] = rdmsr(P5_CTR0);
- curpic[1] = rdmsr(P5_CTR1);
- } else {
- curpic[0] = rdmsr(REG_PERFCTR0);
- curpic[1] = rdmsr(REG_PERFCTR1);
- }
-
- DTRACE_PROBE1(ptm__curpic0, uint64_t, curpic[0]);
- DTRACE_PROBE1(ptm__curpic1, uint64_t, curpic[1]);
-
- *pic0_data += diff3931(curpic[0], pic0->ptm_rawpic);
- pic0->ptm_rawpic = trunc3931(*pic0_data);
-
- *pic1_data += diff3931(curpic[1], pic1->ptm_rawpic);
- pic1->ptm_rawpic = trunc3931(*pic1_data);
-}
-
-static void
-ptm_pcbe_free(void *config)
-{
- kmem_free(config, sizeof (ptm_pcbe_config_t));
-}
-
-/*
- * Virtualizes the 40-bit field of the %pic
- * register into a 64-bit software register.
- *
- * We can retrieve 40 (signed) bits from the counters,
- * but we can set only 32 (signed) bits into the counters.
- * This makes virtualizing more than 31-bits of registers
- * quite tricky.
- *
- * If bits 39 to 31 are set in the virtualized pic register,
- * then we can preset the counter to this value using the fact
- * that wrmsr sign extends bit 31. Though it might look easier
- * to only use the bottom 31-bits of the register, we have to allow
- * the full 40-bits to be used to perform overflow profiling.
- */
-
-#define MASK40 UINT64_C(0xffffffffff)
-#define MASK31 UINT64_C(0x7fffffff)
-#define BITS_39_31 UINT64_C(0xff80000000)
-
-static int64_t
-diff3931(uint64_t sample, uint64_t old)
-{
- int64_t diff;
-
- if ((old & BITS_39_31) == BITS_39_31) {
- diff = (MASK40 & sample) - old;
- if (diff < 0)
- diff += (UINT64_C(1) << 40);
- } else {
- diff = (MASK31 & sample) - old;
- if (diff < 0)
- diff += (UINT64_C(1) << 31);
- }
- return (diff);
-}
-
-static uint64_t
-trunc3931(uint64_t value)
-{
- if ((value & BITS_39_31) == BITS_39_31)
- return (MASK40 & value);
- return (MASK31 & value);
-}
-
-static struct modlpcbe modlpcbe = {
- &mod_pcbeops,
- "Pentium Performance Counters",
- &ptm_pcbe_ops
-};
-
-static struct modlinkage modl = {
- MODREV_1,
- &modlpcbe,
-};
-
-int
-_init(void)
-{
- if (ptm_pcbe_init() != 0)
- return (ENOTSUP);
- return (mod_install(&modl));
-}
-
-int
-_fini(void)
-{
- return (mod_remove(&modl));
-}
-
-int
-_info(struct modinfo *mi)
-{
- return (mod_info(&modl, mi));
-}
diff --git a/usr/src/uts/intel/sys/x86_archext.h b/usr/src/uts/intel/sys/x86_archext.h
index c06f3098ef..475bb85738 100644
--- a/usr/src/uts/intel/sys/x86_archext.h
+++ b/usr/src/uts/intel/sys/x86_archext.h
@@ -21,7 +21,6 @@
/*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
- * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright (c) 2010, Intel Corporation.
@@ -32,6 +31,7 @@
* Copyright 2012 Jens Elkner <jel+illumos@cs.uni-magdeburg.de>
* Copyright 2012 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
* Copyright 2014 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright 2018 Nexenta Systems, Inc.
*/
#ifndef _SYS_X86_ARCHEXT_H
@@ -255,26 +255,7 @@ extern "C" {
#define CPUID_INTC_EAX_D_1_XSAVEC 0x00000002 /* xsavec inst. */
#define CPUID_INTC_EAX_D_1_XSAVES 0x00000008 /* xsaves inst. */
-#define P5_MCHADDR 0x0
-#define P5_CESR 0x11
-#define P5_CTR0 0x12
-#define P5_CTR1 0x13
-
-#define K5_MCHADDR 0x0
-#define K5_MCHTYPE 0x01
-#define K5_TSC 0x10
-#define K5_TR12 0x12
-
-#define REG_PAT 0x277
-
-#define REG_MC0_CTL 0x400
-#define REG_MC5_MISC 0x417
-#define REG_PERFCTR0 0xc1
-#define REG_PERFCTR1 0xc2
-
-#define REG_PERFEVNT0 0x186
-#define REG_PERFEVNT1 0x187
-
+#define REG_PAT 0x277
#define REG_TSC 0x10 /* timestamp counter */
#define REG_APIC_BASE_MSR 0x1b
#define REG_X2APIC_BASE_MSR 0x800 /* The MSR address offset of x2APIC */