summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-05-12 12:20:38 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-05-12 12:20:38 +0000
commit7f81972ee25d8b65417a4f0b42124ba6e48616ac (patch)
tree663d39c04c8740abe5a8179df2431930a52488c4
parent8c6284f26f84d01dcbb0f93a15e9cf0da38c36de (diff)
parent868e1ac07011f1f9626a73a411c31ebbdd462e3d (diff)
downloadillumos-joyent-7f81972ee25d8b65417a4f0b42124ba6e48616ac.tar.gz
[illumos-gate merge]
commit 868e1ac07011f1f9626a73a411c31ebbdd462e3d 12554 want sdev plugin framework (fix header issue) commit b237158d576c3f39f35d97c4dd214c07273ddde4 12674 want mac rx barrier function commit b939b187ee16d21b506005807c652e2c7bdfe243 12645 vds: smatch and NULL pointer errors commit f8927fa6636832af96f657f29571bdbd213c6247 12554 want sdev plugin framework commit 725953abcc30bcf6f15d7b8a313ab0749275d95f 12610 rmcadm: NULL pointer errors commit cb453c7ae4b42ac7a2d7ce155181572a96d69b33 12650 ds: smatch and NULL pointer errors commit 29368e865707707ba77989693d34358ebfa08757 12644 vdc: NULL pointer errors commit 59b05390e07c3b0e69288f9a732dc5b90d464721 12539 mdb: NULL pointer errors commit 8124b8119d8ab7f80f1bd8b094cd96356f531b54 12597 want libutempter commit c8907381b10259bed3a871a2881c0f3b7287ab3c 12705 remove __builtin_alloca() declaration from string.h Conflicts: usr/src/uts/common/sys/mac_impl.h usr/src/uts/common/sys/Makefile
-rw-r--r--manifest13
-rw-r--r--usr/src/cmd/mandoc/lib.in1
-rw-r--r--usr/src/cmd/mandoc/msec.in1
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_cmds.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/sd/sd.c74
-rw-r--r--usr/src/cmd/mdb/sparc/kmdb/kaif.c18
-rw-r--r--usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c7
-rw-r--r--usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c6
-rw-r--r--usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c2
-rw-r--r--usr/src/cmd/mdb/sparc/modules/intr/intr.c2
-rw-r--r--usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c77
-rw-r--r--usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c80
-rw-r--r--usr/src/cmd/mdb/sun4u/modules/unix/unix.c19
-rw-r--r--usr/src/cmd/mdb/sun4v/modules/errh/errh.c11
-rw-r--r--usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c12
-rw-r--r--usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c2
-rw-r--r--usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c4
-rw-r--r--usr/src/head/string.h8
-rw-r--r--usr/src/lib/Makefile2
-rw-r--r--usr/src/lib/libutempter/Makefile37
-rw-r--r--usr/src/lib/libutempter/Makefile.com30
-rw-r--r--usr/src/lib/libutempter/THIRDPARTYLICENSE23
-rw-r--r--usr/src/lib/libutempter/THIRDPARTYLICENSE.descrip1
-rw-r--r--usr/src/lib/libutempter/amd64/Makefile15
-rw-r--r--usr/src/lib/libutempter/common/mapfile-vers38
-rw-r--r--usr/src/lib/libutempter/common/utempter.c132
-rw-r--r--usr/src/lib/libutempter/common/utempter.h47
-rw-r--r--usr/src/lib/libutempter/i386/Makefile14
-rw-r--r--usr/src/lib/libutempter/sparc/Makefile14
-rw-r--r--usr/src/lib/libutempter/sparcv9/Makefile15
-rw-r--r--usr/src/man/Makefile1
-rw-r--r--usr/src/man/man3utempter/Makefile35
-rw-r--r--usr/src/man/man3utempter/utempter_add_record.3utempter134
-rw-r--r--usr/src/pkg/manifests/system-header.mf1
-rw-r--r--usr/src/pkg/manifests/system-library-libutempter.mf44
-rw-r--r--usr/src/uts/common/io/mac/mac_client.c26
-rw-r--r--usr/src/uts/common/sys/fs/sdev_impl.h1
-rw-r--r--usr/src/uts/intel/dev/Makefile1
-rw-r--r--usr/src/uts/sun4u/io/rmcadm.c2
-rw-r--r--usr/src/uts/sun4u/rmcadm/Makefile14
-rw-r--r--usr/src/uts/sun4v/ds/Makefile20
-rw-r--r--usr/src/uts/sun4v/io/ds_common.c4
-rw-r--r--usr/src/uts/sun4v/io/ds_drv.c8
-rw-r--r--usr/src/uts/sun4v/io/vdc.c81
-rw-r--r--usr/src/uts/sun4v/io/vds.c103
-rw-r--r--usr/src/uts/sun4v/sys/ds_impl.h8
-rw-r--r--usr/src/uts/sun4v/vdc/Makefile8
-rw-r--r--usr/src/uts/sun4v/vds/Makefile8
48 files changed, 884 insertions, 324 deletions
diff --git a/manifest b/manifest
index ee453a8c12..f2f04f9d90 100644
--- a/manifest
+++ b/manifest
@@ -4151,6 +4151,7 @@ f usr/include/sys/fs/pc_label.h 0644 root bin
f usr/include/sys/fs/pc_node.h 0644 root bin
f usr/include/sys/fs/pxfs_ki.h 0644 root bin
f usr/include/sys/fs/sdev_impl.h 0644 root bin
+f usr/include/sys/fs/sdev_plugin.h 0644 root bin
f usr/include/sys/fs/snode.h 0644 root bin
f usr/include/sys/fs/swapnode.h 0644 root bin
f usr/include/sys/fs/tmp.h 0644 root bin
@@ -4901,6 +4902,7 @@ f usr/include/unistd.h 0644 root bin
f usr/include/user_attr.h 0644 root bin
f usr/include/userdefs.h 0644 root bin
f usr/include/ustat.h 0644 root bin
+f usr/include/utempter.h 0644 root bin
f usr/include/utility.h 0644 root bin
f usr/include/utime.h 0644 root bin
f usr/include/utmp.h 0644 root bin
@@ -5413,6 +5415,8 @@ s usr/lib/amd64/libtsol.so.2=../../../lib/amd64/libtsol.so.2
s usr/lib/amd64/libtsol.so=../../../lib/amd64/libtsol.so.2
s usr/lib/amd64/libumem.so.1=../../../lib/amd64/libumem.so.1
s usr/lib/amd64/libumem.so=../../../lib/amd64/libumem.so.1
+f usr/lib/amd64/libutempter.so.1 0755 root bin
+s usr/lib/amd64/libutempter.so=../../../lib/amd64/libutempter.so.1
s usr/lib/amd64/libuuid.so.1=../../../lib/amd64/libuuid.so.1
s usr/lib/amd64/libuuid.so=../../../lib/amd64/libuuid.so.1
s usr/lib/amd64/libuutil.so.1=../../../lib/amd64/libuutil.so.1
@@ -6943,6 +6947,8 @@ s usr/lib/libtsol.so.2=../../lib/libtsol.so.2
s usr/lib/libtsol.so=../../lib/libtsol.so.2
s usr/lib/libumem.so.1=../../lib/libumem.so.1
s usr/lib/libumem.so=../../lib/libumem.so.1
+f usr/lib/libutempter.so.1 0755 root bin
+s usr/lib/libutempter.so=../../lib/libutempter.so.1
s usr/lib/libuuid.so.1=../../lib/libuuid.so.1
s usr/lib/libuuid.so=../../lib/libuuid.so.1
s usr/lib/libuutil.so.1=../../lib/libuutil.so.1
@@ -18625,6 +18631,13 @@ f usr/share/man/man3tnf/tnfctl_strerror.3tnf 0444 root bin
f usr/share/man/man3tnf/tnfctl_trace_attrs_get.3tnf 0444 root bin
f usr/share/man/man3tnf/tnfctl_trace_state_set.3tnf 0444 root bin
f usr/share/man/man3tnf/tracing.3tnf 0444 root bin
+d usr/share/man/man3utempter 0755 root bin
+s usr/share/man/man3utempter/addToUtmp.3utempter=utempter_add_record.3utempter
+s usr/share/man/man3utempter/removeFromUtmp.3utempter=utempter_add_record.3utempter
+s usr/share/man/man3utempter/removeLineFromUtmp.3utempter=utempter_add_record.3utempter
+f usr/share/man/man3utempter/utempter_add_record.3utempter 0444 root bin
+s usr/share/man/man3utempter/utempter_remove_added_record.3utempter=utempter_add_record.3utempter
+s usr/share/man/man3utempter/utempter_remove_record.3utempter=utempter_add_record.3utempter
d usr/share/man/man3uuid 0755 root bin
f usr/share/man/man3uuid/uuid_clear.3uuid 0444 root bin
s usr/share/man/man3uuid/uuid_compare.3uuid=uuid_clear.3uuid
diff --git a/usr/src/cmd/mandoc/lib.in b/usr/src/cmd/mandoc/lib.in
index 0d65eeb086..9e42725de5 100644
--- a/usr/src/cmd/mandoc/lib.in
+++ b/usr/src/cmd/mandoc/lib.in
@@ -77,6 +77,7 @@ LINE("libtecla", "Interactive Command Line Input Library (libtecla, \\-ltecla)")
LINE("libtnfctl", "TNF Probe Control Library (libtnfctl, \\-ltnfctl)")
LINE("libtsol", "Trusted Extensions Library (libtsol, \\-ltsol)")
LINE("libumem", "Object-Caching Memory Allocation Library (libumem, \\-lumem")
+LINE("libutempter", "UTEMPTER Library (libutempter, \\-lutempter)")
LINE("libuuid", "UUID Library (libuuid, \\-luuid)")
LINE("libvolmgt", "Volume Management Library (libvolmgt, \\-lvolmgt)")
LINE("libxcurses", "X/Open Curses Library (libxcurses, \\-lxcurses)")
diff --git a/usr/src/cmd/mandoc/msec.in b/usr/src/cmd/mandoc/msec.in
index 10861ddd07..09069603b7 100644
--- a/usr/src/cmd/mandoc/msec.in
+++ b/usr/src/cmd/mandoc/msec.in
@@ -88,6 +88,7 @@ LINE("3SYSEVENT", "System Event Library Functions")
LINE("3TECLA", "Interactive Command-line Input Library Functions")
LINE("3TNF", "TNF Library Functions")
LINE("3TSOL", "Trusted Extensions Library Functions")
+LINE("3UTEMPTER", "UTEMPTER Library Functions")
LINE("3UUID", "Universally Unique Identifier Library Functions")
LINE("3VOLMGT", "Volume Management Library Functions")
LINE("3XCURSES", "X/Open Curses Library Functions")
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
index cd50cdce17..9943773424 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
@@ -1956,14 +1956,14 @@ cmd_findsym(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
} else
value = argv[i].a_un.a_val;
- if (value != NULL)
+ if (value != (uintptr_t)NULL)
symlist[len++] = value;
}
if (flags & DCMD_ADDRSPEC)
symlist[len++] = addr;
- symlist[len] = NULL;
+ symlist[len] = (uintptr_t)NULL;
if (optg)
type = MDB_TGT_BIND_GLOBAL | MDB_TGT_TYPE_FUNC;
diff --git a/usr/src/cmd/mdb/common/modules/sd/sd.c b/usr/src/cmd/mdb/common/modules/sd/sd.c
index 3de82ff809..7e87cf005b 100644
--- a/usr/src/cmd/mdb/common/modules/sd/sd.c
+++ b/usr/src/cmd/mdb/common/modules/sd/sd.c
@@ -139,7 +139,7 @@ buf_avforw_walk_step(mdb_walk_state_t *wsp)
}
status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
- wsp->walk_cbdata);
+ wsp->walk_cbdata);
wsp->walk_addr = (uintptr_t)(((buf_t *)wsp->walk_data)->av_forw);
return (status);
@@ -221,37 +221,37 @@ static void
dump_xbuf_attr(struct __ddi_xbuf_attr *xba_ptr, uintptr_t mem_addr)
{
mdb_printf("0x%8lx:\tmutex\t\tallocsize\tpending\n",
- mem_addr + offsetof(struct __ddi_xbuf_attr, xa_mutex));
+ mem_addr + offsetof(struct __ddi_xbuf_attr, xa_mutex));
mdb_printf(" \t%lx\t\t%d\t\t%d\n",
- xba_ptr->xa_mutex._opaque[0], xba_ptr->xa_allocsize,
- xba_ptr->xa_pending);
+ xba_ptr->xa_mutex._opaque[0], xba_ptr->xa_allocsize,
+ xba_ptr->xa_pending);
mdb_printf("0x%8lx:\tactive_limit\tactive_count\tactive_lowater\n",
- mem_addr + offsetof(struct __ddi_xbuf_attr, xa_active_limit));
+ mem_addr + offsetof(struct __ddi_xbuf_attr, xa_active_limit));
mdb_printf(" \t%lx\t\t%lx\t\t%lx\n",
- xba_ptr->xa_active_limit, xba_ptr->xa_active_count,
- xba_ptr->xa_active_lowater);
+ xba_ptr->xa_active_limit, xba_ptr->xa_active_count,
+ xba_ptr->xa_active_lowater);
mdb_printf("0x%8lx:\theadp\t\ttailp\n",
- mem_addr + offsetof(struct __ddi_xbuf_attr, xa_headp));
+ mem_addr + offsetof(struct __ddi_xbuf_attr, xa_headp));
mdb_printf(" \t%lx%c\t%lx\n",
- xba_ptr->xa_headp, (xba_ptr->xa_headp == 0?'\t':' '),
- xba_ptr->xa_tailp);
+ xba_ptr->xa_headp, (xba_ptr->xa_headp == 0?'\t':' '),
+ xba_ptr->xa_tailp);
mdb_printf(
"0x%8lx:\treserve_mutex\treserve_limit\treserve_count\treserve_headp\n",
- mem_addr + offsetof(struct __ddi_xbuf_attr, xa_reserve_mutex));
+ mem_addr + offsetof(struct __ddi_xbuf_attr, xa_reserve_mutex));
mdb_printf(" \t%lx\t\t%lx\t\t%lx\t\t%lx\n",
- xba_ptr->xa_reserve_mutex._opaque[0], xba_ptr->xa_reserve_limit,
- xba_ptr->xa_reserve_count, xba_ptr->xa_reserve_headp);
+ xba_ptr->xa_reserve_mutex._opaque[0], xba_ptr->xa_reserve_limit,
+ xba_ptr->xa_reserve_count, xba_ptr->xa_reserve_headp);
mdb_printf("0x%8lx:\ttimeid\t\ttq\n",
- mem_addr + offsetof(struct __ddi_xbuf_attr, xa_timeid));
+ mem_addr + offsetof(struct __ddi_xbuf_attr, xa_timeid));
mdb_printf(" \t%lx%c\t%lx\n",
- xba_ptr->xa_timeid, (xba_ptr->xa_timeid == 0?'\t':' '),
- xba_ptr->xa_tq);
+ xba_ptr->xa_timeid, (xba_ptr->xa_timeid == 0?'\t':' '),
+ xba_ptr->xa_tq);
}
/*
@@ -278,7 +278,7 @@ init_softstate_members(mdb_walk_state_t *wsp)
SD_DATA(valid_root_count) = 0;
if (mdb_vread((void *)&SD_DATA(sd_state_data),
- sizeof (sd_state_str_t), wsp->walk_addr) == -1) {
+ sizeof (sd_state_str_t), wsp->walk_addr) == -1) {
mdb_warn("failed to sd_state at %p", wsp->walk_addr);
return (WALK_ERR);
}
@@ -333,7 +333,7 @@ sd_state_walk_init(mdb_walk_state_t *wsp)
static int
ssd_state_walk_init(mdb_walk_state_t *wsp)
{
- if (wsp->walk_addr == NULL &&
+ if (wsp->walk_addr == (uintptr_t)NULL &&
mdb_readvar(&wsp->walk_addr, "ssd_state") == -1) {
mdb_warn("failed to read 'ssd_state'");
return (WALK_ERR);
@@ -381,7 +381,7 @@ sd_state_walk_step(mdb_walk_state_t *wsp)
}
status = wsp->walk_callback((uintptr_t)tp, wsp->walk_data,
- wsp->walk_cbdata);
+ wsp->walk_cbdata);
if (tp != 0) {
/* Count the number of non-zero un entries. */
SD_DATA(valid_root_count++);
@@ -442,7 +442,7 @@ process_semo_sleepq(uintptr_t walk_addr, int silent)
}
if (mdb_vread((void *)&currentBuf, sizeof (buf_t),
- rootBuf) == -1) {
+ rootBuf) == -1) {
mdb_warn("failed to read buf at %p", rootBuf);
return (FAIL);
}
@@ -459,7 +459,7 @@ process_semo_sleepq(uintptr_t walk_addr, int silent)
if (rootBuf == 0) {
mdb_printf("------------------------------\n");
mdb_printf("Processed %d SEMOCLOSE SLEEP Q entries\n",
- semo_sleepq_count);
+ semo_sleepq_count);
mdb_printf("------------------------------\n");
}
@@ -498,9 +498,9 @@ process_sdlun_waitq(uintptr_t walk_addr, int silent)
}
if (mdb_vread(&currentBuf, sizeof (buf_t),
- (uintptr_t)rootBuf) == -1) {
+ (uintptr_t)rootBuf) == -1) {
mdb_warn("failed to read buf at %p",
- (uintptr_t)rootBuf);
+ (uintptr_t)rootBuf);
return (FAIL);
}
@@ -550,7 +550,7 @@ process_xbuf(uintptr_t xbuf_attr, int silent)
/* Process the Xbuf Attr struct for a device. */
if (mdb_vread((void *)&xba, sizeof (struct __ddi_xbuf_attr),
- xbuf_attr) == -1) {
+ xbuf_attr) == -1) {
mdb_warn("failed to read xbuf_attr at %p", xbuf_attr);
return (FAIL);
}
@@ -578,9 +578,9 @@ process_xbuf(uintptr_t xbuf_attr, int silent)
}
if (mdb_vread((void *)&xba_current, sizeof (buf_t),
- (uintptr_t)xba_root) == -1) {
+ (uintptr_t)xba_root) == -1) {
mdb_warn("failed to read buf at %p",
- (uintptr_t)xba_root);
+ (uintptr_t)xba_root);
return (FAIL);
}
if (!silent) {
@@ -612,10 +612,10 @@ static void
print_footer(const void *walk_data)
{
if (SD_DATA_IN_CBACK(current_list_count) >=
- (SD_DATA_IN_CBACK(sd_state_data.n_items) - 1)) {
+ (SD_DATA_IN_CBACK(sd_state_data.n_items) - 1)) {
mdb_printf("---------------------------\n");
mdb_printf("Processed %d UN softstate entries\n",
- SD_DATA_IN_CBACK(valid_root_count));
+ SD_DATA_IN_CBACK(valid_root_count));
mdb_printf("---------------------------\n");
}
}
@@ -651,13 +651,13 @@ sd_callback(uintptr_t addr, const void *walk_data, void *flg_silent)
if (SD_DATA_IN_CBACK(current_list_count) == 0) {
mdb_printf("walk_addr = %lx\n", SD_DATA_IN_CBACK(sd_state));
mdb_printf("walking sd_state units via ptr: %lx\n",
- SD_DATA_IN_CBACK(current_root));
+ SD_DATA_IN_CBACK(current_root));
mdb_printf("%d entries in sd_state table\n",
- SD_DATA_IN_CBACK(sd_state_data.n_items));
+ SD_DATA_IN_CBACK(sd_state_data.n_items));
}
mdb_printf("\nun %d: %lx\n", SD_DATA_IN_CBACK(current_list_count),
- addr);
+ addr);
mdb_printf("--------------\n");
@@ -691,7 +691,7 @@ sd_callback(uintptr_t addr, const void *walk_data, void *flg_silent)
/* process device semoclose wait Q */
if (sdLun.un_semoclose._opaque[1] == 0) {
process_semo_sleepq((uintptr_t)sdLun.un_semoclose._opaque[0],
- silent);
+ silent);
}
/* print the actual number of soft state processed */
@@ -725,7 +725,7 @@ dcmd_sd_state(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
/* Enable the silent mode if '-s' option specified the user */
if (mdb_getopts(argc, argv, 's', MDB_OPT_SETBITS, TRUE, &silent, NULL)
- != argc) {
+ != argc) {
return (DCMD_USAGE);
}
@@ -764,7 +764,7 @@ dcmd_sd_state(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
/* process device's semoclose wait Q */
if (sdLun.un_semoclose._opaque[1] == 0) {
process_semo_sleepq(
- (uintptr_t)sdLun.un_semoclose._opaque[0], silent);
+ (uintptr_t)sdLun.un_semoclose._opaque[0], silent);
}
}
return (DCMD_OK);
@@ -797,7 +797,7 @@ dcmd_ssd_state(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
/* Enable the silent mode if '-s' option specified the user */
if (mdb_getopts(argc, argv, 's', MDB_OPT_SETBITS, TRUE, &silent, NULL)
- != argc) {
+ != argc) {
return (DCMD_USAGE);
}
@@ -835,7 +835,7 @@ dcmd_ssd_state(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
/* process device's semoclose wait Q */
if (sdLun.un_semoclose._opaque[1] == 0) {
process_semo_sleepq(
- (uintptr_t)sdLun.un_semoclose._opaque[0], silent);
+ (uintptr_t)sdLun.un_semoclose._opaque[0], silent);
}
}
return (DCMD_OK);
@@ -872,7 +872,7 @@ dcmd_buf_avforw(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
*/
if ((flags & DCMD_ADDRSPEC)) {
mdb_pwalk("buf_avforw", buf_callback, (void *)&buf_entries,
- addr);
+ addr);
return (DCMD_OK);
} else {
mdb_printf("buffer address required with the command\n");
diff --git a/usr/src/cmd/mdb/sparc/kmdb/kaif.c b/usr/src/cmd/mdb/sparc/kmdb/kaif.c
index b8a8565b16..6251b2e30e 100644
--- a/usr/src/cmd/mdb/sparc/kmdb/kaif.c
+++ b/usr/src/cmd/mdb/sparc/kmdb/kaif.c
@@ -397,7 +397,7 @@ kaif_wapt_reserve(kmdb_wapt_t *wp)
else
addrp = &kaif_vwapt_addr;
- if (*addrp != NULL)
+ if (*addrp != 0)
return (set_errno(EMDB_WPTOOMANY));
*addrp = wp->wp_addr;
@@ -412,8 +412,8 @@ kaif_wapt_release(kmdb_wapt_t *wp)
uint64_t *addrp = (wp->wp_type == DPI_WAPT_TYPE_PHYS ?
&kaif_pwapt_addr : &kaif_vwapt_addr);
- ASSERT(*addrp != NULL);
- *addrp = NULL;
+ ASSERT(*addrp != 0);
+ *addrp = 0;
}
/*ARGSUSED*/
@@ -487,10 +487,10 @@ kaif_wapt_set_regs(void)
ASSERT((kaif_lsuctl & ~KAIF_LSUCTL_WAPT_MASK) == NULL);
- lsu = rdasi(ASI_LSU, NULL);
+ lsu = rdasi(ASI_LSU, (uintptr_t)NULL);
lsu &= ~KAIF_LSUCTL_WAPT_MASK;
lsu |= kaif_lsuctl;
- wrasi(ASI_LSU, NULL, lsu);
+ wrasi(ASI_LSU, (uintptr_t)NULL, lsu);
#endif /* sun4v */
}
@@ -501,9 +501,9 @@ kaif_wapt_clear_regs(void)
* Sun4v doesn't have watch point regs
*/
#ifndef sun4v
- uint64_t lsu = rdasi(ASI_LSU, NULL);
+ uint64_t lsu = rdasi(ASI_LSU, (uintptr_t)NULL);
lsu &= ~KAIF_LSUCTL_WAPT_MASK;
- wrasi(ASI_LSU, NULL, lsu);
+ wrasi(ASI_LSU, (uintptr_t)NULL, lsu);
#endif /* sun4v */
}
@@ -742,7 +742,7 @@ static const mdb_bitmask_t krm_flag_bits[] = {
{ "M_PE", KAIF_CRUMB_F_MAIN_OBPPENT, KAIF_CRUMB_F_MAIN_OBPPENT },
{ "M_NRM", KAIF_CRUMB_F_MAIN_NORMAL, KAIF_CRUMB_F_MAIN_NORMAL },
{ "I_RE", KAIF_CRUMB_F_IVEC_REENTER, KAIF_CRUMB_F_IVEC_REENTER },
- { "I_OBP", KAIF_CRUMB_F_IVEC_INOBP, KAIF_CRUMB_F_IVEC_INOBP },
+ { "I_OBP", KAIF_CRUMB_F_IVEC_INOBP, KAIF_CRUMB_F_IVEC_INOBP },
{ "I_NRM", KAIF_CRUMB_F_IVEC_NORMAL, KAIF_CRUMB_F_IVEC_NORMAL },
{ "O_NRM", KAIF_CRUMB_F_OBP_NORMAL, KAIF_CRUMB_F_OBP_NORMAL },
{ "O_REVEC", KAIF_CRUMB_F_OBP_REVECT, KAIF_CRUMB_F_OBP_REVECT },
@@ -798,7 +798,7 @@ kaif_dump_crumbs(uintptr_t addr, int cpuid)
{
int i;
- if (addr != NULL) {
+ if (addr != (uintptr_t)NULL) {
/* dump_crumb will protect us from bogus addresses */
dump_crumb((kaif_crumb_t *)addr);
diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c
index b7cc077dee..0b7b150c40 100644
--- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c
+++ b/usr/src/cmd/mdb/sparc/kmdb/kmdb_kdi_isadep.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* SPARC-specific portions of the KDI
*/
@@ -66,7 +64,8 @@ kdi_cpu_ready_iter(int (*cb)(int, void *), void *arg)
static int
kdi_xc_one(int cpuid, void (*cb)(void))
{
- return (mdb.m_kdi->mkdi_xc_one(cpuid, (void (*)())cb, NULL, NULL));
+ return (mdb.m_kdi->mkdi_xc_one(cpuid, (void (*)())cb, (uintptr_t)NULL,
+ (uintptr_t)NULL));
}
/*ARGSUSED1*/
@@ -157,7 +156,7 @@ kdi_halt_cpu(int cpuid, void *state_saverp)
if (state != DPI_CPU_STATE_MASTER && state != DPI_CPU_STATE_SLAVE) {
res = kdi_xc_one(cpuid, state_saver);
- rc = 1;
+ rc = 1;
if (res == KDI_XC_RES_OK)
msg = "accepted the";
diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c
index 1d3781f1e9..3b233209de 100644
--- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c
+++ b/usr/src/cmd/mdb/sparc/kmdb/kmdb_makecontext.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Context-saving routine used for pipelines. Designed for use only
* with kmdb_setcontext, and with the assumption that func() will never
@@ -59,6 +57,6 @@ kmdb_makecontext(ucontext_t *ucp, void (*func)(void *), void *arg, caddr_t stk,
ucp->uc_mcontext.gregs[REG_nPC] = (greg_t)func + 4;
ucp->uc_mcontext.gregs[REG_O0] = (greg_t)arg;
ucp->uc_mcontext.gregs[REG_SP] = (greg_t)(stack - STACK_BIAS);
- ucp->uc_mcontext.gregs[REG_O7] = NULL;
- ucp->uc_mcontext.gregs[REG_G7] = NULL;
+ ucp->uc_mcontext.gregs[REG_O7] = 0;
+ ucp->uc_mcontext.gregs[REG_G7] = 0;
}
diff --git a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c b/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c
index 6db4861bd7..ff7aa494a0 100644
--- a/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c
+++ b/usr/src/cmd/mdb/sparc/kmdb/kmdb_promif_isadep.c
@@ -75,7 +75,7 @@ kmdb_prom_get_ddi_prop(kmdb_auxv_t *kav, char *propname)
ssize_t len;
char *val;
- if ((node = prom_finddevice("/options")) == NULL)
+ if ((node = prom_finddevice("/options")) == 0)
return (NULL);
if ((len = prom_getproplen(node, propname)) < 0)
diff --git a/usr/src/cmd/mdb/sparc/modules/intr/intr.c b/usr/src/cmd/mdb/sparc/modules/intr/intr.c
index cdfbf1c4ce..1ffb7edcce 100644
--- a/usr/src/cmd/mdb/sparc/modules/intr/intr.c
+++ b/usr/src/cmd/mdb/sparc/modules/intr/intr.c
@@ -64,7 +64,7 @@ static int detailed = 0; /* Print detailed view */
static int
intr_walk_init(mdb_walk_state_t *wsp)
{
- wsp->walk_addr = NULL;
+ wsp->walk_addr = (uintptr_t)NULL;
return (WALK_NEXT);
}
diff --git a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c b/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c
index 48aed6c313..5bdea9bc81 100644
--- a/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c
+++ b/usr/src/cmd/mdb/sun4u/modules/opl/oplhwd/oplhwd.c
@@ -23,7 +23,6 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/mdb_modapi.h>
#include <sys/types.h>
@@ -151,7 +150,7 @@ dumpmemhwd(hwd_memory_t *memp, int v, int mv)
mdb_printf("\tDIMM %d\tstatus\t0x%x (%s)\n",
i, memp->mem_dimms[i].dimm_status,
hwd_stat_decode(
- memp->mem_dimms[i].dimm_status));
+ memp->mem_dimms[i].dimm_status));
continue;
}
mdb_printf("\tDIMM %d\tstatus\t0x%x (%s)\tcapacity\t0x%llx\n",
@@ -241,16 +240,16 @@ dumpchiphwd(hwd_cpu_chip_t *chipp, int ch, int v, int mv)
mdb_printf("\tsharing\t%x\n",
corep->core_l2_cache_sharing);
mdb_printf("\t\tITLB entries\t0x%x\tDTLB entries "
- "0x%x\n", corep->core_num_itlb_entries,
+ "0x%x\n", corep->core_num_itlb_entries,
corep->core_num_dtlb_entries);
}
for (cp = 0; cp < HWD_CPUS_PER_CORE; cp++) {
cpup = &corep->core_cpus[cp];
mdb_printf("\t\tCPU %d:\tstatus\t0x%x (%s)\tcpuid"
- " = 0x%x\n", cp, cpup->cpu_status,
- hwd_stat_decode(cpup->cpu_status),
- cpup->cpu_cpuid);
+ " = 0x%x\n", cp, cpup->cpu_status,
+ hwd_stat_decode(cpup->cpu_status),
+ cpup->cpu_cpuid);
if (v & DUMP_COMP_NAME)
mdb_printf("\t\t\tcomponent name:%s\n",
cpup->cpu_component_name);
@@ -320,10 +319,10 @@ dumpahwd(int bd, int v)
if (mdb_vread(&boardcfg, sizeof (opl_board_cfg_t),
- tmptr + (bd * sizeof (opl_board_cfg_t))) == -1) {
+ tmptr + (bd * sizeof (opl_board_cfg_t))) == -1) {
mdb_warn("failed to read opl_board_cfg at %p",
- (tmptr + (bd * sizeof (opl_board_cfg_t))));
- return;
+ (tmptr + (bd * sizeof (opl_board_cfg_t))));
+ return;
}
if (boardcfg.cfg_hwd == NULL) {
@@ -335,9 +334,9 @@ dumpahwd(int bd, int v)
/* We always need the header, for offsets */
if (mdb_vread(&hwd_hdr, sizeof (hwd_header_t),
- (uintptr_t)boardcfg.cfg_hwd) == -1) {
+ (uintptr_t)boardcfg.cfg_hwd) == -1) {
mdb_warn("failed to read hwd_header_t at %p\n",
- boardcfg.cfg_hwd);
+ boardcfg.cfg_hwd);
return;
}
@@ -370,7 +369,7 @@ dumpahwd(int bd, int v)
if (mdb_vread(&hwd_sb_status, sizeof (hwd_sb_status_t),
(uintptr_t)statusp) == -1) {
mdb_warn("failed to read hwd_sb_status_t at %p\n",
- statusp);
+ statusp);
return;
}
mdb_printf("\nSTATUS:\tBoard\tStatus\n");
@@ -388,7 +387,7 @@ dumpahwd(int bd, int v)
if (mdb_vread(&hwd_dinfo, sizeof (hwd_domain_info_t),
(uintptr_t)dinfop) == -1) {
mdb_warn("failed to read hwd_domain_info_t at %p\n",
- dinfop);
+ dinfop);
return;
}
mdb_printf("\nDomain info:\tReset reason\t0x%x",
@@ -445,7 +444,7 @@ dumpahwd(int bd, int v)
cmup = &hwd_sb.sb_cmu.cmu_ch;
mdb_printf("\nCMU CH: status\t0x%x (%s)\tportid=0x%x"
- " LSB = 0x%x\n",
+ " LSB = 0x%x\n",
cmup->chan_status, hwd_stat_decode(cmup->chan_status),
cmup->chan_portid, ((cmup->chan_portid) >> 4));
@@ -504,16 +503,16 @@ dumpahwd(int bd, int v)
scp = &hwd_sb.sb_cmu.cmu_scs[sc];
- if (DONT_BOTHER(scp->sc_status, mv))
- mdb_printf("\nSC %d:\tstatus\t0x%x (%s)\n",
- sc, scp->sc_status,
- hwd_stat_decode(scp->sc_status));
- else {
- mdb_printf("\nSC %d:\tstatus\t0x%x (%s)\t",
- sc, scp->sc_status,
- hwd_stat_decode(scp->sc_status));
- mdb_printf("register addr\t0x%llx\n",
- scp->sc_register_address);
+ if (DONT_BOTHER(scp->sc_status, mv)) {
+ mdb_printf("\nSC %d:\tstatus\t0x%x (%s)\n",
+ sc, scp->sc_status,
+ hwd_stat_decode(scp->sc_status));
+ } else {
+ mdb_printf("\nSC %d:\tstatus\t0x%x (%s)\t",
+ sc, scp->sc_status,
+ hwd_stat_decode(scp->sc_status));
+ mdb_printf("register addr\t0x%llx\n",
+ scp->sc_register_address);
}
}
@@ -607,7 +606,7 @@ oplhwd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (bdi < 0) {
/* get active boards */
for (bdi = 0; bdi < OPL_MAX_BOARDS; bdi++)
- dumpahwd(bdi, v_mode);
+ dumpahwd(bdi, v_mode);
} else {
dumpahwd(bdi, v_mode);
}
@@ -621,22 +620,22 @@ static void
oplhwd_help(void)
{
mdb_printf("oplhwd will dump HWD only for a particular board"
- " on which,");
+ " on which,");
mdb_printf("an earlier DR operation has been executed.\n");
mdb_printf("-b NUM \tlist oplhwd entry for a board\n"
- "-s \t\tlist oplhwd entry with SB status\n"
- "-d \t\tlist oplhwd entry with Domain info.\n"
- "-i \t\tlist oplhwd entry with SB info.\n"
- "-h \t\tlist oplhwd entry with Chips details\n"
- "-o \t\tlist oplhwd entry with Core details\n"
- "-m \t\tlist oplhwd entry with Memory info.\n"
- "-k \t\tlist oplhwd entry with Memory Bank info.\n"
- "-r \t\tlist oplhwd entry with SC info.\n"
- "-c \t\tlist oplhwd entry with CMU channels\n"
- "-p \t\tlist oplhwd entry with PCI channels\n"
- "-a \t\tlist oplhwd entry with all possible info.\n"
- "-C \t\tlist oplhwd entry with component names\n"
- "-v \t\tlist oplhwd entry in verbose mode\n");
+ "-s \t\tlist oplhwd entry with SB status\n"
+ "-d \t\tlist oplhwd entry with Domain info.\n"
+ "-i \t\tlist oplhwd entry with SB info.\n"
+ "-h \t\tlist oplhwd entry with Chips details\n"
+ "-o \t\tlist oplhwd entry with Core details\n"
+ "-m \t\tlist oplhwd entry with Memory info.\n"
+ "-k \t\tlist oplhwd entry with Memory Bank info.\n"
+ "-r \t\tlist oplhwd entry with SC info.\n"
+ "-c \t\tlist oplhwd entry with CMU channels\n"
+ "-p \t\tlist oplhwd entry with PCI channels\n"
+ "-a \t\tlist oplhwd entry with all possible info.\n"
+ "-C \t\tlist oplhwd entry with component names\n"
+ "-v \t\tlist oplhwd entry in verbose mode\n");
}
/*
diff --git a/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c b/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c
index 20b59d7e56..ce4a1035f1 100644
--- a/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c
+++ b/usr/src/cmd/mdb/sun4u/modules/unix/sfmmu.c
@@ -131,7 +131,7 @@ sfmmu_vtop(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (ret == 0) {
mdb_printf("address space %p: virtual %lr mapped to physical "
- "%llr", asp, addr, paddr);
+ "%llr", asp, addr, paddr);
} else {
return (DCMD_ERR);
}
@@ -174,7 +174,7 @@ sfmmu_vtop_common(struct as *asp, uintptr_t addr, physaddr_t *pap)
static int
sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup,
- physaddr_t *pap)
+ physaddr_t *pap)
{
struct hmehash_bucket *uhme_hash;
struct hmehash_bucket *khme_hash;
@@ -225,7 +225,7 @@ sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup,
}
ism_blkp = &mism_blk;
ism_map = ism_blkp->iblk_maps;
- for (i = 0; ism_map[i].imap_ismhat && i < ISM_MAP_SLOTS; i++) {
+ for (i = 0; i < ISM_MAP_SLOTS && ism_map[i].imap_ismhat; i++) {
if ((caddr_t)addr >= ism_start(ism_map[i]) &&
(caddr_t)addr < ism_end(ism_map[i])) {
sfmmup = ism_hatid = ism_map[i].imap_ismhat;
@@ -252,18 +252,18 @@ sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup,
#ifdef __sparcv9
SFMMU_VTOP_DBG_DBG("hblktag=%lx %lx\n",
- (uint64_t)hblktag.htag_tag[0],
- (uint64_t)hblktag.htag_tag[1]);
+ (uint64_t)hblktag.htag_tag[0],
+ (uint64_t)hblktag.htag_tag[1]);
#else
SFMMU_VTOP_DBG_DBG("hblktag=%llx\n",
- (uint64_t)hblktag.htag_tag);
+ (uint64_t)hblktag.htag_tag);
#endif
hmebp = shmebp = HME_HASH_FUNCTION(sfmmup, addr, hmeshift);
SFMMU_VTOP_DBG_DBG("hmebp=%p\n", hmebp);
if (mdb_vread(&mbucket, sizeof (mbucket),
- (uintptr_t)hmebp) == -1) {
+ (uintptr_t)hmebp) == -1) {
mdb_warn("couldn't read mbucket at %p\n", hmebp);
return (DCMD_ERR);
}
@@ -271,7 +271,7 @@ sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup,
hmebp = &mbucket;
for (hmeblkp = hmebp->hmeblkp; hmeblkp;
- hmeblkp = hmeblkp->hblk_next) {
+ hmeblkp = hmeblkp->hblk_next) {
SFMMU_VTOP_DBG_DBG("hmeblkp=%p\n", hmeblkp);
@@ -279,9 +279,9 @@ sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup,
break;
if (mdb_vread(&mhmeblkmax, sizeof (struct hme_blk),
- (uintptr_t)hmeblkp) == -1) {
+ (uintptr_t)hmeblkp) == -1) {
mdb_warn("couldn't read hme_blk at %p\n",
- hmeblkp);
+ hmeblkp);
return (DCMD_ERR);
}
@@ -298,7 +298,7 @@ sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup,
sfmmu_vtop_print_hmeblk(hmeblkp);
sfhmep = mdb_sfmmu_hblktohme(hmeblkp, (caddr_t)addr,
- &sfhmeinx);
+ &sfhmeinx);
SFMMU_VTOP_DBG_DBG("sfhmeinx=%d ", sfhmeinx);
@@ -307,28 +307,26 @@ sfmmu_vtop_impl(uintptr_t addr, sfmmu_t *sfmmup, sfmmu_t *msfmmup,
sizeof (struct sf_hment) * (sfhmeinx - 1);
if (mdb_vread(sfhmep, sizeof (struct sf_hment),
- thmeblkp) == -1) {
+ thmeblkp) == -1) {
mdb_warn("couldn't read msfhme at %p\n",
- sfhmep);
+ sfhmep);
return (DCMD_ERR);
}
}
SFMMU_VTOP_DBG_VRB("sfmmup=%p hmebp=%p hmeblkp=%p\n",
- sfmmup, shmebp, thmeblkp);
+ sfmmup, shmebp, thmeblkp);
tte = sfhmep->hme_tte;
SFMMU_VTOP_DBG_VRB("tte=%llx ", tte.ll);
if (TTE_IS_VALID(&tte)) {
start_pfn = TTE_TO_TTEPFN(&tte);
*pap = (start_pfn << MMU_PAGESHIFT) +
- (addr & TTE_PAGE_OFFSET(tte.tte_size));
+ (addr & TTE_PAGE_OFFSET(tte.tte_size));
pfn = *pap >> MMU_PAGESHIFT;
pp = (sfhmep->hme_page != 0) ?
- sfhmep->hme_page + (pfn - start_pfn) :
- 0;
- SFMMU_VTOP_DBG_VRB("pfn=%lx pp=%p\n",
- pfn, pp);
+ sfhmep->hme_page + (pfn - start_pfn) : 0;
+ SFMMU_VTOP_DBG_VRB("pfn=%lx pp=%p\n", pfn, pp);
ret = 0;
}
break;
@@ -345,13 +343,13 @@ static void
sfmmu_vtop_print_hmeblk(struct hme_blk *hmeblkp)
{
- if ((sfmmu_vtop_dbg & SFMMU_VTOP_DBG_DEBUG) == NULL)
+ if ((sfmmu_vtop_dbg & SFMMU_VTOP_DBG_DEBUG) == 0)
return;
mdb_printf(" hblk_nextpa=%llx\n", hmeblkp->hblk_nextpa);
#ifdef __sparcv9
mdb_printf(" hblktag=%lx %lx\n", hmeblkp->hblk_tag.htag_tag[0],
- hmeblkp->hblk_tag.htag_tag[1]);
+ hmeblkp->hblk_tag.htag_tag[1]);
#else
mdb_printf(" hblktag=%llx\n", hmeblkp->hblk_tag.htag_tag);
#endif
@@ -403,7 +401,7 @@ memseg_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (DCMD_HDRSPEC(flags))
mdb_printf("%<u>%?s %?s %?s %?s %?s%</u>\n", "ADDR",
- "PAGES", "EPAGES", "BASE", "END");
+ "PAGES", "EPAGES", "BASE", "END");
if (mdb_vread(&ms, sizeof (struct memseg), addr) == -1) {
mdb_warn("can't read memseg at %#lx", addr);
@@ -411,7 +409,7 @@ memseg_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
mdb_printf("%0?lx %0?lx %0?lx %0?lx %0?lx\n", addr,
- ms.pages, ms.epages, ms.pages_base, ms.pages_end);
+ ms.pages, ms.epages, ms.pages_base, ms.pages_end);
return (DCMD_OK);
}
@@ -422,7 +420,7 @@ memseg_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
int
memseg_walk_init(mdb_walk_state_t *wsp)
{
- if (wsp->walk_addr != NULL) {
+ if (wsp->walk_addr != (uintptr_t)NULL) {
mdb_warn("memseg only supports global walks\n");
return (WALK_ERR);
}
@@ -535,9 +533,9 @@ tsbinfo_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
if (mdb_getopts(argc, argv,
- 'l', MDB_OPT_SETBITS, TRUE, &lflag,
- 'a', MDB_OPT_SETBITS, TRUE, &aflag,
- NULL) != argc) {
+ 'l', MDB_OPT_SETBITS, TRUE, &lflag,
+ 'a', MDB_OPT_SETBITS, TRUE, &aflag,
+ NULL) != argc) {
return (DCMD_USAGE);
}
@@ -600,24 +598,24 @@ tsbinfo_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
UM_SLEEP);
if (mdb_vread(tsbp, sizeof (struct tsbe) * entries,
- (uintptr_t)tsbinfo.tsb_va) == -1) {
+ (uintptr_t)tsbinfo.tsb_va) == -1) {
mdb_warn("failed to read TSB at %p",
tsbinfo.tsb_va);
return (DCMD_ERR);
}
mdb_printf(
- "TSB @ %lx (%d entries)\n"
- "%-?s %-17s %s\n"
- "%<u>%-?s %1s %1s %-11s "
- "%1s %1s %1s %1s %1s %1s %8s "
- "%1s %1s %1s %1s %1s %1s %1s "
- "%1s %1s %1s %1s %1s %1s%</u>\n",
- tsbinfo.tsb_va, entries, "", "TAG", "TTE",
- "ADDR", "I", "L", "VA 63:22",
- "V", "S", "N", "I", "H", "S", "PA 42:13",
- "N", "U", "R", "W", "E", "X", "L",
- "P", "V", "E", "P", "W", "G");
+ "TSB @ %lx (%d entries)\n"
+ "%-?s %-17s %s\n"
+ "%<u>%-?s %1s %1s %-11s "
+ "%1s %1s %1s %1s %1s %1s %8s "
+ "%1s %1s %1s %1s %1s %1s %1s "
+ "%1s %1s %1s %1s %1s %1s%</u>\n",
+ tsbinfo.tsb_va, entries, "", "TAG", "TTE",
+ "ADDR", "I", "L", "VA 63:22",
+ "V", "S", "N", "I", "H", "S", "PA 42:13",
+ "N", "U", "R", "W", "E", "X", "L",
+ "P", "V", "E", "P", "W", "G");
tsbend = tsbp + entries;
for (tsbstart = tsbp; tsbp < tsbend; tsbp++) {
@@ -626,8 +624,8 @@ tsbinfo_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
va = (caddr_t)
(((uint64_t)tsbp->tte_tag.tag_vahi
- << 32) +
- tsbp->tte_tag.tag_valo);
+ << 32) +
+ tsbp->tte_tag.tag_valo);
pa = (tsbp->tte_data.tte_pahi << 19) +
tsbp->tte_data.tte_palo;
mdb_printf("%0?lx %-1u %-1u %011lx "
diff --git a/usr/src/cmd/mdb/sun4u/modules/unix/unix.c b/usr/src/cmd/mdb/sun4u/modules/unix/unix.c
index 09303f5345..e43449f9db 100644
--- a/usr/src/cmd/mdb/sun4u/modules/unix/unix.c
+++ b/usr/src/cmd/mdb/sun4u/modules/unix/unix.c
@@ -676,7 +676,7 @@ ttrace_walk_init(mdb_walk_state_t *wsp)
ttrace_cpu_data_t *tc;
struct trap_trace_record *buf;
- if (wsp->walk_addr != NULL) {
+ if (wsp->walk_addr != (uintptr_t)NULL) {
mdb_warn("ttrace only supports global walks\n");
return (WALK_ERR);
}
@@ -965,7 +965,7 @@ httrace_walk_init(mdb_walk_state_t *wsp)
struct htrap_trace_record *buf;
htrap_trace_hdr_t *hdr;
- if (wsp->walk_addr != NULL) {
+ if (wsp->walk_addr != (uintptr_t)NULL) {
mdb_warn("httrace only supports global walks\n");
return (WALK_ERR);
}
@@ -1347,7 +1347,7 @@ vecint_walk_init(mdb_walk_state_t *wsp)
{
vecint_walk_data_t *vecint;
- if (wsp->walk_addr != NULL) {
+ if (wsp->walk_addr != (uintptr_t)NULL) {
mdb_warn("vecint walk only supports global walks\n");
return (WALK_ERR);
}
@@ -1378,13 +1378,14 @@ vecint_walk_step(mdb_walk_state_t *wsp)
intr_vec_t iv;
int status;
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == (uintptr_t)NULL) {
while ((vecint->vec_idx < max) && ((wsp->walk_addr =
- (uintptr_t)vecint->vec_table[vecint->vec_idx++]) == NULL))
+ (uintptr_t)vecint->vec_table[vecint->vec_idx++]) ==
+ (uintptr_t)NULL))
continue;
}
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == (uintptr_t)NULL)
return (WALK_DONE);
status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
@@ -1443,7 +1444,7 @@ softint_walk_init(mdb_walk_state_t *wsp)
{
intr_vec_t *list;
- if (wsp->walk_addr != NULL) {
+ if (wsp->walk_addr != (uintptr_t)NULL) {
mdb_warn("softint walk only supports global walks\n");
return (WALK_ERR);
}
@@ -1471,7 +1472,7 @@ softint_walk_step(mdb_walk_state_t *wsp)
intr_vec_t iv;
int status;
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == (uintptr_t)NULL)
return (WALK_DONE);
status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
@@ -1568,7 +1569,7 @@ mutex_owner_step(mdb_walk_state_t *wsp)
if (!MUTEX_TYPE_ADAPTIVE(&mtx))
return (WALK_DONE);
- if ((owner = (uintptr_t)MUTEX_OWNER(&mtx)) == NULL)
+ if ((owner = (uintptr_t)MUTEX_OWNER(&mtx)) == (uintptr_t)NULL)
return (WALK_DONE);
if (mdb_vread(&thr, sizeof (thr), owner) != -1)
diff --git a/usr/src/cmd/mdb/sun4v/modules/errh/errh.c b/usr/src/cmd/mdb/sun4v/modules/errh/errh.c
index 6525746f3b..3554e1d559 100644
--- a/usr/src/cmd/mdb/sun4v/modules/errh/errh.c
+++ b/usr/src/cmd/mdb/sun4v/modules/errh/errh.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/time.h>
#include <sys/sysmacros.h>
@@ -208,14 +206,13 @@ errh_prtaddr(uintptr_t addr, const void *data, void *private)
return (WALK_NEXT);
}
-/*ARGSUSED*/
int
rq_walk_init(mdb_walk_state_t *wsp)
{
cpu_t cpu;
uintptr_t *ao, *lower, *upper;
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == (uintptr_t)NULL) {
mdb_warn("address of struct cpu_t is required\n");
return (WALK_ERR);
}
@@ -245,14 +242,13 @@ rq_walk_init(mdb_walk_state_t *wsp)
return (WALK_NEXT);
}
-/*ARGSUSED*/
int
nrq_walk_init(mdb_walk_state_t *wsp)
{
cpu_t cpu;
uintptr_t *ao, *lower, *upper;
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == (uintptr_t)NULL) {
mdb_warn("address of struct cpu_t is required\n");
return (WALK_ERR);
}
@@ -282,14 +278,13 @@ nrq_walk_init(mdb_walk_state_t *wsp)
return (WALK_NEXT);
}
-/*ARGSUSED*/
int
errh_walk_step(mdb_walk_state_t *wsp)
{
int status;
uintptr_t *ao, *lower, *upper;
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == (uintptr_t)NULL)
return (WALK_DONE);
status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
diff --git a/usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c b/usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c
index 8cd92bc435..766f799e6e 100644
--- a/usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c
+++ b/usr/src/cmd/mdb/sun4v/modules/ldc/ldc.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This module provides debugging tools for the LDoms channels (ldc)
*/
@@ -233,13 +231,13 @@ ldc_walk_init(mdb_walk_state_t *wsp)
ldc_soft_state_t softstate;
/* Must have a start addr. */
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == (uintptr_t)NULL) {
if (mdb_readvar(&wsp->walk_addr, "ldcssp") == -1) {
mdb_warn("failed to read 'ldcssp'");
return (WALK_ERR);
}
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == (uintptr_t)NULL)
return (WALK_DONE);
if (mdb_vread(&softstate, sizeof (softstate), wsp->walk_addr)
@@ -263,7 +261,7 @@ ldc_walk_step(mdb_walk_state_t *wsp)
int status;
ldc_chan_t ldcp;
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == (uintptr_t)NULL)
return (WALK_DONE);
if (mdb_vread(&ldcp, sizeof (ldc_chan_t), wsp->walk_addr) == -1) {
@@ -289,7 +287,7 @@ int
ldcmsg(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
ldc_msg_t msg;
- uint64_t count = 1;
+ uint64_t count = 1;
int i;
/*
@@ -476,7 +474,7 @@ ldcmhdl(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_printf("\n");
}
- if ((addr = (uintptr_t)mhdl.next) == NULL)
+ if ((addr = (uintptr_t)mhdl.next) == (uintptr_t)NULL)
break;
}
diff --git a/usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c b/usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c
index d0184bc7c8..b2c791690e 100644
--- a/usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c
+++ b/usr/src/cmd/mdb/sun4v/modules/mdesc/mdesc.c
@@ -68,7 +68,7 @@ mdhdr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
else
mdb_printf("%p\n", mdp);
- } while ((mdp = (uintptr_t)md.next) != NULL);
+ } while ((mdp = (uintptr_t)md.next) != (uintptr_t)NULL);
return (DCMD_OK);
}
diff --git a/usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c b/usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c
index b43c3f9d95..c404a3fb98 100644
--- a/usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c
+++ b/usr/src/cmd/mdb/sun4v/modules/vdsk/vdsk.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This module provides debugging tools for the LDoms vDisk drivers
* (vds and vdc).
@@ -41,7 +39,7 @@ int
vd_dring_entry_walk_init(mdb_walk_state_t *wsp)
{
/* Must have a start addr. */
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == (uintptr_t)NULL) {
mdb_warn("Descriptor Ring base address required\n");
return (WALK_ERR);
diff --git a/usr/src/head/string.h b/usr/src/head/string.h
index 2194b70bd8..f75c14c59c 100644
--- a/usr/src/head/string.h
+++ b/usr/src/head/string.h
@@ -22,6 +22,7 @@
/*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2020 Joyent, Inc.
*/
/* Copyright (c) 1988 AT&T */
@@ -139,13 +140,8 @@ extern char *strdup(const char *);
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
-#if defined(__GNUC__)
-/*
- * gcc provides this inlining facility but Studio C does not.
- * We should use it exclusively once Studio C also provides it.
- */
-extern void *__builtin_alloca(size_t);
+#if defined(__GNUC__)
#define strdupa(s) \
(__extension__( \
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile
index c928fc8118..9fd28c40f6 100644
--- a/usr/src/lib/Makefile
+++ b/usr/src/lib/Makefile
@@ -239,6 +239,7 @@ SUBDIRS += \
libtsnet \
libtsol \
libumem \
+ libutempter \
libuuid \
libuutil \
libvnd \
@@ -493,6 +494,7 @@ HDRSUBDIRS= \
libtsnet \
libtsol \
libumem \
+ libutempter \
libuutil \
libvnd \
libvolmgt \
diff --git a/usr/src/lib/libutempter/Makefile b/usr/src/lib/libutempter/Makefile
new file mode 100644
index 0000000000..50a91bef6b
--- /dev/null
+++ b/usr/src/lib/libutempter/Makefile
@@ -0,0 +1,37 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+include $(SRC)/lib/Makefile.lib
+
+SUBDIRS= $(MACH) $(BUILD64) $(MACH64)
+
+all:= TARGET= all
+clean:= TARGET= clean
+clobber:= TARGET= clobber
+install:= TARGET= install
+
+HDRDIR= common
+HDRS= utempter.h
+
+.KEEP_STATE:
+
+all clean clobber install: $(SUBDIRS)
+
+check: $(CHECKHDRS)
+
+install_h: $(ROOTHDRS)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include $(SRC)/lib/Makefile.targ
diff --git a/usr/src/lib/libutempter/Makefile.com b/usr/src/lib/libutempter/Makefile.com
new file mode 100644
index 0000000000..6e0332e4e0
--- /dev/null
+++ b/usr/src/lib/libutempter/Makefile.com
@@ -0,0 +1,30 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+LIBRARY= libutempter.a
+VERS= .1
+
+OBJECTS= utempter.o
+
+include $(SRC)/lib/Makefile.lib
+
+SRCDIR= ../common
+
+LDLIBS += -lc
+LIBS= $(DYNLIB)
+
+CSTD= $(CSTD_GNU99)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+include $(SRC)/lib/Makefile.targ
diff --git a/usr/src/lib/libutempter/THIRDPARTYLICENSE b/usr/src/lib/libutempter/THIRDPARTYLICENSE
new file mode 100644
index 0000000000..aa2de14939
--- /dev/null
+++ b/usr/src/lib/libutempter/THIRDPARTYLICENSE
@@ -0,0 +1,23 @@
+Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
diff --git a/usr/src/lib/libutempter/THIRDPARTYLICENSE.descrip b/usr/src/lib/libutempter/THIRDPARTYLICENSE.descrip
new file mode 100644
index 0000000000..a5add467b7
--- /dev/null
+++ b/usr/src/lib/libutempter/THIRDPARTYLICENSE.descrip
@@ -0,0 +1 @@
+UTEMPTER LIBRARY
diff --git a/usr/src/lib/libutempter/amd64/Makefile b/usr/src/lib/libutempter/amd64/Makefile
new file mode 100644
index 0000000000..c876c91740
--- /dev/null
+++ b/usr/src/lib/libutempter/amd64/Makefile
@@ -0,0 +1,15 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libutempter/common/mapfile-vers b/usr/src/lib/libutempter/common/mapfile-vers
new file mode 100644
index 0000000000..c2c0249afd
--- /dev/null
+++ b/usr/src/lib/libutempter/common/mapfile-vers
@@ -0,0 +1,38 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+SYMBOL_VERSION ILLUMOS_0.1 {
+ global:
+ addToUtmp;
+ removeFromUtmp;
+ removeLineFromUtmp;
+ utempter_add_record;
+ utempter_remove_added_record;
+ utempter_remove_record;
+ local:
+ *;
+};
diff --git a/usr/src/lib/libutempter/common/utempter.c b/usr/src/lib/libutempter/common/utempter.c
new file mode 100644
index 0000000000..63e6b24ba1
--- /dev/null
+++ b/usr/src/lib/libutempter/common/utempter.c
@@ -0,0 +1,132 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/types.h>
+
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmpx.h>
+
+static int last_fd = -1;
+
+static void
+utempter_update_utmpx(int type, int fd, const char *host)
+{
+ struct utmpx ut;
+ struct passwd *pw;
+ uid_t uid;
+
+ (void) memset(&ut, 0, sizeof (ut));
+ ut.ut_type = type;
+ ut.ut_pid = getpid();
+ ut.ut_session = getsid(0);
+ (void) gettimeofday(&ut.ut_tv, NULL);
+ if (snprintf(ut.ut_id, sizeof (ut.ut_id), "f%d", fd) >=
+ sizeof (ut.ut_id))
+ return;
+ uid = getuid();
+ if ((pw = getpwuid(uid)) == NULL)
+ return;
+ (void) strlcpy(ut.ut_user, pw->pw_name, sizeof (ut.ut_user));
+
+ if (type == DEAD_PROCESS) {
+ struct utmpx *ut1;
+ struct utmpx ut2;
+
+ (void) memset(&ut2, 0, sizeof (ut2));
+ ut2.ut_type = USER_PROCESS;
+ if (snprintf(ut2.ut_id, sizeof (ut2.ut_id), "f%d", fd) >=
+ sizeof (ut2.ut_id))
+ return;
+ if ((ut1 = getutxid(&ut2)) == NULL)
+ return;
+ (void) strlcpy(ut.ut_line, ut1->ut_line, sizeof (ut.ut_line));
+ } else {
+ char *line = ptsname(fd);
+ if (line == NULL)
+ return;
+ (void) strlcpy(ut.ut_line, line + strlen("/dev/"),
+ sizeof (ut.ut_line));
+ }
+
+ if (host != NULL) {
+ (void) strlcpy(ut.ut_host, host, sizeof (ut.ut_host));
+ ut.ut_syslen = strlen(ut.ut_host) + 1;
+ }
+
+ setutxent();
+ (void) pututxline(&ut);
+ endutxent();
+}
+
+int
+utempter_add_record(int fd, const char *host)
+{
+ utempter_update_utmpx(USER_PROCESS, fd, host);
+ last_fd = fd;
+ return (0);
+}
+
+int
+utempter_remove_record(int fd)
+{
+ utempter_update_utmpx(DEAD_PROCESS, fd, NULL);
+ if (last_fd == fd)
+ last_fd = -1;
+ return (0);
+}
+
+int
+utempter_remove_added_record(void)
+{
+ if (last_fd < 0)
+ return (0);
+ utempter_update_utmpx(DEAD_PROCESS, last_fd, NULL);
+ last_fd = -1;
+ return (0);
+}
+
+void
+addToUtmp(const char *pty __unused, const char *host, int fd)
+{
+ (void) utempter_add_record(fd, host);
+}
+
+void
+removeFromUtmp(void)
+{
+ (void) utempter_remove_added_record();
+}
+
+void
+removeLineFromUtmp(const char *pty __unused, int fd)
+{
+ (void) utempter_remove_record(fd);
+}
diff --git a/usr/src/lib/libutempter/common/utempter.h b/usr/src/lib/libutempter/common/utempter.h
new file mode 100644
index 0000000000..fab58d9422
--- /dev/null
+++ b/usr/src/lib/libutempter/common/utempter.h
@@ -0,0 +1,47 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#ifndef _UTEMPTER_H
+#define _UTEMPTER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int utempter_add_record(int, const char *);
+int utempter_remove_added_record(void);
+int utempter_remove_record(int);
+void addToUtmp(const char *, const char *, int);
+void removeFromUtmp(void);
+void removeLineFromUtmp(const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_UTEMPTER_H */
diff --git a/usr/src/lib/libutempter/i386/Makefile b/usr/src/lib/libutempter/i386/Makefile
new file mode 100644
index 0000000000..f4a0a208fd
--- /dev/null
+++ b/usr/src/lib/libutempter/i386/Makefile
@@ -0,0 +1,14 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS)
diff --git a/usr/src/lib/libutempter/sparc/Makefile b/usr/src/lib/libutempter/sparc/Makefile
new file mode 100644
index 0000000000..f4a0a208fd
--- /dev/null
+++ b/usr/src/lib/libutempter/sparc/Makefile
@@ -0,0 +1,14 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS)
diff --git a/usr/src/lib/libutempter/sparcv9/Makefile b/usr/src/lib/libutempter/sparcv9/Makefile
new file mode 100644
index 0000000000..c876c91740
--- /dev/null
+++ b/usr/src/lib/libutempter/sparcv9/Makefile
@@ -0,0 +1,15 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/man/Makefile b/usr/src/man/Makefile
index a948d1256c..d2a1fbe134 100644
--- a/usr/src/man/Makefile
+++ b/usr/src/man/Makefile
@@ -83,6 +83,7 @@ SUBDIRS= man1 \
man3tecla \
man3tnf \
man3tsol \
+ man3utempter \
man3uuid \
man3volmgt \
man3vnd \
diff --git a/usr/src/man/man3utempter/Makefile b/usr/src/man/man3utempter/Makefile
new file mode 100644
index 0000000000..a61f7696e6
--- /dev/null
+++ b/usr/src/man/man3utempter/Makefile
@@ -0,0 +1,35 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet
+# at http://www.illumos.org/license/CDDL.
+#
+
+include $(SRC)/Makefile.master
+
+MANSECT= 3utempter
+
+MANFILES= utempter_add_record.3utempter
+
+MANLINKS= addToUtmp.3utempter \
+ removeFromUtmp.3utempter \
+ removeLineFromUtmp.3utempter \
+ utempter_remove_added_record.3utempter \
+ utempter_remove_record.3utempter
+
+
+addToUtmp.3utempter := LINKSRC = utempter_add_record.3utempter
+removeFromUtmp.3utempter := LINKSRC = utempter_add_record.3utempter
+removeLineFromUtmp.3utempter := LINKSRC = utempter_add_record.3utempter
+utempter_remove_added_record.3utempter := LINKSRC = utempter_add_record.3utempter
+utempter_remove_record.3utempter := LINKSRC = utempter_add_record.3utempter
+
+.KEEP_STATE:
+
+include $(SRC)/man/Makefile.man
+
+install: $(ROOTMANFILES) $(ROOTMANLINKS)
diff --git a/usr/src/man/man3utempter/utempter_add_record.3utempter b/usr/src/man/man3utempter/utempter_add_record.3utempter
new file mode 100644
index 0000000000..da6cbb7211
--- /dev/null
+++ b/usr/src/man/man3utempter/utempter_add_record.3utempter
@@ -0,0 +1,134 @@
+.\" Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+.\"
+.\"
+.Dd May 5, 2020
+.Dt UTEMPTER_ADD_RECORD 3UTEMPTER
+.Os
+.Sh NAME
+.Nm utempter_add_record ,
+.Nm utempter_remove_added_record ,
+.Nm utempter_remove_record ,
+.Nm addToUtmp ,
+.Nm removeFromUtmp ,
+.Nm removeLineFromUtmp
+.Nd utempter compatibility interface
+.Sh LIBRARY
+.Lb libutempter
+.Sh SYNOPSIS
+.In utempter.h
+.Ft int
+.Fn utempter_add_record "int fd" "const char *host"
+.Ft int
+.Fn utempter_remove_added_record "void"
+.Ft int
+.Fn utempter_remove_record "int fd"
+.Ft void
+.Fn addToUtmp "const char *pty" "const char *host" "int fd"
+.Ft void
+.Fn removeFromUtmp "void"
+.Ft void
+.Fn removeLineFromUtmp "const char *pty" "int fd"
+.Sh DESCRIPTION
+These functions provide an interface for terminal emulators such as tmux,
+screen, and xterm to record user sessions to
+.Xr utmpx 4
+database.
+Note that they are best effort and may not succeed.
+If consumers need to know for certain that they have successfully updated the
+.Xr utmpx 4
+database, these functions should not be used because they cannot communicate
+that for compatibility reasons.
+.Pp
+The
+.Fn utempter_add_record
+and
+.Fn addToUtmp
+functions add a login record to the
+.Xr utmpx 4
+database for the TTY belonging to the pseudo-terminal master file descriptor
+.Fa fd ,
+using the username corresponding with the real user ID of the calling
+process and the optional hostname
+.Fa host ,
+limited to 256 characters, that is the size of
+.Va ut_host
+member of
+.Vt struct utmpx
+minus terminating NUL character.
+.Pp
+The
+.Fn utempter_remove_record
+and
+.Fn removeLineFromUtmp
+functions mark the login session as being closed for the TTY belonging
+to the pseudo-terminal master file descriptor
+.Fa fd .
+.Pp
+The
+.Fn utempter_remove_added_record
+and
+.Fn removeFromUtmp
+functions have the same properties as the previously mentioned
+functions, except that they use an internally cached value of the file
+descriptor passed to
+.Fn utempter_add_record
+and
+.Fn addToUtmp .
+.Pp
+In this implementation, the
+.Fa pty
+arguments of
+.Fn addToUtmp
+and
+.Fn removeLineFromUtmp
+are ignored, and database entries are driven entirely by the
+.Fa fd
+argument.
+.Sh RETURN VALUES
+The
+.Fn utempter_add_record ,
+.Fn utempter_remove_added_record
+and
+.Fn utempter_remove_record
+functions always return a value of 0.
+.Sh INTERFACE STABILITY
+.Fn utempter_add_record ,
+.Fn utempter_remove_added_record ,
+and
+.Fn utempter_remove_record
+are
+.Sy Committed .
+.Fn addToUtmp ,
+.Fn removeFromUtmp ,
+and
+.Fn removeLineFromUtmp
+are
+.Sy Obsolete Committed .
+.Sh MT-LEVEL
+.Sy Unsafe
+.Sh SEE ALSO
+.Xr pututxline 3c ,
+.Xr utmpx 3head ,
+.Xr utmpx 4
diff --git a/usr/src/pkg/manifests/system-header.mf b/usr/src/pkg/manifests/system-header.mf
index 5b1da26c58..c95634b16c 100644
--- a/usr/src/pkg/manifests/system-header.mf
+++ b/usr/src/pkg/manifests/system-header.mf
@@ -1027,6 +1027,7 @@ file path=usr/include/sys/fs/pc_label.h
file path=usr/include/sys/fs/pc_node.h
file path=usr/include/sys/fs/pxfs_ki.h
file path=usr/include/sys/fs/sdev_impl.h
+file path=usr/include/sys/fs/sdev_plugin.h
file path=usr/include/sys/fs/snode.h
file path=usr/include/sys/fs/swapnode.h
file path=usr/include/sys/fs/tmp.h
diff --git a/usr/src/pkg/manifests/system-library-libutempter.mf b/usr/src/pkg/manifests/system-library-libutempter.mf
new file mode 100644
index 0000000000..e883545383
--- /dev/null
+++ b/usr/src/pkg/manifests/system-library-libutempter.mf
@@ -0,0 +1,44 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+set name=pkg.fmri value=pkg:/system/library/libutempter@$(PKGVERS)
+set name=pkg.description \
+ value="Interface to record user sessions in utmpx database"
+set name=pkg.summary \
+ value="Interface to record user sessions in utmpx database"
+set name=info.classification \
+ value=org.opensolaris.category.2008:System/Library
+set name=variant.arch value=$(ARCH)
+dir path=usr group=sys
+dir path=usr/include
+dir path=usr/lib
+dir path=usr/lib/$(ARCH64)
+dir path=usr/share
+dir path=usr/share/man
+dir path=usr/share/man/man3utempter
+file path=usr/include/utempter.h
+file path=usr/lib/$(ARCH64)/libutempter.so.1
+file path=usr/lib/libutempter.so.1
+file path=usr/share/man/man3utempter/utempter_add_record.3utempter
+license usr/src/lib/libutempter/THIRDPARTYLICENSE \
+ license=usr/src/lib/libutempter/THIRDPARTYLICENSE
+link path=usr/lib/$(ARCH64)/libutempter.so target=libutempter.so.1
+link path=usr/lib/libutempter.so target=libutempter.so.1
+link path=usr/share/man/man3utempter/addToUtmp.3utempter \
+ target=utempter_add_record.3utempter
+link path=usr/share/man/man3utempter/removeFromUtmp.3utempter \
+ target=utempter_add_record.3utempter
+link path=usr/share/man/man3utempter/removeLineFromUtmp.3utempter \
+ target=utempter_add_record.3utempter
+link path=usr/share/man/man3utempter/utempter_remove_added_record.3utempter \
+ target=utempter_add_record.3utempter
+link path=usr/share/man/man3utempter/utempter_remove_record.3utempter \
+ target=utempter_add_record.3utempter
diff --git a/usr/src/uts/common/io/mac/mac_client.c b/usr/src/uts/common/io/mac/mac_client.c
index dcfb4803d6..79b83ff937 100644
--- a/usr/src/uts/common/io/mac/mac_client.c
+++ b/usr/src/uts/common/io/mac/mac_client.c
@@ -1660,6 +1660,32 @@ mac_rx_barrier(mac_client_handle_t mch)
}
void
+mac_rx_barrier(mac_client_handle_t mch)
+{
+ mac_client_impl_t *mcip = (mac_client_impl_t *)mch;
+ mac_impl_t *mip = mcip->mci_mip;
+
+ i_mac_perim_enter(mip);
+
+ /* If a RX callback is set, quiesce and restart that datapath */
+ if (mcip->mci_rx_fn != mac_pkt_drop) {
+ mac_rx_client_quiesce(mch);
+ mac_rx_client_restart(mch);
+ }
+
+ /* If any promisc callbacks are registered, perform a barrier there */
+ if (mcip->mci_promisc_list != NULL || mip->mi_promisc_list != NULL) {
+ mac_cb_info_t *mcbi = &mip->mi_promisc_cb_info;
+
+ mutex_enter(mcbi->mcbi_lockp);
+ mac_callback_barrier(mcbi);
+ mutex_exit(mcbi->mcbi_lockp);
+ }
+
+ i_mac_perim_exit(mip);
+}
+
+void
mac_secondary_dup(mac_client_handle_t smch, mac_client_handle_t dmch)
{
mac_client_impl_t *smcip = (mac_client_impl_t *)smch;
diff --git a/usr/src/uts/common/sys/fs/sdev_impl.h b/usr/src/uts/common/sys/fs/sdev_impl.h
index d1c5f674f1..676193fcfa 100644
--- a/usr/src/uts/common/sys/fs/sdev_impl.h
+++ b/usr/src/uts/common/sys/fs/sdev_impl.h
@@ -39,6 +39,7 @@ extern "C" {
#include <sys/nvpair.h>
#include <sys/fs/sdev_plugin.h>
#include <sys/sunddi.h>
+#include <sys/fs/sdev_plugin.h>
/*
* sdev_nodes are the file-system specific part of the
diff --git a/usr/src/uts/intel/dev/Makefile b/usr/src/uts/intel/dev/Makefile
index 6cc3fda6cd..cc100922a0 100644
--- a/usr/src/uts/intel/dev/Makefile
+++ b/usr/src/uts/intel/dev/Makefile
@@ -71,6 +71,7 @@ LINTTAGS += -erroff=E_STATIC_UNUSED
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += $(CNOWARN_UNINIT)
+CERRWARN += -_gcc=-Wno-unused-function
#
# Default build targets.
diff --git a/usr/src/uts/sun4u/io/rmcadm.c b/usr/src/uts/sun4u/io/rmcadm.c
index 2ad9a87c23..ed4da3a286 100644
--- a/usr/src/uts/sun4u/io/rmcadm.c
+++ b/usr/src/uts/sun4u/io/rmcadm.c
@@ -233,7 +233,7 @@ rmcadm_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
return (DDI_FAILURE);
err = ddi_create_minor_node(dip, "rmcadm", S_IFCHR,
- instance, DDI_PSEUDO, NULL);
+ instance, DDI_PSEUDO, 0);
if (err != DDI_SUCCESS)
return (DDI_FAILURE);
diff --git a/usr/src/uts/sun4u/rmcadm/Makefile b/usr/src/uts/sun4u/rmcadm/Makefile
index baa1fb4883..4ef75a6149 100644
--- a/usr/src/uts/sun4u/rmcadm/Makefile
+++ b/usr/src/uts/sun4u/rmcadm/Makefile
@@ -23,8 +23,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
-#
# This makefile drives the production of the rmcadm driver kernel
# module in the sun4u systems
#
@@ -39,7 +37,6 @@ UTSBASE = ../..
#
MODULE = rmcadm
OBJECTS = $(RMCADM_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(RMCADM_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/sun4u/io
@@ -52,13 +49,8 @@ include $(UTSBASE)/sun4u/Makefile.sun4u
# Define targets
#
ALL_TARGET = $(BINARY) $(SRC_CONFILE)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
-#
-# lint pass one enforcement
-#
-CFLAGS += $(CCVERBOSE)
LDFLAGS += -dy -Ndrv/rmc_comm -Ndrv/pmugpio
#
@@ -79,12 +71,6 @@ clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS)
#
diff --git a/usr/src/uts/sun4v/ds/Makefile b/usr/src/uts/sun4v/ds/Makefile
index ed43f2f58e..f119b7138f 100644
--- a/usr/src/uts/sun4v/ds/Makefile
+++ b/usr/src/uts/sun4v/ds/Makefile
@@ -40,7 +40,6 @@ UTSBASE = ../..
#
MODULE = ds
OBJECTS = $(DS_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(DS_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_PSM_MISC_DIR)/$(MODULE)
#
@@ -52,15 +51,9 @@ include $(UTSBASE)/sun4v/Makefile.sun4v
# Define targets
#
ALL_TARGET = $(BINARY)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
#
-# lint pass one enforcement
-#
-CFLAGS += $(CCVERBOSE)
-
-#
# Turn on doubleword alignment for 64 bit registers
#
CFLAGS += -dalign
@@ -70,13 +63,6 @@ CFLAGS += -dalign
#
LDFLAGS += -dy -Nmisc/ldc
-#
-# 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_BAD_PTR_CAST_ALIGN
-
CERRWARN += $(CNOWARN_UNINIT)
#
@@ -92,12 +78,6 @@ clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS)
#
diff --git a/usr/src/uts/sun4v/io/ds_common.c b/usr/src/uts/sun4v/io/ds_common.c
index 54876ac3bc..fad3014d2b 100644
--- a/usr/src/uts/sun4v/io/ds_common.c
+++ b/usr/src/uts/sun4v/io/ds_common.c
@@ -431,7 +431,7 @@ ds_ldc_fini(ds_port_t *port)
}
port->ldc.id = (uint64_t)-1;
- port->ldc.hdl = NULL;
+ port->ldc.hdl = 0;
port->ldc.state = 0;
return (rv);
@@ -2492,7 +2492,7 @@ ds_ucap_init(ds_capability_t *cap, ds_clnt_ops_t *ops, uint32_t flags,
ds_vers_check_t status;
ds_svc_t *svc;
int rv = 0;
- ds_svc_hdl_t lb_hdl, hdl;
+ ds_svc_hdl_t lb_hdl, hdl;
int is_loopback;
int is_client;
diff --git a/usr/src/uts/sun4v/io/ds_drv.c b/usr/src/uts/sun4v/io/ds_drv.c
index 2b2ba29e52..b812999005 100644
--- a/usr/src/uts/sun4v/io/ds_drv.c
+++ b/usr/src/uts/sun4v/io/ds_drv.c
@@ -493,8 +493,6 @@ static ds_log_entry_t ds_log_entry_pool[DS_LOG_NPOOL];
static void
ds_log_init(void)
{
- ds_log_entry_t *new;
-
/* initialize global lock */
mutex_init(&ds_log.lock, NULL, MUTEX_DRIVER, NULL);
@@ -506,9 +504,9 @@ ds_log_init(void)
ds_log.nentry = 0;
/* initialize the free list */
- for (new = ds_log_entry_pool; new < DS_LOG_POOL_END; new++) {
- new->next = ds_log.freelist;
- ds_log.freelist = new;
+ for (int i = 0; i < DS_LOG_NPOOL; i++) {
+ ds_log_entry_pool[i].next = ds_log.freelist;
+ ds_log.freelist = &ds_log_entry_pool[i];
}
mutex_exit(&ds_log.lock);
diff --git a/usr/src/uts/sun4v/io/vdc.c b/usr/src/uts/sun4v/io/vdc.c
index ccea7403ea..6f55fcc6e6 100644
--- a/usr/src/uts/sun4v/io/vdc.c
+++ b/usr/src/uts/sun4v/io/vdc.c
@@ -173,14 +173,14 @@ static int vdc_process_data_msg(vdc_t *vdc, vio_msg_t *msg);
static int vdc_handle_ver_msg(vdc_t *vdc, vio_ver_msg_t *ver_msg);
static int vdc_handle_attr_msg(vdc_t *vdc, vd_attr_msg_t *attr_msg);
static int vdc_handle_dring_reg_msg(vdc_t *vdc, vio_dring_reg_msg_t *msg);
-static int vdc_send_request(vdc_t *vdcp, int operation,
+static int vdc_send_request(vdc_t *vdcp, int operation,
caddr_t addr, size_t nbytes, int slice, diskaddr_t offset,
buf_t *bufp, vio_desc_direction_t dir, int flags);
static int vdc_map_to_shared_dring(vdc_t *vdcp, int idx);
-static int vdc_populate_descriptor(vdc_t *vdcp, int operation,
+static int vdc_populate_descriptor(vdc_t *vdcp, int operation,
caddr_t addr, size_t nbytes, int slice, diskaddr_t offset,
buf_t *bufp, vio_desc_direction_t dir, int flags);
-static int vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr,
+static int vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr,
size_t nbytes, int slice, diskaddr_t offset,
vio_desc_direction_t dir, boolean_t);
static int vdc_do_op(vdc_t *vdc, int op, caddr_t addr, size_t nbytes,
@@ -224,7 +224,7 @@ static int vdc_get_efi_convert(vdc_t *vdc, void *from, void *to,
static int vdc_set_efi_convert(vdc_t *vdc, void *from, void *to,
int mode, int dir);
-static void vdc_ownership_update(vdc_t *vdc, int ownership_flags);
+static void vdc_ownership_update(vdc_t *vdc, int ownership_flags);
static int vdc_access_set(vdc_t *vdc, uint64_t flags);
static vdc_io_t *vdc_eio_queue(vdc_t *vdc, int index);
static void vdc_eio_unqueue(vdc_t *vdc, clock_t deadline,
@@ -284,7 +284,7 @@ static uint_t vdc_hattr_min = VDC_HATTR_MIN;
* various operations
*/
static int vdc_timeout = 0; /* units: seconds */
-static int vdc_ldcup_timeout = 1; /* units: seconds */
+static int vdc_ldcup_timeout = 1; /* units: seconds */
static uint64_t vdc_hz_min_ldc_delay;
static uint64_t vdc_min_timeout_ldc = 1 * MILLISEC;
@@ -1074,7 +1074,7 @@ vdc_create_device_nodes_vtoc(vdc_t *vdc)
* refers to a whole disk. Slices start at 'a'
*
* Parameters:
- * vdc - soft state pointer
+ * vdc - soft state pointer
*
* Return Values
* 0 - Success
@@ -1192,7 +1192,7 @@ vdc_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, int mod_flags,
* currently opened.
*
* Parameters:
- * vdc - soft state pointer
+ * vdc - soft state pointer
*
* Return Values
* B_TRUE - at least one slice is opened.
@@ -2576,7 +2576,7 @@ vdc_terminate_ldc(vdc_t *vdc, vdc_server_t *srvr)
if (srvr->state & VDC_LDC_INIT) {
DMSG(vdc, 0, "[%d] ldc_fini()\n", instance);
(void) ldc_fini(srvr->ldc_handle);
- srvr->ldc_handle = NULL;
+ srvr->ldc_handle = 0;
}
srvr->state &= ~(VDC_LDC_INIT | VDC_LDC_CB | VDC_LDC_OPEN);
@@ -2682,7 +2682,7 @@ vdc_init_descriptor_ring(vdc_t *vdc)
status = ldc_mem_dring_create(vdc->dring_len,
vdc->dring_entry_size, &vdc->dring_hdl);
- if ((vdc->dring_hdl == NULL) || (status != 0)) {
+ if ((vdc->dring_hdl == 0) || (status != 0)) {
DMSG(vdc, 0, "[%d] Descriptor ring creation failed",
vdc->instance);
return (status);
@@ -2773,7 +2773,7 @@ static void
vdc_destroy_descriptor_ring(vdc_t *vdc)
{
vdc_local_desc_t *ldep = NULL; /* Local Dring Entry Pointer */
- ldc_mem_handle_t mhdl = NULL;
+ ldc_mem_handle_t mhdl = 0;
ldc_mem_info_t minfo;
int status = -1;
int i; /* loop */
@@ -2790,7 +2790,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc)
ldep = &vdc->local_dring[i];
mhdl = ldep->desc_mhdl;
- if (mhdl == NULL)
+ if (mhdl == 0)
continue;
if ((status = ldc_mem_info(mhdl, &minfo)) != 0) {
@@ -2803,7 +2803,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc)
* is not valid. Clear it out so that
* no one tries to use it.
*/
- ldep->desc_mhdl = NULL;
+ ldep->desc_mhdl = 0;
continue;
}
@@ -2813,7 +2813,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc)
(void) ldc_mem_free_handle(mhdl);
- ldep->desc_mhdl = NULL;
+ ldep->desc_mhdl = 0;
}
vdc->initialized &= ~VDC_DRING_ENTRY;
}
@@ -2841,7 +2841,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc)
DMSG(vdc, 0, "[%d] Destroying DRing\n", vdc->instance);
status = ldc_mem_dring_destroy(vdc->dring_hdl);
if (status == 0) {
- vdc->dring_hdl = NULL;
+ vdc->dring_hdl = 0;
bzero(&vdc->dring_mem_info, sizeof (ldc_mem_info_t));
vdc->initialized &= ~VDC_DRING_INIT;
} else {
@@ -3197,7 +3197,7 @@ loop:
* vdc_do_op
*
* Description:
- * Wrapper around vdc_submit_request(). Each request is associated with a
+ * Wrapper around vdc_submit_request(). Each request is associated with a
* buf structure. If a buf structure is provided (bufp != NULL) then the
* request will be submitted with that buf, and the caller can wait for
* completion of the request with biowait(). If a buf structure is not
@@ -3321,7 +3321,7 @@ done:
* vdc_do_sync_op
*
* Description:
- * Wrapper around vdc_do_op that serializes requests.
+ * Wrapper around vdc_do_op that serializes requests.
*
* Arguments:
* vdcp - the soft state pointer
@@ -3411,9 +3411,9 @@ vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes,
* vdc_drain_response()
*
* Description:
- * When a guest is panicking, the completion of requests needs to be
- * handled differently because interrupts are disabled and vdc
- * will not get messages. We have to poll for the messages instead.
+ * When a guest is panicking, the completion of requests needs to be
+ * handled differently because interrupts are disabled and vdc
+ * will not get messages. We have to poll for the messages instead.
*
* Note: since we are panicking we don't implement the io:::done
* DTrace probe or update the I/O statistics kstats.
@@ -3431,9 +3431,9 @@ vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes,
static int
vdc_drain_response(vdc_t *vdc, struct buf *buf)
{
- int rv, idx, retries;
+ int rv, idx, retries;
size_t msglen;
- vdc_local_desc_t *ldep = NULL; /* Local Dring Entry Pointer */
+ vdc_local_desc_t *ldep = NULL; /* Local Dring Entry Pointer */
vio_dring_msg_t dmsg;
struct buf *mbuf;
boolean_t ack;
@@ -3926,7 +3926,7 @@ vdc_wait_for_response(vdc_t *vdcp, vio_msg_t *msgp)
*
* Description:
* Resubmit each descriptor in the backed up dring to
- * vDisk server. The Dring was backed up during connection
+ * vDisk server. The Dring was backed up during connection
* reset.
*
* Arguments:
@@ -4030,7 +4030,7 @@ void
vdc_cancel_backup_dring(vdc_t *vdcp)
{
vdc_local_desc_t *ldep;
- struct buf *bufp;
+ struct buf *bufp;
int count;
int b_idx;
int dring_size;
@@ -4118,7 +4118,7 @@ vdc_cancel_backup_dring(vdc_t *vdcp)
void
vdc_connection_timeout(void *arg)
{
- vdc_t *vdcp = (vdc_t *)arg;
+ vdc_t *vdcp = (vdc_t *)arg;
mutex_enter(&vdcp->lock);
@@ -4213,7 +4213,7 @@ static void
vdc_switch_server(vdc_t *vdcp)
{
int rv;
- vdc_server_t *curr_server, *new_server;
+ vdc_server_t *curr_server, *new_server;
ASSERT(MUTEX_HELD(&vdcp->lock));
@@ -4410,9 +4410,9 @@ vdc_handshake_retry(vdc_t *vdcp, int hshake_cnt, int hattr_cnt)
* Description:
*
* Main VDC message processing thread. Each vDisk instance
- * consists of a copy of this thread. This thread triggers
- * all the handshakes and data exchange with the server. It
- * also handles all channel resets
+ * consists of a copy of this thread. This thread triggers
+ * all the handshakes and data exchange with the server. It
+ * also handles all channel resets
*
* Arguments:
* vdc - soft state pointer for this instance of the device driver.
@@ -5516,7 +5516,7 @@ typedef struct vdc_dk_arg {
/*
* Function:
- * vdc_dkio_flush_cb()
+ * vdc_dkio_flush_cb()
*
* Description:
* This routine is a callback for DKIOCFLUSHWRITECACHE which can be called
@@ -5572,7 +5572,7 @@ vdc_dkio_flush_cb(void *arg)
/*
* Function:
- * vdc_dkio_gapart()
+ * vdc_dkio_gapart()
*
* Description:
* This function implements the DKIOCGAPART ioctl.
@@ -5638,7 +5638,7 @@ vdc_dkio_gapart(vdc_t *vdc, caddr_t arg, int flag)
/*
* Function:
- * vdc_dkio_partition()
+ * vdc_dkio_partition()
*
* Description:
* This function implements the DKIOCPARTITION ioctl.
@@ -5691,7 +5691,7 @@ vdc_dkio_partition(vdc_t *vdc, caddr_t arg, int flag)
/*
* Function:
- * vdc_dioctl_rwcmd()
+ * vdc_dioctl_rwcmd()
*
* Description:
* This function implements the DIOCTL_RWCMD ioctl. This ioctl is used
@@ -5934,15 +5934,15 @@ vdc_scsi_status(vdc_t *vdc, vd_scsi_t *vd_scsi, boolean_t log_error)
static int
vdc_uscsi_cmd(vdc_t *vdc, caddr_t arg, int mode)
{
- struct uscsi_cmd uscsi;
+ struct uscsi_cmd uscsi;
struct uscsi_cmd32 uscsi32;
- vd_scsi_t *vd_scsi;
- int vd_scsi_len;
+ vd_scsi_t *vd_scsi;
+ int vd_scsi_len;
union scsi_cdb *cdb;
struct scsi_extended_sense *sense;
- char *datain, *dataout;
+ char *datain, *dataout;
size_t cdb_len, datain_len, dataout_len, sense_len;
- int rv;
+ int rv;
if (ddi_model_convert_from(mode & FMODELS) == DDI_MODEL_ILP32) {
if (ddi_copyin(arg, &uscsi32, sizeof (struct uscsi_cmd32),
@@ -7200,7 +7200,7 @@ static vdc_dk_ioctl_t dk_ioctl[] = {
vdc_get_geom_convert},
{VD_OP_GET_DISKGEOM, DKIOCG_PHYGEOM, sizeof (vd_geom_t),
vdc_get_geom_convert},
- {VD_OP_GET_DISKGEOM, DKIOCG_VIRTGEOM, sizeof (vd_geom_t),
+ {VD_OP_GET_DISKGEOM, DKIOCG_VIRTGEOM, sizeof (vd_geom_t),
vdc_get_geom_convert},
{VD_OP_SET_DISKGEOM, DKIOCSGEOM, sizeof (vd_geom_t),
vdc_set_geom_convert},
@@ -7222,7 +7222,7 @@ static vdc_dk_ioctl_t dk_ioctl[] = {
{0, MHIOCGRP_INKEYS, 0, vdc_null_copy_func},
{0, MHIOCGRP_INRESV, 0, vdc_null_copy_func},
{0, MHIOCGRP_REGISTER, 0, vdc_null_copy_func},
- {0, MHIOCGRP_RESERVE, 0, vdc_null_copy_func},
+ {0, MHIOCGRP_RESERVE, 0, vdc_null_copy_func},
{0, MHIOCGRP_PREEMPTANDABORT, 0, vdc_null_copy_func},
{0, MHIOCGRP_REGISTERANDIGNOREKEY, 0, vdc_null_copy_func},
@@ -7578,9 +7578,10 @@ vd_process_ioctl(dev_t dev, int cmd, caddr_t arg, int mode, int *rvalp)
vdc->dkio_flush_pending--;
mutex_exit(&vdc->lock);
kmem_free(dkarg, sizeof (vdc_dk_arg_t));
+ return (ENOMEM);
}
- return (rv == NULL ? ENOMEM : 0);
+ return (0);
}
}
diff --git a/usr/src/uts/sun4v/io/vds.c b/usr/src/uts/sun4v/io/vds.c
index 15d263a1b9..1c8ca84ff2 100644
--- a/usr/src/uts/sun4v/io/vds.c
+++ b/usr/src/uts/sun4v/io/vds.c
@@ -168,7 +168,7 @@ typedef struct vd_driver_type {
* The list can be extended by adding a "driver-type-list" entry in vds.conf
* with the following syntax:
*
- * driver-type-list="<driver>:<type>", ... ,"<driver>:<type>";
+ * driver-type-list="<driver>:<type>", ... ,"<driver>:<type>";
*
* Where:
* <driver> is the name of a driver (limited to 64 characters)
@@ -178,7 +178,7 @@ typedef struct vd_driver_type {
*
* For example, the following line in vds.conf:
*
- * driver-type-list="foo:disk","bar:volume";
+ * driver-type-list="foo:disk","bar:volume";
*
* defines that "foo" is a disk driver, and driver "bar" is a volume driver.
*
@@ -256,7 +256,7 @@ vd_driver_type_t vds_driver_types[] = {
static mdeg_prop_spec_t vds_prop_template[] = {
{ MDET_PROP_STR, "name", VDS_NAME },
{ MDET_PROP_VAL, "cfg-handle", NULL },
- { MDET_LIST_END, NULL, NULL }
+ { MDET_LIST_END, NULL, NULL }
};
#define VDS_SET_MDEG_PROP_INST(specp, val) (specp)[1].ps_val = (val);
@@ -290,7 +290,7 @@ typedef struct vd_option {
vd_option_t vd_bdev_options[] = {
{ "ro", VD_OPT_RDONLY },
- { "slice", VD_OPT_SLICE },
+ { "slice", VD_OPT_SLICE },
{ "excl", VD_OPT_EXCLUSIVE }
};
@@ -407,7 +407,7 @@ typedef struct vds {
mdeg_node_spec_t *ispecp; /* mdeg node specification */
mdeg_handle_t mdeg; /* handle for MDEG operations */
vd_driver_type_t *driver_types; /* extra driver types (from vds.conf) */
- int num_drivers; /* num of extra driver types */
+ int num_drivers; /* num of extra driver types */
} vds_t;
/*
@@ -595,7 +595,7 @@ static int vd_awflush = VD_AWFLUSH_IMMEDIATE | VD_AWFLUSH_GROUP;
* the service domain to panic. In both cases, the reset of the service domain
* should trigger a reset SCSI buses and hopefully clear any SCSI-2 reservation.
*/
-static int vd_reset_access_failure = 0;
+static int vd_reset_access_failure = 0;
/*
* Tunable for backward compatibility. When this variable is set to B_TRUE,
@@ -694,8 +694,8 @@ extern int is_pseudo_device(dev_info_t *);
* vd_get_readable_size
*
* Description:
- * Convert a given size in bytes to a human readable format in
- * kilobytes, megabytes, gigabytes or terabytes.
+ * Convert a given size in bytes to a human readable format in
+ * kilobytes, megabytes, gigabytes or terabytes.
*
* Parameters:
* full_size - the size to convert in bytes.
@@ -729,7 +729,7 @@ vd_get_readable_size(size_t full_size, size_t *size, char *unit)
* vd_dskimg_io_params
*
* Description:
- * Convert virtual disk I/O parameters (slice, block, length) to
+ * Convert virtual disk I/O parameters (slice, block, length) to
* (offset, length) relative to the disk image and according to
* the virtual disk partitioning.
*
@@ -848,7 +848,7 @@ vd_dskimg_io_params(vd_t *vd, int slice, size_t *blkp, size_t *lenp)
* vd_dskimg_rw
*
* Description:
- * Read or write to a disk image. It handles the case where the disk
+ * Read or write to a disk image. It handles the case where the disk
* image is a file or a volume exported as a full disk or a file
* exported as single-slice disk. Read or write to volumes exported as
* single slice disks are done by directly using the ldi interface.
@@ -891,7 +891,7 @@ vd_dskimg_rw(vd_t *vd, int slice, int operation, caddr_t data, size_t offset,
((operation == VD_OP_BREAD)? B_READ : B_WRITE);
buf.b_bcount = len;
buf.b_lblkno = offset;
- buf.b_edev = vd->dev[0];
+ buf.b_edev = vd->dev[0];
buf.b_un.b_addr = data;
/*
@@ -986,9 +986,9 @@ vd_build_default_label(size_t disk_size, size_t bsize, struct dk_label *label)
*
* Other parameters are computed from these values:
*
- * pcyl = disk_size / (nhead * nsect * 512)
- * acyl = (pcyl > 2)? 2 : 0
- * ncyl = pcyl - acyl
+ * pcyl = disk_size / (nhead * nsect * 512)
+ * acyl = (pcyl > 2)? 2 : 0
+ * ncyl = pcyl - acyl
*
* The maximum number of cylinder is 65535 so this allows to define a
* geometry for a disk size up to 65535 * 96 * 768 * 512 = 2.24 TB
@@ -1358,7 +1358,7 @@ vd_dskimg_write_devid(vd_t *vd, ddi_devid_t devid)
* vd_do_scsi_rdwr
*
* Description:
- * Read or write to a SCSI disk using an absolute disk offset.
+ * Read or write to a SCSI disk using an absolute disk offset.
*
* Parameters:
* vd - disk on which the operation is performed.
@@ -1482,7 +1482,7 @@ vd_do_scsi_rdwr(vd_t *vd, int operation, caddr_t data, size_t blk, size_t len)
* vd_scsi_rdwr
*
* Description:
- * Wrapper function to read or write to a SCSI disk using an absolute
+ * Wrapper function to read or write to a SCSI disk using an absolute
* disk offset. It checks the blocksize of the underlying device and,
* if necessary, adjusts the buffers accordingly before calling
* vd_do_scsi_rdwr() to do the actual read or write.
@@ -1562,7 +1562,7 @@ vd_scsi_rdwr(vd_t *vd, int operation, caddr_t data, size_t vblk, size_t vlen)
* ^ ^
* |<--------------------->|
* | plen
- * pblk
+ * pblk
*/
/* END CSTYLED */
pblk = (vblk * vd->vdisk_bsize) / vd->backend_bsize;
@@ -1897,7 +1897,7 @@ vd_flush_write(vd_t *vd)
status = VOP_FSYNC(vd->file_vnode, FSYNC, kcred, NULL);
} else {
status = ldi_ioctl(vd->ldi_handle[0], DKIOCFLUSHWRITECACHE,
- NULL, vd->open_flags | FKIOCTL, kcred, &rval);
+ (intptr_t)NULL, vd->open_flags | FKIOCTL, kcred, &rval);
}
return (status);
@@ -1973,7 +1973,7 @@ vd_start_bio(vd_task_t *task)
vd_dring_payload_t *request = task->request;
struct buf *buf = &task->buf;
uint8_t mtype;
- int slice;
+ int slice;
char *bufaddr = 0;
size_t buflen;
size_t offset, length, nbytes;
@@ -2116,7 +2116,7 @@ vd_start_bio(vd_task_t *task)
buf->b_bcount = length;
buf->b_lblkno = offset;
buf->b_bufsize = buflen;
- buf->b_edev = vd->dev[slice];
+ buf->b_edev = vd->dev[slice];
buf->b_un.b_addr = bufaddr;
buf->b_iodone = vd_biodone;
@@ -2526,7 +2526,7 @@ vd_complete_bio(vd_task_t *task)
* message to the client.
*
* Parameters:
- * arg - opaque pointer to structure containing task to be completed
+ * arg - opaque pointer to structure containing task to be completed
*
* Return Values
* None
@@ -2569,7 +2569,7 @@ vd_notify(vd_task_t *task)
* the vDisk client
*
* Parameters:
- * task - structure containing the request sent from client
+ * task - structure containing the request sent from client
*
* Return Values
* None
@@ -2624,7 +2624,7 @@ vd_complete_notify(vd_task_t *task)
* message to the client that the request is completed.
*
* Parameters:
- * arg - opaque pointer to structure containing task to be completed
+ * arg - opaque pointer to structure containing task to be completed
*
* Return Values
* None
@@ -3578,7 +3578,7 @@ vd_do_ioctl(vd_t *vd, vd_dring_payload_t *request, void* buf, vd_ioctl_t *ioctl)
* is passed in as a field in the task pointer.
*
* Parameters:
- * arg - opaque pointer to structure containing task to be completed
+ * arg - opaque pointer to structure containing task to be completed
*
* Return Values
* None
@@ -3688,7 +3688,8 @@ vd_ioctl(vd_task_t *task)
break;
}
}
- ASSERT(i < nioctls); /* because "operation" already validated */
+
+ VERIFY(i < nioctls); /* because "operation" already validated */
if (!(vd->open_flags & FWRITE) && ioctl[i].write) {
PR0("%s fails because backend is opened read-only",
@@ -3890,7 +3891,7 @@ vd_get_access(vd_task_t *task)
}
request->status = ldi_ioctl(vd->ldi_handle[request->slice], MHIOCSTATUS,
- NULL, (vd->open_flags | FKIOCTL), kcred, &rval);
+ (intptr_t)NULL, (vd->open_flags | FKIOCTL), kcred, &rval);
if (request->status != 0)
return (0);
@@ -3935,8 +3936,8 @@ vd_set_access(vd_task_t *task)
if (flags == VD_ACCESS_SET_CLEAR) {
PR0("Performing VD_OP_SET_ACCESS (CLEAR)");
request->status = ldi_ioctl(vd->ldi_handle[request->slice],
- MHIOCRELEASE, NULL, (vd->open_flags | FKIOCTL), kcred,
- &rval);
+ MHIOCRELEASE, (intptr_t)NULL, (vd->open_flags | FKIOCTL),
+ kcred, &rval);
if (request->status == 0)
vd->ownership = B_FALSE;
return (0);
@@ -3962,7 +3963,8 @@ vd_set_access(vd_task_t *task)
*/
PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE|PREEMPT|PRESERVE)");
request->status = ldi_ioctl(vd->ldi_handle[request->slice],
- MHIOCTKOWN, NULL, (vd->open_flags | FKIOCTL), kcred, &rval);
+ MHIOCTKOWN, (intptr_t)NULL, (vd->open_flags | FKIOCTL),
+ kcred, &rval);
break;
case VD_ACCESS_SET_PRESERVE:
@@ -3977,12 +3979,13 @@ vd_set_access(vd_task_t *task)
*/
PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE|PRESERVE)");
request->status = ldi_ioctl(vd->ldi_handle[request->slice],
- MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred,
- &rval);
+ MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL),
+ kcred, &rval);
if (request->status != 0)
break;
request->status = ldi_ioctl(vd->ldi_handle[request->slice],
- MHIOCTKOWN, NULL, (vd->open_flags | FKIOCTL), kcred, &rval);
+ MHIOCTKOWN, (intptr_t)NULL, (vd->open_flags | FKIOCTL),
+ kcred, &rval);
break;
case VD_ACCESS_SET_PREEMPT:
@@ -3994,8 +3997,8 @@ vd_set_access(vd_task_t *task)
*/
PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE|PREEMPT)");
request->status = ldi_ioctl(vd->ldi_handle[request->slice],
- MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred,
- &rval);
+ MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL),
+ kcred, &rval);
if (request->status == 0)
break;
@@ -4004,16 +4007,16 @@ vd_set_access(vd_task_t *task)
/* try again even if the reset has failed */
request->status = ldi_ioctl(vd->ldi_handle[request->slice],
- MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred,
- &rval);
+ MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL),
+ kcred, &rval);
break;
case 0:
/* Flag EXCLUSIVE only. Just issue a SCSI reservation */
PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE)");
request->status = ldi_ioctl(vd->ldi_handle[request->slice],
- MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred,
- &rval);
+ MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL),
+ kcred, &rval);
break;
}
@@ -4034,7 +4037,7 @@ vd_reset_access(vd_t *vd)
return;
PR0("Releasing disk ownership");
- status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, NULL,
+ status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, (intptr_t)NULL,
(vd->open_flags | FKIOCTL), kcred, &rval);
/*
@@ -4059,7 +4062,7 @@ vd_reset_access(vd_t *vd)
PR0("Fail to reset disk, error %d", status);
/* whatever the result of the reset is, we try the release again */
- status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, NULL,
+ status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, (intptr_t)NULL,
(vd->open_flags | FKIOCTL), kcred, &rval);
if (status == 0 || status == EACCES) {
@@ -4081,7 +4084,7 @@ vd_reset_access(vd_t *vd)
if (vd_reset_access_failure == A_REBOOT) {
cmn_err(CE_WARN, VD_RESET_ACCESS_FAILURE_MSG
", rebooting the system", vd->device_path);
- (void) uadmin(A_SHUTDOWN, AD_BOOT, NULL);
+ (void) uadmin(A_SHUTDOWN, AD_BOOT, (uintptr_t)NULL);
} else if (vd_reset_access_failure == A_DUMP) {
panic(VD_RESET_ACCESS_FAILURE_MSG, vd->device_path);
}
@@ -4122,7 +4125,7 @@ static const size_t vds_noperations =
* Process a task specifying a client I/O request
*
* Parameters:
- * task - structure containing the request sent from client
+ * task - structure containing the request sent from client
*
* Return Value
* 0 - success
@@ -4196,7 +4199,7 @@ vd_do_process_task(vd_task_t *task)
* by the completion handler.
*
* Parameters:
- * task - structure containing the request sent from client
+ * task - structure containing the request sent from client
*
* Return Value
* 0 - successful synchronous request.
@@ -5415,7 +5418,7 @@ vds_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
kmem_free(vds->ispecp->specp, sizeof (vds_prop_template));
kmem_free(vds->ispecp, sizeof (mdeg_node_spec_t));
vds->ispecp = NULL;
- vds->mdeg = NULL;
+ vds->mdeg = 0;
}
vds_driver_types_free(vds);
@@ -5884,7 +5887,7 @@ vd_setup_partition_efi(vd_t *vd)
static int
vd_setup_backend_vnode(vd_t *vd)
{
- int rval, status;
+ int rval, status;
dev_t dev;
char *file_path = vd->device_path;
ldi_handle_t lhandle;
@@ -6059,7 +6062,7 @@ vd_setup_disk_image(vd_t *vd)
*/
PR1("creating devid for %s", backend_path);
- if (ddi_devid_init(vd->vds->dip, DEVID_FAB, NULL, 0,
+ if (ddi_devid_init(vd->vds->dip, DEVID_FAB, 0, 0,
&vd->dskimg_devid) != DDI_SUCCESS) {
PR0("fail to create devid for %s", backend_path);
vd->dskimg_devid = NULL;
@@ -6088,7 +6091,7 @@ vd_setup_disk_image(vd_t *vd)
* Open a device using its device path (supplied by ldm(1m))
*
* Parameters:
- * vd - pointer to structure containing the vDisk info
+ * vd - pointer to structure containing the vDisk info
* flags - open flags
*
* Return Value
@@ -6491,7 +6494,7 @@ vd_backend_check_size(vd_t *vd)
* a disk device or a volume device.
*
* Parameters:
- * vd - pointer to structure containing the vDisk info
+ * vd - pointer to structure containing the vDisk info
* dtype - return the driver type of the device
*
* Return Value
@@ -6565,7 +6568,7 @@ vd_setup_vd(vd_t *vd)
{
int status, drv_type, pseudo;
dev_info_t *dip;
- vnode_t *vnp;
+ vnode_t *vnp;
char *path = vd->device_path;
char tq_name[TASKQ_NAMELEN];
@@ -7066,7 +7069,7 @@ vds_get_ldc_id(md_t *md, mde_cookie_t vd_node, uint64_t *ldc_id)
* vds_get_options
*
* Description:
- * Parse the options of a vds node. Options are defined as an array
+ * Parse the options of a vds node. Options are defined as an array
* of strings in the vds-block-device-opts property of the vds node
* in the machine description. Options are returned as a bitmask. The
* mapping between the bitmask options and the options strings from the
diff --git a/usr/src/uts/sun4v/sys/ds_impl.h b/usr/src/uts/sun4v/sys/ds_impl.h
index a2a06d21a3..00e8ba7680 100644
--- a/usr/src/uts/sun4v/sys/ds_impl.h
+++ b/usr/src/uts/sun4v/sys/ds_impl.h
@@ -196,7 +196,7 @@ typedef struct ds_port {
uint32_t ver_idx; /* index of version during handshake */
ds_ldc_t ldc; /* LDC for this port */
ds_domain_hdl_t domain_hdl; /* LDOMs domain hdl assoc. with port */
- char *domain_name; /* LDOMs domain name assoc. with port */
+ char *domain_name; /* LDOMs domain name assoc. with port */
} ds_port_t;
#define IS_DS_PORT(port) 1 /* VBSC code compatability */
@@ -404,7 +404,7 @@ typedef struct ds_log_entry {
#define DS_LOG_POOL_END (ds_log_entry_pool + DS_LOG_NPOOL)
#define DS_IS_POOL_ENTRY(ep) (((ep) >= ds_log_entry_pool) && \
- ((ep) <= &(ds_log_entry_pool[DS_LOG_NPOOL])))
+ ((ep) < &(ds_log_entry_pool[DS_LOG_NPOOL])))
/* VBSC code compatability related defines */
@@ -554,8 +554,8 @@ void ds_dump_msg(void *buf, size_t len);
#define DS_DUMP_MSG(flags, buf, len)
#define DS_DUMP_LDC_MSG(buf, len)
-#define DS_BADHDL1 NULL
-#define DS_BADHDL2 NULL
+#define DS_BADHDL1 (ds_svc_hdl_t)0
+#define DS_BADHDL2 (ds_svc_hdl_t)0
#endif /* DEBUG */
diff --git a/usr/src/uts/sun4v/vdc/Makefile b/usr/src/uts/sun4v/vdc/Makefile
index 9877103746..d9bf73ea19 100644
--- a/usr/src/uts/sun4v/vdc/Makefile
+++ b/usr/src/uts/sun4v/vdc/Makefile
@@ -40,7 +40,6 @@ UTSBASE = ../..
#
MODULE = vdc
OBJECTS = $(VDC_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(VDC_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE)
#
@@ -59,7 +58,6 @@ CLEANFILES += $(MODSTUBS_O)
# Define targets
#
ALL_TARGET = $(BINARY)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
CFLAGS += $(CCVERBOSE)
@@ -83,12 +81,6 @@ clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS)
#
diff --git a/usr/src/uts/sun4v/vds/Makefile b/usr/src/uts/sun4v/vds/Makefile
index 664b987d0f..b4df7add5f 100644
--- a/usr/src/uts/sun4v/vds/Makefile
+++ b/usr/src/uts/sun4v/vds/Makefile
@@ -40,7 +40,6 @@ UTSBASE = ../..
#
MODULE = vds
OBJECTS = $(VDS_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(VDS_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE)
#
@@ -59,7 +58,6 @@ CLEANFILES += $(MODSTUBS_O)
# Define targets
#
ALL_TARGET = $(BINARY)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
CFLAGS += $(CCVERBOSE)
@@ -85,12 +83,6 @@ clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS)
#