diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-12-19 12:40:51 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-12-19 12:40:51 +0000 |
| commit | 1b4b6f23c2256de6934b89b05c0a77a44b84f817 (patch) | |
| tree | 38a41ef900c089f777207f357f041d5814dfd532 /usr/src | |
| parent | dfbd50d8db03bb9bc7350af3a750cd017d66d0c0 (diff) | |
| parent | 7b2eb3f3c068e560c7357b0f314172448bb8d1e0 (diff) | |
| download | illumos-joyent-1b4b6f23c2256de6934b89b05c0a77a44b84f817.tar.gz | |
[illumos-gate merge]
commit 7b2eb3f3c068e560c7357b0f314172448bb8d1e0
12057 Writing part of the string to stderr makes zlogin exit
commit d2dd27964b9dfc03118548f9509e4706787c2a69
12088 Cannot build iasl with bison 3.5 [-Werror=char-subscripts]
commit bf74bfd433cc5106d2fffc63678efb6ba4a3694c
12090 loader.efi: efi_readkey_ex needs to check the key despite the shift status or toggle status
commit 5947648b7f5c085635051e1f7aa083a309542467
12069 Backport sh_delay() and tvsleep() from ksh-2020.0.0
commit fc5c75cf5edb072564020725faa0c4313714f09f
12051 re-enable ZFS trim by default
commit 8b35e52344673c75ba6a446ced1fb5c36b52a242
12070 sata SSDs attached to sata ports can't trim
commit 2ed5f78a049996104f9dcce38d0c0c1735dd0e7a
12091 loader: biosdisk.c: Use symbolic names for int13 calls
commit bf6cb86ec437546144857d9aa94ef222ec6763c0
12082 libpctx: cast between incompatible function types
commit c94f4b0313ed735fc39e1b15e1fa48c0e6e3730f
12081 libldap5: cast between incompatible function types
commit 3c19a1689122901345a6089d081aa2de4a1096da
12079 audit_plugins: cast between incompatible function types
commit adbb29bd77dbfbbf129b5e3bd6ccc5bd4074fd79
12073 loader: devopen dereference after free
commit fdf04373777e703cebbbce0f774ae970eb6030f7
12072 loader: vdisk dereference after free
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/common/devopen.c | 16 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/common/vdisk.c | 4 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/efi/libefi/efi_console.c | 12 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/i386/common/edd.h | 7 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/i386/libi386/biosdisk.c | 65 | ||||
| -rw-r--r-- | usr/src/cmd/acpi/iasl/Makefile | 4 | ||||
| -rw-r--r-- | usr/src/cmd/zlogin/zlogin.c | 19 | ||||
| -rw-r--r-- | usr/src/lib/auditd_plugins/remote/transport.c | 19 | ||||
| -rw-r--r-- | usr/src/lib/libast/common/tm/tvsleep.c | 174 | ||||
| -rw-r--r-- | usr/src/lib/libldap5/sources/ldap/common/open.c | 34 | ||||
| -rw-r--r-- | usr/src/lib/libpctx/common/libpctx.c | 38 | ||||
| -rw-r--r-- | usr/src/lib/libshell/common/bltins/sleep.c | 114 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_disk.c | 4 | ||||
| -rw-r--r-- | usr/src/uts/common/io/sata/impl/sata.c | 26 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/sata/sata_defs.h | 4 |
16 files changed, 217 insertions, 325 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 3e19a7125b..707e31612b 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2019.12.16.3 +BOOT_VERSION = $(LOADER_VERSION)-2019.12.18.2 diff --git a/usr/src/boot/sys/boot/common/devopen.c b/usr/src/boot/sys/boot/common/devopen.c index de6165c03e..c4aa21c5c6 100644 --- a/usr/src/boot/sys/boot/common/devopen.c +++ b/usr/src/boot/sys/boot/common/devopen.c @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> * All rights reserved. * @@ -25,7 +25,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <stand.h> #include <string.h> @@ -33,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" int -devopen(struct open_file *f, const char *fname, const char **file) +devopen(struct open_file *f, const char *fname, const char **file) { struct devdesc *dev; int result; @@ -43,25 +42,22 @@ devopen(struct open_file *f, const char *fname, const char **file) return (result); /* point to device-specific data so that device open can use it */ + f->f_dev = dev->d_dev; f->f_devdata = dev; result = dev->d_dev->dv_open(f, dev); if (result != 0) { f->f_devdata = NULL; + f->f_dev = NULL; free(dev); - return (result); } - /* reference the devsw entry from the open_file structure */ - f->f_dev = dev->d_dev; - return (0); + return (result); } int devclose(struct open_file *f) { - if (f->f_devdata != NULL) { - free(f->f_devdata); - } + free(f->f_devdata); return (0); } diff --git a/usr/src/boot/sys/boot/common/vdisk.c b/usr/src/boot/sys/boot/common/vdisk.c index baab877428..bb5b2eb6d1 100644 --- a/usr/src/boot/sys/boot/common/vdisk.c +++ b/usr/src/boot/sys/boot/common/vdisk.c @@ -228,10 +228,10 @@ command_unmapvd(int argc, char *argv[]) } STAILQ_REMOVE(&vdisk_list, vd, vdisk_info, vdisk_link); - close(vd->vdisk_fd); + (void) close(vd->vdisk_fd); + printf("%s (%s) unmapped\n", argv[1], vd->vdisk_path); free(vd->vdisk_path); free(vd); - printf("%s (%s) unmapped\n", argv[1], vd->vdisk_path); return (CMD_OK); } diff --git a/usr/src/boot/sys/boot/efi/libefi/efi_console.c b/usr/src/boot/sys/boot/efi/libefi/efi_console.c index 34c88b6e99..37d07a8802 100644 --- a/usr/src/boot/sys/boot/efi/libefi/efi_console.c +++ b/usr/src/boot/sys/boot/efi/libefi/efi_console.c @@ -674,11 +674,15 @@ efi_readkey_ex(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *coninex) kp->UnicodeChar++; } } - if (kp->ScanCode == 0 && kp->UnicodeChar == 0) - return (false); - keybuf_inschar(kp); - return (true); } + /* + * The shift state and/or toggle state may not be valid, + * but we still can have ScanCode or UnicodeChar. + */ + if (kp->ScanCode == 0 && kp->UnicodeChar == 0) + return (false); + keybuf_inschar(kp); + return (true); } return (false); } diff --git a/usr/src/boot/sys/boot/i386/common/edd.h b/usr/src/boot/sys/boot/i386/common/edd.h index 7d1f45020f..53aa870c77 100644 --- a/usr/src/boot/sys/boot/i386/common/edd.h +++ b/usr/src/boot/sys/boot/i386/common/edd.h @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 2011 Hudson River Trading LLC * Written by: John H. Baldwin <jhb@FreeBSD.org> * All rights reserved. @@ -23,8 +23,6 @@ * 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. - * - * $FreeBSD$ */ #ifndef _EDD_H_ @@ -107,4 +105,7 @@ struct edd_params_v4 { #define EDD_DEVICE_PATH_KEY 0xbedd +#define EDD_QUERY_MAGIC 0x55aa +#define EDD_INSTALLED 0xaa55 + #endif /* !_EDD_H_ */ diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c index e1259509ad..84ab603de6 100644 --- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c +++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c @@ -63,6 +63,22 @@ #define ACDMAJOR 117 #define CDMAJOR 15 +/* + * INT13 commands + */ +#define CMD_RESET 0x0000 +#define CMD_READ_CHS 0x0200 +#define CMD_WRITE_CHS 0x0300 +#define CMD_READ_PARAM 0x0800 +#define CMD_DRIVE_TYPE 0x1500 +#define CMD_CHECK_EDD 0x4100 +#define CMD_READ_LBA 0x4200 +#define CMD_WRITE_LBA 0x4300 +#define CMD_EXT_PARAM 0x4800 +#define CMD_CD_GET_STATUS 0x4b01 + +#define DISK_BIOS 0x13 + #ifdef DISK_DEBUG #define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args) #else @@ -264,8 +280,8 @@ fd_count(void) for (drive = 0; drive < MAXBDDEV; drive++) { v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x1500; + v86.addr = DISK_BIOS; + v86.eax = CMD_DRIVE_TYPE; v86.edx = drive; v86int(); @@ -362,8 +378,8 @@ bc_add(int biosdev) return (-1); v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x4b01; + v86.addr = DISK_BIOS; + v86.eax = CMD_CD_GET_STATUS; v86.edx = biosdev; v86.ds = VTOPSEG(&bc_sp); v86.esi = VTOPOFF(&bc_sp); @@ -417,14 +433,14 @@ bd_check_extensions(int unit) /* Determine if we can use EDD with this device. */ v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x4100; + v86.addr = DISK_BIOS; + v86.eax = CMD_CHECK_EDD; v86.edx = unit; - v86.ebx = 0x55aa; + v86.ebx = EDD_QUERY_MAGIC; v86int(); if (V86_CY(v86.efl) || /* carry set */ - (v86.ebx & 0xffff) != 0xaa55) /* signature */ + (v86.ebx & 0xffff) != EDD_INSTALLED) /* signature */ return (0); /* extended disk access functions (AH=42h-44h,47h,48h) supported */ @@ -439,8 +455,8 @@ bd_reset_disk(int unit) { /* reset disk */ v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0; + v86.addr = DISK_BIOS; + v86.eax = CMD_RESET; v86.edx = unit; v86int(); } @@ -453,8 +469,8 @@ bd_get_diskinfo_std(struct bdinfo *bd) { bzero(&v86, sizeof (v86)); v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x800; + v86.addr = DISK_BIOS; + v86.eax = CMD_READ_PARAM; v86.edx = bd->bd_unit; v86int(); @@ -488,8 +504,8 @@ bd_get_diskinfo_ext(struct bdinfo *bd) bzero(¶ms, sizeof (params)); params.len = sizeof (params); v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x4800; + v86.addr = DISK_BIOS; + v86.eax = CMD_EXT_PARAM; v86.edx = bd->bd_unit; v86.ds = VTOPSEG(¶ms); v86.esi = VTOPOFF(¶ms); @@ -555,8 +571,8 @@ bd_int13probe(bdinfo_t *bd) /* Get disk type */ v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x1500; + v86.addr = DISK_BIOS; + v86.eax = CMD_DRIVE_TYPE; v86.edx = bd->bd_unit; v86int(); if (V86_CY(v86.efl) || (v86.eax & 0x300) == 0) @@ -1070,12 +1086,11 @@ bd_edd_io(bdinfo_t *bd, daddr_t dblk, int blks, caddr_t dest, packet.seg = VTOPSEG(dest); packet.lba = dblk; v86.ctl = V86_FLAGS; - v86.addr = 0x13; - /* Should we Write with verify ?? 0x4302 ? */ + v86.addr = DISK_BIOS; if (dowrite == BD_WR) - v86.eax = 0x4300; + v86.eax = CMD_WRITE_LBA; /* maybe Write with verify 0x4302? */ else - v86.eax = 0x4200; + v86.eax = CMD_READ_LBA; v86.edx = bd->bd_unit; v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); @@ -1107,11 +1122,11 @@ bd_chs_io(bdinfo_t *bd, daddr_t dblk, int blks, caddr_t dest, } v86.ctl = V86_FLAGS; - v86.addr = 0x13; + v86.addr = DISK_BIOS; if (dowrite == BD_WR) - v86.eax = 0x300 | blks; + v86.eax = CMD_WRITE_CHS | blks; else - v86.eax = 0x200 | blks; + v86.eax = CMD_READ_CHS | blks; v86.ecx = ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec; v86.edx = (hd << 8) | bd->bd_unit; v86.es = VTOPSEG(dest); @@ -1216,8 +1231,8 @@ bd_getbigeom(int bunit) { v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x800; + v86.addr = DISK_BIOS; + v86.eax = CMD_READ_PARAM; v86.edx = 0x80 + bunit; v86int(); if (V86_CY(v86.efl)) diff --git a/usr/src/cmd/acpi/iasl/Makefile b/usr/src/cmd/acpi/iasl/Makefile index 6e9de0d655..6e9eb753d3 100644 --- a/usr/src/cmd/acpi/iasl/Makefile +++ b/usr/src/cmd/acpi/iasl/Makefile @@ -126,6 +126,8 @@ $(LEX_C_FILES) := LEXFILE = $(LY_BASE).l $(LEX_C_FILES) := LEXFILE = $(LY_BASE).l $(YACC_FILES) := YTABC = $(LY_BASE)parse.c +$(YACC_C_FILES:.c=.o) := CERRWARN += -_gcc=-Wno-char-subscripts + OBJS += $(LEX_C_FILES:.c=.o) $(YACC_C_FILES:.c=.o) GM4FLAGS = -P @@ -162,6 +164,4 @@ clean: $(RM) $(OBJS) $(INTERMEDIATES) $(PROG) $(RM) -r AslCompiler.?????? DtParser.?????? PrParser.?????? -lint: lint_SRCS - include ../../Makefile.targ diff --git a/usr/src/cmd/zlogin/zlogin.c b/usr/src/cmd/zlogin/zlogin.c index 2c9d271abe..1b49fc221f 100644 --- a/usr/src/cmd/zlogin/zlogin.c +++ b/usr/src/cmd/zlogin/zlogin.c @@ -25,6 +25,7 @@ * Copyright 2016 Joyent, Inc. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2019 Joyent, Inc. + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -127,6 +128,8 @@ static int pollerr = 0; static const char *pname; static char *username; +extern int __xpg4; /* 0 if not an xpg4/6-compiled program */ + /* * When forced_login is true, the user is not prompted * for an authentication password in the target zone. @@ -833,8 +836,16 @@ process_output(int in_fd, int out_fd) cc = read(in_fd, ibuf, ZLOGIN_BUFSIZ); if (cc == -1 && (errno != EINTR || dead)) return (-1); - if (cc == 0) /* EOF */ - return (-1); + if (cc == 0) { + /* + * A return value of 0 when calling read() on a terminal + * indicates end-of-file pre-XPG4 and no data available + * for XPG4 and above. + */ + if (__xpg4 == 0) + return (-1); + return (0); + } if (cc == -1) /* The read was interrupted. */ return (0); @@ -854,10 +865,10 @@ process_output(int in_fd, int out_fd) /* * This is the main I/O loop, and is shared across all zlogin modes. * Parameters: - * stdin_fd: The fd representing 'stdin' for the slave side; input to + * stdin_fd: The fd representing 'stdin' for the slave side; input to * the zone will be written here. * - * appin_fd: The fd representing the other end of the 'stdin' pipe (when + * appin_fd: The fd representing the other end of the 'stdin' pipe (when * we're running non-interactive); used in process_raw_input * to ensure we don't fill up the application's stdin pipe. * diff --git a/usr/src/lib/auditd_plugins/remote/transport.c b/usr/src/lib/auditd_plugins/remote/transport.c index b8015bcbee..1525803b07 100644 --- a/usr/src/lib/auditd_plugins/remote/transport.c +++ b/usr/src/lib/auditd_plugins/remote/transport.c @@ -51,10 +51,10 @@ #include "audit_remote.h" -static int sockfd = -1; +static int sockfd = -1; static struct hostent *current_host; static gss_OID *current_mech_oid; -static in_port_t current_port; +static in_port_t current_port; static boolean_t flush_transq; static char *ver_str = "01"; /* supported protocol version */ @@ -100,11 +100,11 @@ static boolean_t transq_enqueue(transq_node_t **, gss_buffer_t, static int transq_retransmit(void); static boolean_t init_poll(int); -static void do_reset(int *, struct pollfd *, boolean_t); -static void do_cleanup(int *, struct pollfd *, boolean_t); +static void do_reset(int *, struct pollfd *, boolean_t); +static void do_cleanup(int *, struct pollfd *, boolean_t); static void init_recv_record(void); -static void recv_record(); +static void *recv_record(void *); static int connect_timeout(int, struct sockaddr *, int); static int send_timeout(int, const char *, size_t); static int recv_timeout(int, char *, size_t); @@ -933,8 +933,7 @@ static void init_recv_record() { DPRINT((dfile, "Initiating the recv thread\n")); - (void) pthread_create(&recv_tid, NULL, (void *(*)(void *))recv_record, - (void *)NULL); + (void) pthread_create(&recv_tid, NULL, recv_record, NULL); } @@ -942,8 +941,8 @@ init_recv_record() /* * recv_record() - the receiver thread routine */ -static void -recv_record() +static void * +recv_record(void *arg __unused) { OM_uint32 maj_stat, min_stat; gss_qop_t qop_state; @@ -1170,7 +1169,7 @@ recv_record() break; } /* switch (maj_stat) */ - } else { /* the failure case */ + } else { /* the failure case */ report_gss_err( gettext("signature verification of the " "received token failed"), diff --git a/usr/src/lib/libast/common/tm/tvsleep.c b/usr/src/lib/libast/common/tm/tvsleep.c index 46d3d6ac59..7ada03eacb 100644 --- a/usr/src/lib/libast/common/tm/tvsleep.c +++ b/usr/src/lib/libast/common/tm/tvsleep.c @@ -1,144 +1,48 @@ /*********************************************************************** -* * -* This software is part of the ast package * -* Copyright (c) 1985-2010 AT&T Intellectual Property * -* and is licensed under the * -* Common Public License, Version 1.0 * -* by AT&T Intellectual Property * -* * -* A copy of the License is available at * -* http://www.opensource.org/licenses/cpl1.0.txt * -* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * -* * -* Information and Software Systems Research * -* AT&T Research * -* Florham Park NJ * -* * -* Glenn Fowler <gsf@research.att.com> * -* David Korn <dgk@research.att.com> * -* Phong Vo <kpv@research.att.com> * -* * -***********************************************************************/ -#pragma prototyped - -#include <tv.h> -#include <tm.h> - -#include "FEATURE/tvlib" - -#if !_lib_nanosleep -# if _lib_select -# if _sys_select -# include <sys/select.h> -# else -# include <sys/socket.h> -# endif -# else -# if !_lib_usleep -# if _lib_poll_notimer -# undef _lib_poll -# endif -# if _lib_poll -# include <poll.h> -# endif -# endif -# endif -#endif + * * + * This software is part of the ast package * + * Copyright (c) 1985-2013 AT&T Intellectual Property * + * and is licensed under the * + * Eclipse Public License, Version 1.0 * + * by AT&T Intellectual Property * + * * + * A copy of the License is available at * + * http://www.eclipse.org/org/documents/epl-v10.html * + * (with md5 checksum b35adb5213ca9657e911e9befb180842) * + * * + * Information and Software Systems Research * + * AT&T Research * + * Florham Park NJ * + * * + * Glenn Fowler <glenn.s.fowler@gmail.com> * + * David Korn <dgkorn@gmail.com> * + * Phong Vo <phongvo@gmail.com> * + * * + ***********************************************************************/ + +#include <errno.h> +#include <time.h> + +#include "tv.h" /* * sleep for tv * non-zero exit if sleep did not complete * with remaining time in rv + * + * NOTE: some systems hide nanosleep() ouside of -lc -- puleeze */ -int -tvsleep(register const Tv_t* tv, register Tv_t* rv) -{ - -#if _lib_nanosleep - - struct timespec stv; - struct timespec srv; - int r; - - stv.tv_sec = tv->tv_sec; - stv.tv_nsec = tv->tv_nsec; - if ((r = nanosleep(&stv, &srv)) && rv) - { - rv->tv_sec = srv.tv_sec; - rv->tv_nsec = srv.tv_nsec; - } - return r; - -#else - -#if _lib_select - - struct timeval stv; - - stv.tv_sec = tv->tv_sec; - stv.tv_usec = tv->tv_nsec / 1000; - if (select(0, NiL, NiL, NiL, &stv) < 0) - { - if (rv) - *rv = *tv; - return -1; - } - if (rv) - { - rv->tv_sec = stv.tv_sec; - rv->tv_nsec = stv.tv_usec * 1000; - } - return 0; - -#else - - unsigned int s = tv->tv_sec; - uint32_t n = tv->tv_nsec; - -#if _lib_usleep - - - unsigned long t; - - if (t = (n + 999L) / 1000L) - { - usleep(t); - s -= t / 1000000L; - n = 0; - } - -#else - -#if _lib_poll - - struct pollfd pfd; - int t; - - if ((t = (n + 999999L) / 1000000L) > 0) - { - poll(&pfd, 0, t); - s -= t / 1000L; - n = 0; - } - -#endif - -#endif - - if ((s += (n + 999999999L) / 1000000000L) && (s = sleep(s))) - { - if (rv) - { - rv->tv_sec = s; - rv->tv_nsec = 0; - } - return -1; - } - return 0; - -#endif - -#endif - +int tvsleep(const Tv_t *tv, Tv_t *rv) { + struct timespec stv; + struct timespec srv; + int r; + + stv.tv_sec = tv->tv_sec; + stv.tv_nsec = tv->tv_nsec; + if ((r = nanosleep(&stv, &srv)) && errno == EINTR && rv) { + rv->tv_sec = srv.tv_sec; + rv->tv_nsec = srv.tv_nsec; + } + return r; } diff --git a/usr/src/lib/libldap5/sources/ldap/common/open.c b/usr/src/lib/libldap5/sources/ldap/common/open.c index c97685f223..d10802a26b 100644 --- a/usr/src/lib/libldap5/sources/ldap/common/open.c +++ b/usr/src/lib/libldap5/sources/ldap/common/open.c @@ -34,7 +34,7 @@ */ #if 0 -#ifndef lint +#ifndef lint static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n"; #endif #endif @@ -82,7 +82,7 @@ struct nsldapi_ldap_error { #else __declspec ( thread ) int nsldapi_gldaperrno; __declspec ( thread ) char *nsldapi_gmatched = NULL; -__declspec ( thread ) char *nsldapi_gldaperror = NULL; +__declspec ( thread ) char *nsldapi_gldaperror = NULL; #endif /* _WINDOWS */ #ifdef _WINDOWS @@ -245,18 +245,18 @@ get_ld_error( char **matched, char **errmsg, void *dummy ) le = pthread_getspecific( nsldapi_key ); if (le != NULL) { - if ( matched != NULL ) { - *matched = le->le_matched; - } - if ( errmsg != NULL ) { - *errmsg = le->le_errmsg; - } - return( le->le_errno ); + if ( matched != NULL ) { + *matched = le->le_matched; + } + if ( errmsg != NULL ) { + *errmsg = le->le_errmsg; + } + return( le->le_errno ); } else { - if ( matched != NULL ) - *matched = NULL; - if ( errmsg != NULL ) - *errmsg = NULL; + if ( matched != NULL ) + *matched = NULL; + if ( errmsg != NULL ) + *errmsg = NULL; } return (LDAP_SUCCESS); } @@ -292,7 +292,7 @@ static struct ldap_extra_thread_fns #ifdef _WINDOWS 0 #else - (void *(*)(void))pthread_self + (void *(*)(void))(uintptr_t)pthread_self #endif /* _WINDOWS */ }; @@ -393,8 +393,8 @@ ldap_version( LDAPVersion *ver ) ver->sdk_version = (int)(VI_PRODUCTVERSION * 100); ver->protocol_version = LDAP_VERSION_MAX * 100; ver->SSL_version = SSL_VERSION * 100; - /* - * set security to none by default + /* + * set security to none by default */ ver->security_level = LDAP_SECURITY_NONE; @@ -710,7 +710,7 @@ ldap_x_hostlist_next( char **hostp, int *portp, status->lhs_nexthost = NULL; } - /* + /* * Look for closing ']' and skip past it before looking for port. */ if ( squarebrackets && NULL != ( q = strchr( *hostp, ']' ))) { diff --git a/usr/src/lib/libpctx/common/libpctx.c b/usr/src/lib/libpctx/common/libpctx.c index ec10bbcb69..2a6c9d963d 100644 --- a/usr/src/lib/libpctx/common/libpctx.c +++ b/usr/src/lib/libpctx/common/libpctx.c @@ -301,21 +301,23 @@ pctx_set_events(pctx_t *pctx, ...) return (error); if (pctx->exec == NULL) - pctx->exec = (pctx_sysc_execfn_t *)default_int; + pctx->exec = (pctx_sysc_execfn_t *)(uintptr_t)default_int; if (pctx->fork == NULL) - pctx->fork = (pctx_sysc_forkfn_t *)default_void; + pctx->fork = (pctx_sysc_forkfn_t *)(uintptr_t)default_void; if (pctx->exit == NULL) - pctx->exit = (pctx_sysc_exitfn_t *)default_void; + pctx->exit = (pctx_sysc_exitfn_t *)(uintptr_t)default_void; if (pctx->lwp_create == NULL) - pctx->lwp_create = (pctx_sysc_lwp_createfn_t *)default_int; + pctx->lwp_create = (pctx_sysc_lwp_createfn_t *) + (uintptr_t)default_int; if (pctx->init_lwp == NULL) - pctx->init_lwp = (pctx_init_lwpfn_t *)default_int; + pctx->init_lwp = (pctx_init_lwpfn_t *)(uintptr_t)default_int; if (pctx->fini_lwp == NULL) - pctx->fini_lwp = (pctx_fini_lwpfn_t *)default_int; + pctx->fini_lwp = (pctx_fini_lwpfn_t *)(uintptr_t)default_int; if (pctx->lwp_exit == NULL) - pctx->lwp_exit = (pctx_sysc_lwp_exitfn_t *)default_int; + pctx->lwp_exit = (pctx_sysc_lwp_exitfn_t *) + (uintptr_t)default_int; - if (pctx->fork != (pctx_sysc_forkfn_t *)default_void) { + if ((uintptr_t)pctx->fork != (uintptr_t)default_void) { (void) Psysexit(pctx->Pr, SYS_vfork, 1); (void) Psysexit(pctx->Pr, SYS_forksys, 1); if (Psetflags(pctx->Pr, PR_FORK) == -1) @@ -331,9 +333,9 @@ pctx_set_events(pctx_t *pctx, ...) * exec causes termination of all but the exec-ing lwp, * and resets the lwpid to one in the new address space. */ - if (pctx->exec != (pctx_sysc_execfn_t *)default_int || - pctx->fini_lwp != (pctx_fini_lwpfn_t *)default_int || - pctx->init_lwp != (pctx_init_lwpfn_t *)default_int) { + if ((uintptr_t)pctx->exec != (uintptr_t)default_int || + (uintptr_t)pctx->fini_lwp != (uintptr_t)default_int || + (uintptr_t)pctx->init_lwp != (uintptr_t)default_int) { (void) Psysexit(pctx->Pr, SYS_execve, 1); (void) Psysentry(pctx->Pr, SYS_execve, 1); } else { @@ -342,12 +344,12 @@ pctx_set_events(pctx_t *pctx, ...) } (void) Psysexit(pctx->Pr, SYS_lwp_create, - pctx->lwp_create != (pctx_sysc_lwp_createfn_t *)default_int || - pctx->init_lwp != (pctx_init_lwpfn_t *)default_int); + (uintptr_t)pctx->lwp_create != (uintptr_t)default_int || + (uintptr_t)pctx->init_lwp != (uintptr_t)default_int); (void) Psysentry(pctx->Pr, SYS_lwp_exit, - pctx->lwp_exit != (pctx_sysc_lwp_exitfn_t *)default_int || - pctx->fini_lwp != (pctx_fini_lwpfn_t *)default_int); + (uintptr_t)pctx->lwp_exit != (uintptr_t)default_int || + (uintptr_t)pctx->fini_lwp != (uintptr_t)default_int); return (0); } @@ -407,7 +409,7 @@ pctx_lwpiterate(pctx_t *pctx, int (*action)(pctx_t *, pid_t, id_t, void *)) int fd, nlwp; int ret = 0; - if (action == (int (*)(pctx_t *, pid_t, id_t, void *))default_int) + if ((uintptr_t)action == (uintptr_t)default_int) return (0); pstatus = Pstatus(pctx->Pr); @@ -722,8 +724,8 @@ checkstate: running = -1; break; } - if (pctx->exec == (pctx_sysc_execfn_t *) - default_int) { + if ((uintptr_t)pctx->exec == + (uintptr_t)default_int) { running = 0; break; } diff --git a/usr/src/lib/libshell/common/bltins/sleep.c b/usr/src/lib/libshell/common/bltins/sleep.c index 6121cfe62b..8938dc536c 100644 --- a/usr/src/lib/libshell/common/bltins/sleep.c +++ b/usr/src/lib/libshell/common/bltins/sleep.c @@ -1,22 +1,22 @@ /*********************************************************************** -* * -* This software is part of the ast package * -* Copyright (c) 1982-2010 AT&T Intellectual Property * -* and is licensed under the * -* Common Public License, Version 1.0 * -* by AT&T Intellectual Property * -* * -* A copy of the License is available at * -* http://www.opensource.org/licenses/cpl1.0.txt * -* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * -* * -* Information and Software Systems Research * -* AT&T Research * -* Florham Park NJ * -* * -* David Korn <dgk@research.att.com> * -* * -***********************************************************************/ + * * + * This software is part of the ast package * + * Copyright (c) 1982-2013 AT&T Intellectual Property * + * and is licensed under the * + * Eclipse Public License, Version 1.0 * + * by AT&T Intellectual Property * + * * + * A copy of the License is available at * + * http://www.eclipse.org/org/documents/epl-v10.html * + * (with md5 checksum b35adb5213ca9657e911e9befb180842) * + * * + * Information and Software Systems Research * + * AT&T Research * + * Florham Park NJ * + * * + * David Korn <dgkorn@gmail.com> * + * * + ***********************************************************************/ #pragma prototyped /* * sleep delay @@ -156,70 +156,18 @@ unsigned int sleep(unsigned int sec) return(0); } -/* - * delay execution for time <t> - */ +// +// Delay execution for time <t>. +// +void sh_delay(double t) { + Shell_t *shp = sh_getinterp(); + int n = (int)t; + Tv_t ts, tx; -void sh_delay(double t) -{ - register int n = (int)t; - Shell_t *shp = &sh; -#ifdef _lib_poll - struct pollfd fd; - if(t<=0) - return; - else if(n > 30) - { - sleep(n); - t -= n; - } - if(n=(int)(1000*t)) - { - if(!shp->waitevent || (*shp->waitevent)(-1,(long)n,0)==0) - poll(&fd,0,n); - } -#else -# if defined(_lib_select) && defined(_mem_tv_usec_timeval) - struct timeval timeloc; - if(t<=0) - return; - if(n=(int)(1000*t) && shp->waitevent && (*shp->waitevent)(-1,(long)n,0)) - return; - n = (int)t; - timeloc.tv_sec = n; - timeloc.tv_usec = 1000000*(t-(double)n); - select(0,(fd_set*)0,(fd_set*)0,(fd_set*)0,&timeloc); -# else -# ifdef _lib_select - /* for 9th edition machines */ - if(t<=0) - return; - if(n > 30) - { - sleep(n); - t -= n; - } - if(n=(int)(1000*t)) - { - if(!shp->waitevent || (*shp->waitevent)(-1,(long)n,0)==0) - select(0,(fd_set*)0,(fd_set*)0,n); - } -# else - struct tms tt; - if(t<=0) - return; - sleep(n); - t -= n; - if(t) - { - clock_t begin = times(&tt); - if(begin==0) - return; - t *= shp->lim.clk_tck; - n += (t+.5); - while((times(&tt)-begin) < n); - } -# endif -# endif -#endif /* _lib_poll */ + ts.tv_sec = n; + ts.tv_nsec = 1000000000 * (t - (double)n); + while (tvsleep(&ts, &tx) < 0 && errno == EINTR) { + if (shp->trapnote & (SH_SIGSET | SH_SIGTRAP)) return; + ts = tx; + } } diff --git a/usr/src/uts/common/fs/zfs/vdev_disk.c b/usr/src/uts/common/fs/zfs/vdev_disk.c index c674dbf811..20df3f306b 100644 --- a/usr/src/uts/common/fs/zfs/vdev_disk.c +++ b/usr/src/uts/common/fs/zfs/vdev_disk.c @@ -40,9 +40,9 @@ #include <sys/fm/fs/zfs.h> /* - * Tunable to enable TRIM, which is temporarily disabled by default. + * Tunable to disable TRIM in case we're using a problematic SSD. */ -uint_t zfs_no_trim = 1; +uint_t zfs_no_trim = 0; /* * Tunable parameter for debugging or performance analysis. Setting this diff --git a/usr/src/uts/common/io/sata/impl/sata.c b/usr/src/uts/common/io/sata/impl/sata.c index 617aa8ea5a..e9279025e1 100644 --- a/usr/src/uts/common/io/sata/impl/sata.c +++ b/usr/src/uts/common/io/sata/impl/sata.c @@ -25,7 +25,7 @@ /* * Copyright 2017 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Argo Technologies SA - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -4759,17 +4759,25 @@ sata_txlt_read_capacity16(sata_pkt_txlate_t *spx) /* logical blocks per physical block exponent */ rbuf[13] = l2p_exp; - /* lowest aligned logical block address = 0 (for now) */ - /* tpe and tprz as defined in T10/10-079 r0 */ - if (sdinfo->satadrv_id.ai_addsupported & - SATA_DETERMINISTIC_READ) { - if (sdinfo->satadrv_id.ai_addsupported & - SATA_READ_ZERO) { + /* + * tpe and tprz as defined in T10/10-079 r0. + * TRIM support is indicated by the relevant bit in the data + * set management word. Read-after-trim behavior is indicated + * by the additional bits in the identify device word. Of the + * three defined possibilities, we only flag read-zero. + */ + if (sdinfo->satadrv_id.ai_dsm & SATA_DSM_TRIM) { + rbuf[14] |= TPE; + + if ((sdinfo->satadrv_id.ai_addsupported & + SATA_DETERMINISTIC_READ) && + (sdinfo->satadrv_id.ai_addsupported & + SATA_READ_ZERO)) { rbuf[14] |= TPRZ; - } else { - rbuf[14] |= TPE; } } + + /* lowest aligned logical block address = 0 (for now) */ /* rbuf[15] = 0; */ scsipkt->pkt_state |= STATE_XFERRED_DATA; diff --git a/usr/src/uts/common/sys/sata/sata_defs.h b/usr/src/uts/common/sys/sata/sata_defs.h index 049b42d60c..f3a3a1d481 100644 --- a/usr/src/uts/common/sys/sata/sata_defs.h +++ b/usr/src/uts/common/sys/sata/sata_defs.h @@ -22,6 +22,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ #ifndef _SATA_DEFS_H @@ -344,6 +345,9 @@ typedef struct sata_id { #define SATA_UDMA_SUP_MASK 0x007f /* UDMA modes supported */ #define SATA_UDMA_SEL_MASK 0x7f00 /* UDMA modes selected */ +/* Data Set Management: word 169 */ +#define SATA_DSM_TRIM 0x0001 /* Set when TRIM is supported */ + /* Identify Device: command set supported/enabled bits - word 206 */ /* All are SCT Command Transport support */ |
