diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-02-16 11:44:06 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-02-16 11:44:06 +0000 |
commit | 6746ed3b77d080c3e97412bd3a094833430ecbc9 (patch) | |
tree | 378b6771f1799044afca5808221d7fcaf22342e5 /usr/src | |
parent | 284a6e28f3bf022a4b8320b2c2cb8db90b05df1e (diff) | |
parent | 3d580eda65b7c5ad75a73a93dceeebddfae06ec9 (diff) | |
download | illumos-joyent-6746ed3b77d080c3e97412bd3a094833430ecbc9.tar.gz |
[illumos-gate merge]
commit 3d580eda65b7c5ad75a73a93dceeebddfae06ec9
9091 MDB smart-write
commit eea30b2609e6094732d948fa0c740852cb14c13d
9073 loader.efi: chain loader should provide proper device handle
commit 9a5a2388e3d1f52bed03f56813569786dc86e353
9111 libstand: Fix IP recv timeout
commit f4033bcf10a5393890c1a83e912176aac34a10e2
9072 libefi: Move EFI fmtdev functionality to libefi
commit 9097ca5ce73b708ddec06afebe14c676da44d1ed
9107 vi: this statement may fall through
Diffstat (limited to 'usr/src')
31 files changed, 325 insertions, 110 deletions
diff --git a/usr/src/boot/lib/libstand/ip.c b/usr/src/boot/lib/libstand/ip.c index c920cb7172..789dcaab6f 100644 --- a/usr/src/boot/lib/libstand/ip.c +++ b/usr/src/boot/lib/libstand/ip.c @@ -415,8 +415,13 @@ readip(struct iodesc *d, void **pkt, void **payload, time_t tleft, while ((getsecs() - t) < tleft) { errno = 0; ret = readipv4(d, pkt, payload, tleft, proto); + if (ret >= 0) + return (ret); + /* Bubble up the error if it wasn't successful */ if (errno != EAGAIN) - break; + return (-1); } - return (ret); + /* We've exhausted tleft; timeout */ + errno = ETIMEDOUT; + return (-1); } diff --git a/usr/src/boot/lib/libstand/net.c b/usr/src/boot/lib/libstand/net.c index 740696a5a2..ea4c75b233 100644 --- a/usr/src/boot/lib/libstand/net.c +++ b/usr/src/boot/lib/libstand/net.c @@ -117,7 +117,7 @@ sendrecv(struct iodesc *d, /* Try to get a packet and process it. */ cc = (*rproc)(d, pkt, payload, tleft); /* Return on data, EOF or real error. */ - if (cc != -1 || errno != 0) + if (cc != -1 || (errno != 0 && errno != ETIMEDOUT)) return (cc); /* Timed out or didn't get the packet we're waiting for */ diff --git a/usr/src/boot/lib/libstand/tftp.c b/usr/src/boot/lib/libstand/tftp.c index 36ced27a20..39cd1466fe 100644 --- a/usr/src/boot/lib/libstand/tftp.c +++ b/usr/src/boot/lib/libstand/tftp.c @@ -637,14 +637,20 @@ sendrecv_tftp(struct tftp_handle *h, if (cc == -1) { /* Error on transmit; wait before retrying */ while ((getsecs() - t1) < tleft); + t1 = getsecs(); continue; } + t = t1 = getsecs(); recvnext: + if ((getsecs() - t) > MAXTMO) { + errno = ETIMEDOUT; + return (-1); + } /* Try to get a packet and process it. */ cc = (*rproc)(h, pkt, payload, tleft, rtype); /* Return on data, EOF or real error. */ - if (cc != -1 || errno != 0) + if (cc != -1 || (errno != 0 && errno != ETIMEDOUT)) return (cc); if ((getsecs() - t1) < tleft) { goto recvnext; diff --git a/usr/src/boot/sys/boot/efi/include/efilib.h b/usr/src/boot/sys/boot/efi/include/efilib.h index 4fcc0ff712..5f007c6d59 100644 --- a/usr/src/boot/sys/boot/efi/include/efilib.h +++ b/usr/src/boot/sys/boot/efi/include/efilib.h @@ -60,9 +60,14 @@ typedef struct pdinfo } pdinfo_t; pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev); +pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev); void *efi_get_table(EFI_GUID *tbl); +int efi_getdev(void **, const char *, const char **); +char *efi_fmtdev(void *); +int efi_setcurrdev(struct env_var *, int, const void *); + int efi_register_handles(struct devsw *, EFI_HANDLE *, EFI_HANDLE *, int); EFI_HANDLE efi_find_handle(struct devsw *, int); int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *, uint64_t *); diff --git a/usr/src/boot/sys/boot/efi/libefi/Makefile b/usr/src/boot/sys/boot/efi/libefi/Makefile index 0ca24675b6..e987cbc9d6 100644 --- a/usr/src/boot/sys/boot/efi/libefi/Makefile +++ b/usr/src/boot/sys/boot/efi/libefi/Makefile @@ -24,9 +24,9 @@ all: lib$(LIB).a install: -SRCS= delay.c devpath.c efi_console.c efi_driver_utils.c efichar.c \ - efinet.c efipart.c efizfs.c env.c errno.c handles.c libefi.c \ - time.c wchar.c +SRCS= delay.c devicename.c devpath.c efi_console.c efi_driver_utils.c \ + efichar.c efinet.c efipart.c efizfs.c env.c errno.c handles.c \ + libefi.c time.c wchar.c #.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" #SRCS += time.c diff --git a/usr/src/boot/sys/boot/efi/loader/devicename.c b/usr/src/boot/sys/boot/efi/libefi/devicename.c index 1e499c0b1b..c1c38c7a61 100644 --- a/usr/src/boot/sys/boot/efi/loader/devicename.c +++ b/usr/src/boot/sys/boot/efi/libefi/devicename.c @@ -38,8 +38,6 @@ #include <efi.h> #include <efilib.h> -#include "loader_efi.h" - static int efi_parsedev(struct devdesc **, const char *, const char **); /* diff --git a/usr/src/boot/sys/boot/efi/libefi/efipart.c b/usr/src/boot/sys/boot/efi/libefi/efipart.c index e2ea9bb95a..942deab383 100644 --- a/usr/src/boot/sys/boot/efi/libefi/efipart.c +++ b/usr/src/boot/sys/boot/efi/libefi/efipart.c @@ -106,16 +106,33 @@ static pdinfo_list_t hdinfo; static EFI_HANDLE *efipart_handles = NULL; static UINTN efipart_nhandles = 0; -static pdinfo_t * -efiblk_get_pdinfo(pdinfo_list_t *pdi, int unit) +pdinfo_list_t * +efiblk_get_pdinfo_list(struct devsw *dev) { - pdinfo_t *pd; + if (dev->dv_type == DEVT_DISK) + return (&hdinfo); + if (dev->dv_type == DEVT_CD) + return (&cdinfo); + if (dev->dv_type == DEVT_FD) + return (&fdinfo); + return (NULL); +} + +pdinfo_t * +efiblk_get_pdinfo(struct devdesc *dev) +{ + pdinfo_list_t *pdi; + pdinfo_t *pd = NULL; + + pdi = efiblk_get_pdinfo_list(dev->d_dev); + if (pdi == NULL) + return (pd); STAILQ_FOREACH(pd, pdi, pd_link) { - if (pd->pd_unit == unit) + if (pd->pd_unit == dev->d_unit) return (pd); } - return (NULL); + return (pd); } static int @@ -777,24 +794,11 @@ efipart_printhd(int verbose) return (efipart_print_common(&efipart_hddev, &hdinfo, verbose)); } -pdinfo_list_t * -efiblk_get_pdinfo_list(struct devsw *dev) -{ - if (dev->dv_type == DEVT_DISK) - return (&hdinfo); - if (dev->dv_type == DEVT_CD) - return (&cdinfo); - if (dev->dv_type == DEVT_FD) - return (&fdinfo); - return (NULL); -} - static int efipart_open(struct open_file *f, ...) { va_list args; struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; EFI_BLOCK_IO *blkio; EFI_STATUS status; @@ -805,13 +809,9 @@ efipart_open(struct open_file *f, ...) if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) - return (EIO); + return (EINVAL); if (pd->pd_blkio == NULL) { status = BS->HandleProtocol(pd->pd_handle, &blkio_guid, @@ -851,17 +851,13 @@ static int efipart_close(struct open_file *f) { struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; dev = (struct disk_devdesc *)(f->f_devdata); if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -880,18 +876,14 @@ static int efipart_ioctl(struct open_file *f, u_long cmd, void *data) { struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; int rc; dev = (struct disk_devdesc *)(f->f_devdata); if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -964,17 +956,13 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size, { struct bcache_devdata bcd; struct disk_devdesc *dev; - pdinfo_list_t *pdi; pdinfo_t *pd; dev = (struct disk_devdesc *)devdata; if (dev == NULL) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); @@ -1002,7 +990,6 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { struct disk_devdesc *dev = (struct disk_devdesc *)devdata; - pdinfo_list_t *pdi; pdinfo_t *pd; EFI_BLOCK_IO *blkio; uint64_t off, disk_blocks, d_offset = 0; @@ -1014,11 +1001,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size, if (dev == NULL || blk < 0) return (EINVAL); - pdi = efiblk_get_pdinfo_list(dev->d_dev); - if (pdi == NULL) - return (EINVAL); - - pd = efiblk_get_pdinfo(pdi, dev->d_unit); + pd = efiblk_get_pdinfo((struct devdesc *)dev); if (pd == NULL) return (EINVAL); diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile b/usr/src/boot/sys/boot/efi/loader/Makefile index 5914d1140f..0ae2ebbe3b 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile +++ b/usr/src/boot/sys/boot/efi/loader/Makefile @@ -26,9 +26,9 @@ PROG= loader.sym MACHINE= $(MACH64) # architecture-specific loader code -SRCS= autoload.c bootinfo.c conf.c copy.c devicename.c efi_main.c main.c \ +SRCS= autoload.c bootinfo.c conf.c copy.c efi_main.c main.c \ self_reloc.c smbios.c acpi.c vers.c memmap.c multiboot2.c -OBJS= autoload.o bootinfo.o conf.o copy.o devicename.o efi_main.o main.o \ +OBJS= autoload.o bootinfo.o conf.o copy.o efi_main.o main.o \ self_reloc.o smbios.o acpi.o vers.o memmap.o multiboot2.o ASFLAGS=-m64 -fPIC diff --git a/usr/src/boot/sys/boot/efi/loader/loader_efi.h b/usr/src/boot/sys/boot/efi/loader/loader_efi.h index 59b1ecc5bd..7339515b6b 100644 --- a/usr/src/boot/sys/boot/efi/loader/loader_efi.h +++ b/usr/src/boot/sys/boot/efi/loader/loader_efi.h @@ -55,10 +55,6 @@ struct relocator { int efi_autoload(void); -int efi_getdev(void **, const char *, const char **); -char *efi_fmtdev(void *); -int efi_setcurrdev(struct env_var *, int, const void *); - ssize_t efi_copyin(const void *, vm_offset_t, const size_t); ssize_t efi_copyout(const vm_offset_t, void *, const size_t); ssize_t efi_readin(const int, vm_offset_t, const size_t); diff --git a/usr/src/boot/sys/boot/efi/loader/main.c b/usr/src/boot/sys/boot/efi/loader/main.c index 3492736f94..3570c4fd07 100644 --- a/usr/src/boot/sys/boot/efi/loader/main.c +++ b/usr/src/boot/sys/boot/efi/loader/main.c @@ -884,9 +884,41 @@ command_chain(int argc, char *argv[]) *(--argv) = 0; } - if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) - loaded_image->DeviceHandle = - efi_find_handle(dev->d_dev, dev->d_unit); + if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) { + struct zfs_devdesc *z_dev; + struct disk_devdesc *d_dev; + pdinfo_t *hd, *pd; + + switch (dev->d_type) { + case DEVT_ZFS: + z_dev = (struct zfs_devdesc *)dev; + loaded_image->DeviceHandle = + efizfs_get_handle_by_guid(z_dev->pool_guid); + break; + case DEVT_NET: + loaded_image->DeviceHandle = + efi_find_handle(dev->d_dev, dev->d_unit); + break; + default: + hd = efiblk_get_pdinfo(dev); + if (STAILQ_EMPTY(&hd->pd_part)) { + loaded_image->DeviceHandle = hd->pd_handle; + break; + } + d_dev = (struct disk_devdesc *)dev; + STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { + /* + * d_partition should be 255 + */ + if (pd->pd_unit == d_dev->d_slice) { + loaded_image->DeviceHandle = + pd->pd_handle; + break; + } + } + break; + } + } dev_cleanup(); status = BS->StartImage(loaderhandle, NULL, NULL); diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c index e6d0b528b9..063a8eb765 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c @@ -28,7 +28,7 @@ * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2018 Joyent, Inc. All rights reserved. * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> - * Copyright (c) 2015 by Delphix. All rights reserved. + * Copyright (c) 2015, 2017 by Delphix. All rights reserved. */ #include <sys/elf.h> @@ -198,6 +198,94 @@ write_uint64(mdb_tgt_as_t as, mdb_tgt_addr_t addr, uint64_t n, uint_t rdback) return (addr + sizeof (n)); } +/* + * Writes to objects of size 1, 2, 4, or 8 bytes. The function + * doesn't care if the object is a number or not (e.g. it could + * be a byte array, or a struct) as long as the size of the write + * is one of the aforementioned ones. + */ +static mdb_tgt_addr_t +write_var_uint(mdb_tgt_as_t as, mdb_tgt_addr_t addr, uint64_t val, size_t size, + uint_t rdback) +{ + if (size < sizeof (uint64_t)) { + uint64_t max_num = 1ULL << (size * NBBY); + + if (val >= max_num) { + uint64_t write_len = 0; + + /* count bytes needed for val */ + while (val != 0) { + write_len++; + val >>= NBBY; + } + + mdb_warn("value too big for the length of the write: " + "supplied %llu bytes but maximum is %llu bytes\n", + (u_longlong_t)write_len, (u_longlong_t)size); + return (addr); + } + } + + switch (size) { + case 1: + return (write_uint8(as, addr, val, rdback)); + case 2: + return (write_uint16(as, addr, val, rdback)); + case 4: + return (write_uint32(as, addr, val, rdback)); + case 8: + return (write_uint64(as, addr, val, rdback)); + default: + mdb_warn("writes of size %u are not supported\n ", size); + return (addr); + } +} + +static mdb_tgt_addr_t +write_ctf_uint(mdb_tgt_as_t as, mdb_tgt_addr_t addr, uint64_t n, uint_t rdback) +{ + mdb_ctf_id_t mid; + size_t size; + ssize_t type_size; + int kind; + + if (mdb_ctf_lookup_by_addr(addr, &mid) != 0) { + mdb_warn("no CTF data found at this address\n"); + return (addr); + } + + kind = mdb_ctf_type_kind(mid); + if (kind == CTF_ERR) { + mdb_warn("CTF data found but type kind could not be read"); + return (addr); + } + + if (kind == CTF_K_TYPEDEF) { + mdb_ctf_id_t temp_id; + if (mdb_ctf_type_resolve(mid, &temp_id) != 0) { + mdb_warn("failed to resolve type"); + return (addr); + } + kind = mdb_ctf_type_kind(temp_id); + } + + if (kind != CTF_K_INTEGER && kind != CTF_K_POINTER && + kind != CTF_K_ENUM) { + mdb_warn("CTF type should be integer, pointer, or enum\n"); + return (addr); + } + + type_size = mdb_ctf_type_size(mid); + if (type_size < 0) { + mdb_warn("CTF data found but size could not be read"); + return (addr); + } + size = type_size; + + return (write_var_uint(as, addr, n, size, rdback)); +} + static int write_arglist(mdb_tgt_as_t as, mdb_tgt_addr_t addr, int argc, const mdb_arg_t *argv) @@ -222,6 +310,9 @@ write_arglist(mdb_tgt_as_t as, mdb_tgt_addr_t addr, case 'w': write_value = write_uint16; break; + case 'z': + write_value = write_ctf_uint; + break; case 'W': write_value = write_uint32; break; @@ -487,7 +578,7 @@ print_common(mdb_tgt_as_t as, uint_t flags, int argc, const mdb_arg_t *argv) mdb_tgt_addr_t addr = mdb_nv_get_value(mdb.m_dot); if (argc != 0 && argv->a_type == MDB_TYPE_CHAR) { - if (strchr("vwWZ", argv->a_un.a_char)) + if (strchr("vwzWZ", argv->a_un.a_char)) return (write_arglist(as, addr, argc, argv)); if (strchr("lLM", argv->a_un.a_char)) return (match_arglist(as, flags, addr, argc, argv)); @@ -2788,6 +2879,94 @@ cmd_delete(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) return (ve_delete_spec(&spec)); } +static int +cmd_write(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) +{ + mdb_tgt_as_t as; + int rdback = mdb.m_flags & MDB_FL_READBACK; + mdb_tgt_addr_t naddr; + size_t forced_size = 0; + boolean_t opt_p, opt_o, opt_l; + uint64_t val = 0; + int i; + + opt_p = opt_o = opt_l = B_FALSE; + + i = mdb_getopts(argc, argv, + 'p', MDB_OPT_SETBITS, B_TRUE, &opt_p, + 'o', MDB_OPT_SETBITS, B_TRUE, &opt_o, + 'l', MDB_OPT_UINTPTR_SET, &opt_l, (uintptr_t *)&forced_size, NULL); + + if (!(flags & DCMD_ADDRSPEC)) + return (DCMD_USAGE); + + if (opt_p && opt_o) { + mdb_warn("-o and -p are incompatible\n"); + return (DCMD_USAGE); + } + + argc -= i; + argv += i; + + if (argc == 0) + return (DCMD_USAGE); + + switch (argv[0].a_type) { + case MDB_TYPE_STRING: + val = mdb_strtoull(argv[0].a_un.a_str); + break; + case MDB_TYPE_IMMEDIATE: + val = argv[0].a_un.a_val; + break; + default: + return (DCMD_USAGE); + } + + if (opt_p) + as = MDB_TGT_AS_PHYS; + else if (opt_o) + as = MDB_TGT_AS_FILE; + else + as = MDB_TGT_AS_VIRT; + + if (opt_l) + naddr = write_var_uint(as, addr, val, forced_size, rdback); + else + naddr = write_ctf_uint(as, addr, val, rdback); + + if (addr == naddr) { + mdb_warn("failed to write %llr at address %#llx", val, addr); + return (DCMD_ERR); + } + + return (DCMD_OK); +} + +void +write_help(void) +{ + mdb_printf( + "-l length force a write with the specified length in bytes\n" + "-o write data to the object file location specified\n" + "-p write data to the physical address specified\n" + "\n" + "Attempts to write the given value to the address provided.\n" + "If -l is not specified, the address must be the position of a\n" + "symbol that is either of integer, pointer, or enum type. The\n" + "type and the size of the symbol are inferred by the CTF found\n" + "in the provided address. The length of the write is guaranteed\n" + "to be the inferred size of the symbol.\n" + "\n" + "If no CTF data exists, or the address provided is not a symbol\n" + "of integer or pointer type, then the write fails. At that point\n" + "the user can force the write by using the '-l' option and\n" + "specifying its length.\n" + "\n" + "Note that forced writes with a length that are bigger than\n" + "the size of the biggest data pointer supported are not allowed." + "\n"); +} + static void srcexec_file_help(void) { @@ -2994,6 +3173,9 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = { cmd_whatis, whatis_help }, { "whence", "[-v] name ...", "show source of walk or dcmd", cmd_which }, { "which", "[-v] name ...", "show source of walk or dcmd", cmd_which }, + { "write", "?[-op] [-l len] value", + "write value to the provided memory location", cmd_write, + write_help }, { "xdata", NULL, "print list of external data buffers", cmd_xdata }, #ifdef _KMDB diff --git a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c index 539a4c249e..78d27bdcb9 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c @@ -22,6 +22,7 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2016 Joyent, Inc. + * Copyright (c) 2017 by Delphix. All rights reserved. */ /* @@ -118,6 +119,7 @@ static const char help_match32[] = "int"; static const char help_match64[] = "long long"; static const char help_match16[] = "short"; static const char help_uintptr[] = "hexadecimal uintptr_t"; +static const char help_ctf[] = "whose size is inferred by CTF info"; /*ARGSUSED*/ static mdb_tgt_addr_t @@ -618,7 +620,7 @@ static const mdb_fmt_desc_t fmttab[] = { { FMT_PRINTF|FMT_WRITE, "%-8hr", NULL, 2 }, /* 119 = w */ { FMT_PRINTF, "%-8hx", NULL, 2 }, /* 120 = x */ { FMT_FUNC, FUNCP(fmt_time64), help_time64, 8 }, /* 121 = y */ - { FMT_NONE, NULL, NULL, 0 }, /* 122 = z */ + { FMT_WRITE, NULL, help_ctf, 0 }, /* 122 = z */ }; mdb_tgt_addr_t diff --git a/usr/src/cmd/mdb/common/mdb/mdb_lex.l b/usr/src/cmd/mdb/common/mdb/mdb_lex.l index b9bee245b6..e777039c7b 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_lex.l +++ b/usr/src/cmd/mdb/common/mdb/mdb_lex.l @@ -27,6 +27,7 @@ /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2017 by Delphix. All rights reserved. */ #include <sys/types.h> @@ -213,7 +214,7 @@ RGX_COMMENT "//".*\n return (MDB_TOK_DCMD); } -<S_INITIAL>[/\\?][ \t]*[vwWZlLM] { +<S_INITIAL>[/\\?][ \t]*[vwzWZlLM] { /* * Format verb followed by write or match signifier -- switch * to the value list state and return the verb character. We diff --git a/usr/src/cmd/vi/port/ex.c b/usr/src/cmd/vi/port/ex.c index 5475c23a2b..591081cea9 100644 --- a/usr/src/cmd/vi/port/ex.c +++ b/usr/src/cmd/vi/port/ex.c @@ -311,6 +311,7 @@ main(int ac, char *av[]) rcvname = (unsigned char *)av[optind]; optind++; } + /* FALLTHROUGH */ case 'L': recov++; diff --git a/usr/src/cmd/vi/port/ex_addr.c b/usr/src/cmd/vi/port/ex_addr.c index dd2c2203a9..05e26a7290 100644 --- a/usr/src/cmd/vi/port/ex_addr.c +++ b/usr/src/cmd/vi/port/ex_addr.c @@ -30,7 +30,6 @@ /* Copyright (c) 1981 Regents of the University of California */ -#pragma ident "%Z%%M% %I% %E% SMI" #include "ex.h" #include "ex_re.h" @@ -246,6 +245,7 @@ address(inputline) case '\'': case '\\': bigmove++; + /* FALLTHROUGH */ case '.': if (addr || offset) error(gettext("Badly formed address")); diff --git a/usr/src/cmd/vi/port/ex_cmds.c b/usr/src/cmd/vi/port/ex_cmds.c index ab7146ce0f..48bb3f8a0b 100644 --- a/usr/src/cmd/vi/port/ex_cmds.c +++ b/usr/src/cmd/vi/port/ex_cmds.c @@ -803,7 +803,7 @@ suspend: #endif } - /* fall into ... */ + /* FALLTHROUGH */ /* & */ /* ~ */ diff --git a/usr/src/cmd/vi/port/ex_cmdsub.c b/usr/src/cmd/vi/port/ex_cmdsub.c index 1b3e9d5d87..7e2cd4740d 100644 --- a/usr/src/cmd/vi/port/ex_cmdsub.c +++ b/usr/src/cmd/vi/port/ex_cmdsub.c @@ -1020,12 +1020,14 @@ zop(int hadpr) case '^': zweight = 1; + /* FALLTHROUGH */ case '-': case '+': while (peekchar() == op) { ignchar(); zweight++; } + /* FALLTHROUGH */ case '=': case '.': c = getchar(); @@ -1080,6 +1082,7 @@ zop2(int nlines, int op) case EOF: if (addr2 == dol) error(gettext("\nAt EOF")); + /* FALLTHROUGH */ case '+': if (addr2 == dol) error(gettext("At EOF")); @@ -1087,6 +1090,7 @@ zop2(int nlines, int op) if (addr2 > dol) error(gettext("Hit BOTTOM")); addr2++; + /* FALLTHROUGH */ default: addr1 = addr2; addr2 += nlines-1; diff --git a/usr/src/cmd/vi/port/ex_io.c b/usr/src/cmd/vi/port/ex_io.c index fd11f486a0..7ccbc0ac1c 100644 --- a/usr/src/cmd/vi/port/ex_io.c +++ b/usr/src/cmd/vi/port/ex_io.c @@ -101,7 +101,7 @@ gettext("No current filename")); case 'f': edited = 0; - /* fall into ... */ + /* FALLTHROUGH */ case 'e': if (savedfile[0]) { @@ -215,7 +215,7 @@ getargs(void) case '\\': if (any(peekchar(), "#%|")) c = getchar(); - /* fall into... */ + /* FALLTHROUGH */ default: if (cp > &genbuf[LBSIZE - 2]) @@ -416,6 +416,7 @@ rop(int c) case S_IFBLK: error(gettext(" Block special file")); + /* FALLTHROUGH */ case S_IFCHR: if (isatty(io)) @@ -423,6 +424,7 @@ rop(int c) if (samei(&stbuf, "/dev/null")) break; error(gettext(" Character special file")); + /* FALLTHROUGH */ case S_IFDIR: error(gettext(" Directory")); diff --git a/usr/src/cmd/vi/port/ex_re.c b/usr/src/cmd/vi/port/ex_re.c index 00f7fe083a..fd87b91338 100644 --- a/usr/src/cmd/vi/port/ex_re.c +++ b/usr/src/cmd/vi/port/ex_re.c @@ -327,7 +327,7 @@ gettext("Missing regular expression for substitute")); case '~': uselastre = 1; - /* fall into ... */ + /* FALLTHROUGH */ case '&': redo: if (re == NULL || re->Expbuf[1] == 0) @@ -474,6 +474,7 @@ gettext("Replacement pattern too long - limit 256 characters")); ungetchar(c); goto endrhs; } + /* FALLTHROUGH */ case '~': case '&': @@ -981,6 +982,7 @@ cerror(value(vi_TERSE) ? (unsigned char *)gettext("No newlines in re's") : } cerror(value(vi_TERSE) ? (unsigned char *)gettext("Badly formed re") : (unsigned char *)gettext("Missing closing delimiter for regular expression")); + /* FALLTHROUGH */ case '.': case '~': @@ -990,6 +992,7 @@ cerror(value(vi_TERSE) ? (unsigned char *)gettext("Badly formed re") : goto magic; if(c != '~') *gp++ = '\\'; + /* FALLTHROUGH */ defchar: default: *gp++ = (value(vi_IGNORECASE) ? tolower(c) : c); @@ -1038,6 +1041,7 @@ out: case 42: cerror((unsigned char *)gettext("\\( \\) Imbalance")); + /* FALLTHROUGH */ case 43: cerror(value(vi_TERSE) ? (unsigned char *)gettext("Awash in \\('s!") : (unsigned char *) diff --git a/usr/src/cmd/vi/port/ex_subr.c b/usr/src/cmd/vi/port/ex_subr.c index c920d55853..3f0980a825 100644 --- a/usr/src/cmd/vi/port/ex_subr.c +++ b/usr/src/cmd/vi/port/ex_subr.c @@ -1123,7 +1123,7 @@ int sig; flush(); setty(f); if (!inopen) - error(0); + syserror(0); else { if(vcnt < 0) { vcnt = -vcnt; diff --git a/usr/src/cmd/vi/port/ex_unix.c b/usr/src/cmd/vi/port/ex_unix.c index 5a050acf06..e1df4ae399 100644 --- a/usr/src/cmd/vi/port/ex_unix.c +++ b/usr/src/cmd/vi/port/ex_unix.c @@ -30,8 +30,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "ex.h" #include "ex_temp.h" #include "ex_tty.h" @@ -100,6 +98,7 @@ gettext("Incomplete shell escape command - use 'shell' to get a shell")); contread = 1; } } + /* FALLTHROUGH */ default: if (up >= (unsigned char *)&uxb[UXBSIZE]) { tunix: diff --git a/usr/src/cmd/vi/port/ex_v.c b/usr/src/cmd/vi/port/ex_v.c index c93a59ea7e..b242efb1e4 100644 --- a/usr/src/cmd/vi/port/ex_v.c +++ b/usr/src/cmd/vi/port/ex_v.c @@ -30,8 +30,6 @@ /* Copyright (c) 1981 Regents of the University of California */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "ex.h" #include "ex_re.h" #include "ex_tty.h" @@ -440,7 +438,7 @@ setwind(void) case ONEOPEN: if (auto_right_margin) WCOLS--; - /* fall into ... */ + /* FALLTHROUGH */ case HARDOPEN: basWTOP = WTOP = WBOT = WECHO = 0; @@ -450,7 +448,7 @@ setwind(void) case CRTOPEN: basWTOP = lines - 2; - /* fall into */ + /* FALLTHROUGH */ case VISUAL: ZERO = lines - TUBESIZE / WCOLS; diff --git a/usr/src/cmd/vi/port/ex_vget.c b/usr/src/cmd/vi/port/ex_vget.c index c96d4bc29c..9ea4e6acb6 100644 --- a/usr/src/cmd/vi/port/ex_vget.c +++ b/usr/src/cmd/vi/port/ex_vget.c @@ -398,6 +398,7 @@ char *cmdstr, *sgn; } else if (cmdstr[1] != 'o') { goto Default; } + /* FALLTHROUGH */ case 't': if (cmdstr[1] != '\0') goto Default; diff --git a/usr/src/cmd/vi/port/ex_vmain.c b/usr/src/cmd/vi/port/ex_vmain.c index b11439a182..e37f03b3b0 100644 --- a/usr/src/cmd/vi/port/ex_vmain.c +++ b/usr/src/cmd/vi/port/ex_vmain.c @@ -698,7 +698,7 @@ reread: operate('$', 1); appnd: c = 'a'; - /* fall into ... */ + /* FALLTHROUGH */ /* * a Appends text after cursor. Text can continue @@ -730,7 +730,7 @@ appnd: case 'I': operate('^', 1); c = 'i'; - /* fall into ... */ + /* FALLTHROUGH */ /* * R Replace characters, one for one, by input @@ -743,7 +743,7 @@ appnd: * you can't move around within a R, etc. */ case 'R': - /* fall into... */ + /* FALLTHROUGH */ /* * i Insert text to an escape in the buffer. @@ -789,7 +789,7 @@ insrt: (void) beep(); if (initev || peekkey() != ATTN) continue; - /* fall into... */ + /* FALLTHROUGH */ /* * ^\ A quit always gets command mode. @@ -822,7 +822,7 @@ insrt: continue; } #endif - /* fall into... */ + /* FALLTHROUGH */ /* * Q Is like q, but always gets to command mode @@ -1484,7 +1484,7 @@ vzop(bool hadcnt, int cnt, int c) case '+': forbid (addr >= dol); - /* fall into ... */ + /* FALLTHROUGH */ case CR: case NL: diff --git a/usr/src/cmd/vi/port/ex_voper.c b/usr/src/cmd/vi/port/ex_voper.c index 8ce2904af2..704a166987 100644 --- a/usr/src/cmd/vi/port/ex_voper.c +++ b/usr/src/cmd/vi/port/ex_voper.c @@ -106,7 +106,7 @@ operate(int c, int cnt) case 's': ungetkey(' '); subop++; - /* fall into ... */ + /* FALLTHROUGH */ /* * c Change operator. @@ -140,7 +140,7 @@ operate(int c, int cnt) */ case '=': forbid(!value(vi_LISP)); - /* fall into ... */ + /* FALLTHROUGH */ /* * > Right shift operator. @@ -269,7 +269,7 @@ nocount: case 'b': case 'B': dir = -1; - /* fall into ... */ + /* FALLTHROUGH */ /* * w Forward a word. @@ -304,7 +304,7 @@ ein: */ case '(': dir = -1; - /* fall into... */ + /* FALLTHROUGH */ /* * ) Forward an s-expression. @@ -321,7 +321,7 @@ ein: */ case '{': dir = -1; - /* fall into... */ + /* FALLTHROUGH */ /* * } Forward an s-expression, but don't stop on atoms. @@ -377,7 +377,7 @@ ein: */ case '[': dir = -1; - /* fall into ... */ + /* FALLTHROUGH */ /* * ] Forward to next defun, i.e. a ( in column 1. @@ -451,7 +451,7 @@ ein: case 'F': /* inverted find */ case 'T': dir = -1; - /* fall into ... */ + /* FALLTHROUGH */ /* * f Find single character following cursor in current line. @@ -483,6 +483,7 @@ ein: case 't': wcursor = lastchr(linebuf, wcursor); + /* FALLTHROUGH */ case 'f': fixup: if (moveop != vmove) @@ -544,7 +545,7 @@ fixup: case 'h': case CTRL('h'): dir = -1; - /* fall into ... */ + /* FALLTHROUGH */ /* * space Forward a character. @@ -580,7 +581,7 @@ fixup: */ case 'X': dir = -1; - /* fall into ... */ + /* FALLTHROUGH */ deleteit: /* * x Delete character at cursor, leaving cursor where it is. @@ -611,7 +612,7 @@ errlab: vmacp = 0; return; } - /* fall into ... */ + /* FALLTHROUGH */ /* * _ Target for a line or group of lines. diff --git a/usr/src/cmd/vi/port/ex_vops.c b/usr/src/cmd/vi/port/ex_vops.c index 71dba8cf5a..9b92299233 100644 --- a/usr/src/cmd/vi/port/ex_vops.c +++ b/usr/src/cmd/vi/port/ex_vops.c @@ -115,7 +115,7 @@ bool show; /* if true update the screen */ vsave(); (void) YANKreg('1'); notecnt = 0; - /* fall into ... */ + /* FALLTHROUGH */ case VMANY: case VMCHNG: diff --git a/usr/src/cmd/vi/port/ex_vops2.c b/usr/src/cmd/vi/port/ex_vops2.c index f47b9adcdf..1b10b6d273 100644 --- a/usr/src/cmd/vi/port/ex_vops2.c +++ b/usr/src/cmd/vi/port/ex_vops2.c @@ -1362,7 +1362,7 @@ ws: goto def; } c = '\n'; - /* presto chango ... */ + /* FALLTHROUGH */ /* * \n Start new line. @@ -1417,6 +1417,7 @@ ws: ogcursor = cp; goto vbackup; } + /* FALLTHROUGH */ /* * ^D works only if we are at the (end of) the * generated autoindent. We count the ^D for repeat diff --git a/usr/src/cmd/vi/port/ex_vput.c b/usr/src/cmd/vi/port/ex_vput.c index 6641d11cbd..726a941658 100644 --- a/usr/src/cmd/vi/port/ex_vput.c +++ b/usr/src/cmd/vi/port/ex_vput.c @@ -30,8 +30,6 @@ /* Copyright (c) 1981 Regents of the University of California */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -1309,7 +1307,7 @@ vputchar(wchar_t c) return (0); } c = ' ' | QUOTE; - /* fall into ... */ + /* FALLTHROUGH */ def: default: diff --git a/usr/src/cmd/vi/port/ex_vwind.c b/usr/src/cmd/vi/port/ex_vwind.c index cdaf577a2b..3fa2f9fc22 100644 --- a/usr/src/cmd/vi/port/ex_vwind.c +++ b/usr/src/cmd/vi/port/ex_vwind.c @@ -206,7 +206,7 @@ vcontext(line *addr, unsigned char where) case '^': addr = vback(addr, basWLINES - vdepth()); getaline(*addr); - /* fall into ... */ + /* FALLTHROUGH */ case '-': top = vback(addr, basWLINES - vdepth()); diff --git a/usr/src/cmd/vi/port/printf.c b/usr/src/cmd/vi/port/printf.c index ba242a4e92..fef1440e14 100644 --- a/usr/src/cmd/vi/port/printf.c +++ b/usr/src/cmd/vi/port/printf.c @@ -37,12 +37,6 @@ * contributors. */ -/* The pwb version this is based on */ -static char *printf_id = "@(#) printf.c:2.2 6/5/79"; -/* The local sccs version within ex */ - -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdarg.h> #include <stdlib.h> #include <limits.h> @@ -162,7 +156,7 @@ viprintf(unsigned char *fmt, ...) case 'L': case 'l': length = 2; - /* no break!! */ + /* FALLTHROUGH */ case 'h': case 'H': length--; @@ -196,7 +190,7 @@ viprintf(unsigned char *fmt, ...) case 'O': length = 1; fcode = 'o'; - /* no break */ + /* FALLTHROUGH */ case 'o': case 'X': case 'x': @@ -245,7 +239,7 @@ viprintf(unsigned char *fmt, ...) case 'I': length = 1; fcode = fcode + 'a' - 'A'; - /* no break */ + /* FALLTHROUGH */ case 'd': case 'i': case 'u': diff --git a/usr/src/man/man1/mdb.1 b/usr/src/man/man1/mdb.1 index c388fadfcd..55640c5fab 100644 --- a/usr/src/man/man1/mdb.1 +++ b/usr/src/man/man1/mdb.1 @@ -1,6 +1,7 @@ '\" te .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright (c) 2017, Joyent, Inc. All Rights Reserved. +.\" Copyright (c) 2014, 2017 by Delphix. All rights reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] @@ -1379,6 +1380,7 @@ v decimal signed int (1 byte) w default radix unsigned short (2 bytes) x hexadecimal short (2 bytes) y decoded time64_t (8 bytes) +z write whose size is inferred by CTF info (variable size) .TE .sp |