diff options
author | John Levon <john.levon@joyent.com> | 2020-08-13 15:27:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 15:27:11 +0100 |
commit | e63d036fd36b5642d5e199f7d9895d8d4eda6072 (patch) | |
tree | 0c177a62e8bd3796a7b530b7520fb0a4e7d0cd56 /usr/src/lib | |
parent | a8ff5009e5f7ea544c79b60ea65577f19304ff0b (diff) | |
parent | 09f210323354e07890b312da9b4f5e33ae6b6df5 (diff) | |
download | illumos-joyent-sasinfo.tar.gz |
Merge branch 'master' into sasinfosasinfo
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/Makefile | 1 | ||||
-rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/signal.c | 14 | ||||
-rw-r--r-- | usr/src/lib/libsys/Makefile | 43 | ||||
-rw-r--r-- | usr/src/lib/libsys/Makefile.com | 36 | ||||
-rw-r--r-- | usr/src/lib/libsys/Makefile.targ | 39 | ||||
-rw-r--r-- | usr/src/lib/libsys/common/libsys.sh | 53 | ||||
-rw-r--r-- | usr/src/lib/libsys/common/mapfile-vers | 451 | ||||
-rw-r--r-- | usr/src/lib/libsys/i386/Makefile | 37 | ||||
-rw-r--r-- | usr/src/lib/libsys/i386/libsys.list | 192 | ||||
-rw-r--r-- | usr/src/lib/libsys/sparc/Makefile | 38 | ||||
-rw-r--r-- | usr/src/lib/libsys/sparc/libsys.list | 207 | ||||
-rw-r--r-- | usr/src/lib/libsys/sparc/libsys.sh | 39 | ||||
-rw-r--r-- | usr/src/lib/libsys/sparc/libsyss.list | 10 | ||||
-rw-r--r-- | usr/src/lib/libvmm/libvmm.c | 30 | ||||
-rw-r--r-- | usr/src/lib/libzfs/common/libzfs_import.c | 49 | ||||
-rw-r--r-- | usr/src/lib/libzutil/common/zutil_import.c | 11 |
16 files changed, 89 insertions, 1161 deletions
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile index a0221ca855..4afeeacfd7 100644 --- a/usr/src/lib/Makefile +++ b/usr/src/lib/Makefile @@ -227,7 +227,6 @@ SUBDIRS += \ libstmfproxy \ libsum \ libsun_ima \ - libsys \ libsysevent \ libtecla \ libtermcap \ diff --git a/usr/src/lib/brand/lx/lx_brand/common/signal.c b/usr/src/lib/brand/lx/lx_brand/common/signal.c index 74abff9c8c..b83a60380d 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/signal.c +++ b/usr/src/lib/brand/lx/lx_brand/common/signal.c @@ -26,6 +26,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #include <sys/types.h> @@ -2400,10 +2401,21 @@ lx_signalfd4(int fd, uintptr_t mask, size_t msize, int flags) return (r == -1 ? -errno : r); } +/* + * Since this brackets vfork, we also use it as a synchronisation point to + * prevent multiple vfork() calls occuring in parallel. This is necessary + * because vfork() on illumos is not MT-safe whereas it is on Linux (with + * caveats). + * + * Some real-world applications (java in particular) can run multiple vfork() + * calls in parallel across different threads and they need to be serialised + * in the lx brand. + */ void lx_block_all_signals() { - (void) syscall(SYS_brand, B_BLOCK_ALL_SIGS); + while (syscall(SYS_brand, B_BLOCK_ALL_SIGS) != 0 && errno == EAGAIN) + yield(); } void diff --git a/usr/src/lib/libsys/Makefile b/usr/src/lib/libsys/Makefile deleted file mode 100644 index f956efa735..0000000000 --- a/usr/src/lib/libsys/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include ../Makefile.lib - -SUBDIRS = $(MACH) - -all := TARGET= all -clean := TARGET= clean -clobber := TARGET= clobber -install := TARGET= install - -.KEEP_STATE: - -all clean clobber install: $(SUBDIRS) - - -$(SUBDIRS): FRC - @cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/lib/libsys/Makefile.com b/usr/src/lib/libsys/Makefile.com deleted file mode 100644 index cd829c5c1b..0000000000 --- a/usr/src/lib/libsys/Makefile.com +++ /dev/null @@ -1,36 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. -# - -LIBRARY = libsys.a -VERS = .1 - -# Define libsys to be a filter on libc. The ABI requires the runtime linker as -# the soname. -SONAME = /usr/lib/ld.so.1 -DYNFLAGS += -F /usr/lib/libc.so.1 - -COMSRC = $(COMOBJ:%.o=%.c) -MACHSRC = $(MACHOBJ:%.o=%.s) - -CLOBBERFILES += $(COMSRC) $(MACHSRC) diff --git a/usr/src/lib/libsys/Makefile.targ b/usr/src/lib/libsys/Makefile.targ deleted file mode 100644 index e025958f2f..0000000000 --- a/usr/src/lib/libsys/Makefile.targ +++ /dev/null @@ -1,39 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# Copyright 2019 Peter Tribble. -# - -BUILD.SO += $(PICS) - -$(COMSRC): ../common/libsys.sh libsys.list - sh ../common/libsys.sh - -$(MACHSRC): libsys.sh libsyss.list - sh ./libsys.sh - -pics/%.o := ASFLAGS += $(AS_PICFLAGS) - -pics/%.o: %.s - $(COMPILE.s) -o $@ $< - $(POST_PROCESS_S_O) diff --git a/usr/src/lib/libsys/common/libsys.sh b/usr/src/lib/libsys/common/libsys.sh deleted file mode 100644 index 4da1d42b66..0000000000 --- a/usr/src/lib/libsys/common/libsys.sh +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -#ident "%Z%%M% %I% %E% SMI" - -# Stub library for programmer's interface to libsys. Used to satisfy ld(1) -# processing, and serves as a precedence place-holder at execution-time. - -awk ' -/.*/ { - if ($2 == "1") { - printf("#pragma weak %s = _%s\n", $3, $3); - flag = "_"; - } else - flag = ""; - if ($1 == "f") { - printf("void *\n%s%s()\n{\n", flag, $3); - printf("\t/*NOTREACHED*/\n\treturn (0);\n}\n\n"); - } else { - if ($4 == "1") - printf("%s %s%s %s %s\n\n", $5, flag, $3, $6, $7); - else if ($4 == "2") - printf("%s %s %s%s %s %s\n\n", $5, $6, flag, $3, $7, $8); - else if ($4 == "3") - printf("%s %s %s%s%s %s %s %s\n\n", $5, $6, flag, $3, $7, $8, $9, $10); - } -} -' libsys.list > libsys.c diff --git a/usr/src/lib/libsys/common/mapfile-vers b/usr/src/lib/libsys/common/mapfile-vers deleted file mode 100644 index c847354409..0000000000 --- a/usr/src/lib/libsys/common/mapfile-vers +++ /dev/null @@ -1,451 +0,0 @@ -# -# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# 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 - -$if !_ELF32 -$error libsys is only supported in 32-bit form -$endif - -$if _sparc -SYMBOL_VERSION SISCD_2.3 { - global: - SISCD_2.3; -} SYSVABI_1.3; -$endif - -SYMBOL_VERSION SYSVABI_1.3 { - global: - _makecontext; - makecontext; - _swapcontext; - swapcontext; - local: - *; -} SYSVABI_1.2; - -SYMBOL_VERSION SYSVABI_1.2 { - global: - _access; - access; - _acct; - acct; - _alarm; - alarm; - _altzone; - atexit; - calloc; - _catclose; - catclose; - _catgets; - catgets; - _catopen; - catopen; - _chdir; - chdir; - _chmod; - chmod; - _chown; - chown; - _chroot; - chroot; - _close; - close; - _closedir; - closedir; - _creat; - creat; - __ctype; - _daylight; - daylight; - _dup; - dup; - _environ; - environ; - _execl; - execl; - _execle; - execle; - _execlp; - execlp; - _execv; - execv; - _execve; - execve; - _execvp; - execvp; - _exit; - exit; - _fattach; - fattach; - _fchdir; - fchdir; - _fchmod; - fchmod; - _fchown; - fchown; - _fcntl; - fcntl; - _fdetach; - fdetach; - _fork; - fork; - _fpathconf; - fpathconf; - free; - _fstat; - fstat; - _fstatvfs; - fstatvfs; - _fsync; - fsync; - _ftok; - ftok; - _getcontext; - getcontext; - _getcwd; - getcwd; - _getegid; - getegid; - _geteuid; - geteuid; - _getgid; - getgid; - _getgrgid; - getgrgid; - _getgrnam; - getgrnam; - _getgroups; - getgroups; - _getlogin; - getlogin; - _getmsg; - getmsg; - _getpgid; - getpgid; - _getpgrp; - getpgrp; - _getpid; - getpid; - _getpmsg; - getpmsg; - _getppid; - getppid; - _getpwnam; - getpwnam; - _getpwuid; - getpwuid; - _getrlimit; - getrlimit; - _getsid; - getsid; - _gettxt; - gettxt; - _getuid; - getuid; - _grantpt; - grantpt; - __huge_val; - _initgroups; - initgroups; - _ioctl; - ioctl; - _isastream; - isastream; - _kill; - kill; - _lchown; - lchown; - _link; - link; - localeconv; - _lseek; - lseek; - _lstat; - lstat; - malloc; - _memcntl; - memcntl; - _mkdir; - mkdir; - _mknod; - mknod; - _mlock; - mlock; - mmap; - _mount; - mount; - _mprotect; - mprotect; - _msgctl; - msgctl; - _msgget; - msgget; - _msgrcv; - msgrcv; - _msgsnd; - msgsnd; - _msync; - msync; - _munlock; - munlock; - _munmap; - munmap; - _nice; - nice; - _numeric; - _open; - open; - _opendir; - opendir; - _pathconf; - pathconf; - _pause; - pause; - _pipe; - pipe; - _poll; - poll; - _profil; - profil; - _ptrace; - ptrace; - _ptsname; - ptsname; - _putmsg; - putmsg; - _putpmsg; - putpmsg; - _read; - read; - _readdir; - readdir; - _readlink; - readlink; - _readv; - readv; - realloc; - remove; - _rename; - rename; - _rewinddir; - rewinddir; - _rmdir; - rmdir; - _seekdir; - seekdir; - _semctl; - semctl; - _semget; - semget; - _semop; - semop; - _setcontext; - setcontext; - _setgid; - setgid; - _setgroups; - setgroups; - setlocale; - _setpgid; - setpgid; - _setpgrp; - setpgrp; - _setrlimit; - setrlimit; - _setsid; - setsid; - _setuid; - setuid; - _shmat; - shmat; - _shmctl; - shmctl; - _shmdt; - shmdt; - _shmget; - shmget; - _sigaction; - sigaction; - _sigaddset; - sigaddset; - _sigaltstack; - sigaltstack; - _sigdelset; - sigdelset; - _sigemptyset; - sigemptyset; - _sigfillset; - sigfillset; - _sighold; - sighold; - _sigignore; - sigignore; - _sigismember; - sigismember; - _siglongjmp; - siglongjmp; - signal; - _sigpause; - sigpause; - _sigpending; - sigpending; - _sigprocmask; - sigprocmask; - _sigrelse; - sigrelse; - _sigsend; - sigsend; - _sigsendset; - sigsendset; - _sigset; - sigset; - _sigsetjmp; - sigsetjmp; - _sigsuspend; - sigsuspend; - _stat; - stat; - _statvfs; - statvfs; - _stime; - stime; - strcoll; - strerror; - strftime; - strxfrm; - _symlink; - symlink; - _sync; - sync; - _sysconf; - sysconf; - system; - _telldir; - telldir; - _time; - time; - _times; - times; - _timezone; - timezone; - _ttyname; - ttyname; - _tzname; - tzname; - _ulimit; - ulimit; - _umask; - umask; - _umount; - umount; - _uname; - uname; - _unlink; - unlink; - _unlockpt; - unlockpt; - _utime; - utime; - _wait; - wait; - _waitid; - waitid; - _waitpid; - waitpid; - _write; - write; - _writev; - writev; - -$if _sparc - # Sparc-only interfaces - _Q_add; - _Q_cmp; - _Q_cmpe; - _Q_div; - _Q_dtoq; - _Q_feq; - _Q_fge; - _Q_fgt; - _Q_fle; - _Q_flt; - _Q_fne; - _Q_itoq; - _Q_mul; - _Q_neg; - _Q_qtod; - _Q_qtoi; - _Q_qtos; - _Q_qtou; - _Q_sqrt; - _Q_stoq; - _Q_sub; - _Q_utoq; - .div; - __dtou; - __ftou; - _mmap { FLAGS = NODYNSORT }; - .mul; - .rem; - .stret1; - .stret2; - .stret4; - .stret8; - .udiv; - .umul; - .urem; -$endif - -$if _x86 - # X86-only interfaces - __flt_rounds; - _fp_hw; - _fpstart; - _fxstat; - _lxstat; - _mmap; - _nuname; - nuname; - _sbrk; - sbrk; - _xmknod; - _xstat; -$endif - - -}; diff --git a/usr/src/lib/libsys/i386/Makefile b/usr/src/lib/libsys/i386/Makefile deleted file mode 100644 index 6e0d26d1db..0000000000 --- a/usr/src/lib/libsys/i386/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# Define objects first to trigger $(PIC) rules in Makefile.lib - -COMOBJ = libsys.o -OBJECTS = $(COMOBJ) - -include $(SRC)/lib/Makefile.filter.com -include ../Makefile.com - -install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) - -include $(SRC)/lib/Makefile.filter.targ -include ../Makefile.targ diff --git a/usr/src/lib/libsys/i386/libsys.list b/usr/src/lib/libsys/i386/libsys.list deleted file mode 100644 index 847377f256..0000000000 --- a/usr/src/lib/libsys/i386/libsys.list +++ /dev/null @@ -1,192 +0,0 @@ -f 1 access -f 1 acct -f 1 alarm -f 1 catclose -f 1 catgets -f 1 catopen -f 1 chdir -f 1 chmod -f 1 chown -f 1 chroot -f 1 close -f 1 closedir -f 1 creat -f 1 dup -f 1 execl -f 1 execle -f 1 execlp -f 1 execv -f 1 execve -f 1 execvp -f 1 fattach -f 1 fchdir -f 1 fchmod -f 1 fchown -f 1 fcntl -f 1 fdetach -f 1 fork -f 1 fpathconf -f 1 fstat -f 1 fstatvfs -f 1 fsync -f 1 ftok -f 1 getcontext -f 1 getcwd -f 1 getegid -f 1 geteuid -f 1 getgid -f 1 getgrgid -f 1 getgrnam -f 1 getgroups -f 1 getlogin -f 1 getmsg -f 1 getpgid -f 1 getpgrp -f 1 getpid -f 1 getpmsg -f 1 getppid -f 1 getpwnam -f 1 getpwuid -f 1 getrlimit -f 1 getsid -f 1 gettxt -f 1 getuid -f 1 grantpt -f 1 initgroups -f 1 ioctl -f 1 isastream -f 1 kill -f 1 lchown -f 1 link -f 1 lseek -f 1 lstat -f 1 makecontext -f 1 memcntl -f 1 mkdir -f 1 mknod -f 1 mlock -f 1 mmap -f 1 mount -f 1 mprotect -f 1 msgctl -f 1 msgget -f 1 msgrcv -f 1 msgsnd -f 1 msync -f 1 munlock -f 1 munmap -f 1 nuname -f 1 nice -f 1 open -f 1 opendir -f 1 pathconf -f 1 pause -f 1 pipe -f 1 poll -f 1 profil -f 1 ptrace -f 1 ptsname -f 1 putmsg -f 1 putpmsg -f 1 read -f 1 readdir -f 1 readlink -f 1 readv -f 1 rename -f 1 rewinddir -f 1 rmdir -f 1 sbrk -f 1 seekdir -f 1 semctl -f 1 semget -f 1 semop -f 1 setcontext -f 1 setgid -f 1 setgroups -f 1 setpgid -f 1 setpgrp -f 1 setrlimit -f 1 setsid -f 1 setuid -f 1 shmat -f 1 shmctl -f 1 shmdt -f 1 shmget -f 1 sigaction -f 1 sigaddset -f 1 sigaltstack -f 1 sigdelset -f 1 sigemptyset -f 1 sigfillset -f 1 sighold -f 1 sigignore -f 1 sigismember -f 1 siglongjmp -f 1 sigpause -f 1 sigpending -f 1 sigprocmask -f 1 sigrelse -f 1 sigsend -f 1 sigsendset -f 1 sigset -f 1 sigsetjmp -f 1 sigsuspend -f 1 stat -f 1 statvfs -f 1 stime -f 1 swapcontext -f 1 symlink -f 1 sync -f 1 sysconf -f 1 telldir -f 1 time -f 1 times -f 1 ttyname -f 1 ulimit -f 1 umask -f 1 umount -f 1 uname -f 1 unlink -f 1 unlockpt -f 1 utime -f 1 wait -f 1 waitid -f 1 waitpid -f 1 write -f 1 writev - -f 0 atexit -f 0 calloc -f 0 exit -f 0 _exit -f 0 free -f 0 localeconv -f 0 malloc -f 0 realloc -f 0 remove -f 0 setlocale -f 0 signal -f 0 strcoll -f 0 strerror -f 0 strftime -f 0 strxfrm -f 0 system -f 0 _fxstat -f 0 _lxstat -f 0 _xmknod -f 0 _xstat -f 0 _fpstart - -d 0 _altzone 1 long = 0; -d 0 __ctype[257+257+7] 2 unsigned char = {0}; -d 0 _numeric[2] 2 unsigned char = {0}; - -d 1 daylight 1 int = 0; -d 1 timezone 1 long = 0; -d 1 tzname 3 char * [2] = {(char*)0,(char*)0}; - -d 1 environ 2 char ** = 0; - -d 0 __huge_val[2] 2 unsigned long = {0x7ff00000,0x0}; -d 0 __flt_rounds 1 long = 0; -d 0 _fp_hw 1 long = 3; diff --git a/usr/src/lib/libsys/sparc/Makefile b/usr/src/lib/libsys/sparc/Makefile deleted file mode 100644 index 249cb75708..0000000000 --- a/usr/src/lib/libsys/sparc/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# Define objects first to trigger $(PIC) rules in Makefile.lib - -COMOBJ = libsys.o -MACHOBJ = libsyss.o -OBJECTS = $(COMOBJ) $(MACHOBJ) - -include $(SRC)/lib/Makefile.filter.com -include ../Makefile.com - -install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) - -include $(SRC)/lib/Makefile.filter.targ -include ../Makefile.targ diff --git a/usr/src/lib/libsys/sparc/libsys.list b/usr/src/lib/libsys/sparc/libsys.list deleted file mode 100644 index 9f9dde7e55..0000000000 --- a/usr/src/lib/libsys/sparc/libsys.list +++ /dev/null @@ -1,207 +0,0 @@ -f 1 access -f 1 acct -f 1 alarm -f 1 catclose -f 1 catgets -f 1 catopen -f 1 chdir -f 1 chmod -f 1 chown -f 1 chroot -f 1 close -f 1 closedir -f 1 creat -f 1 dup -f 1 execl -f 1 execle -f 1 execlp -f 1 execv -f 1 execve -f 1 execvp -f 1 fattach -f 1 fchdir -f 1 fchmod -f 1 fchown -f 1 fcntl -f 1 fdetach -f 1 fork -f 1 fpathconf -f 1 fstat -f 1 fstatvfs -f 1 fsync -f 1 ftok -f 1 getcontext -f 1 getcwd -f 1 getegid -f 1 geteuid -f 1 getgid -f 1 getgrgid -f 1 getgrnam -f 1 getgroups -f 1 getlogin -f 1 getmsg -f 1 getpgid -f 1 getpgrp -f 1 getpid -f 1 getpmsg -f 1 getppid -f 1 getpwnam -f 1 getpwuid -f 1 getrlimit -f 1 getsid -f 1 gettxt -f 1 getuid -f 1 grantpt -f 1 initgroups -f 1 ioctl -f 1 isastream -f 1 kill -f 1 lchown -f 1 link -f 1 lseek -f 1 lstat -f 1 makecontext -f 1 memcntl -f 1 mkdir -f 1 mknod -f 1 mlock -f 1 mmap -f 1 mount -f 1 mprotect -f 1 msgctl -f 1 msgget -f 1 msgrcv -f 1 msgsnd -f 1 msync -f 1 munlock -f 1 munmap -f 1 nice -f 1 open -f 1 opendir -f 1 pathconf -f 1 pause -f 1 pipe -f 1 poll -f 1 profil -f 1 ptrace -f 1 ptsname -f 1 putmsg -f 1 putpmsg -f 1 read -f 1 readdir -f 1 readlink -f 1 readv -f 1 rename -f 1 rewinddir -f 1 rmdir -f 1 seekdir -f 1 semctl -f 1 semget -f 1 semop -f 1 setcontext -f 1 setgid -f 1 setgroups -f 1 setpgid -f 1 setpgrp -f 1 setrlimit -f 1 setsid -f 1 setuid -f 1 shmat -f 1 shmctl -f 1 shmdt -f 1 shmget -f 1 sigaction -f 1 sigaddset -f 1 sigaltstack -f 1 sigdelset -f 1 sigemptyset -f 1 sigfillset -f 1 sighold -f 1 sigignore -f 1 sigismember -f 1 siglongjmp -f 1 sigpause -f 1 sigpending -f 1 sigprocmask -f 1 sigrelse -f 1 sigsend -f 1 sigsendset -f 1 sigset -f 1 sigsetjmp -f 1 sigsuspend -f 1 stat -f 1 statvfs -f 1 stime -f 1 swapcontext -f 1 symlink -f 1 sync -f 1 sysconf -f 1 telldir -f 1 time -f 1 times -f 1 ttyname -f 1 ulimit -f 1 umask -f 1 umount -f 1 uname -f 1 unlink -f 1 unlockpt -f 1 utime -f 1 wait -f 1 waitid -f 1 waitpid -f 1 write -f 1 writev - -f 0 atexit -f 0 calloc -f 0 exit -f 0 _exit -f 0 free -f 0 localeconv -f 0 malloc -f 0 realloc -f 0 remove -f 0 setlocale -f 0 signal -f 0 strcoll -f 0 strerror -f 0 strftime -f 0 strxfrm -f 0 system -f 0 _Q_add -f 0 _Q_cmp -f 0 _Q_cmpe -f 0 _Q_div -f 0 _Q_dtoq -f 0 _Q_feq -f 0 _Q_fge -f 0 _Q_fgt -f 0 _Q_fle -f 0 _Q_flt -f 0 _Q_fne -f 0 _Q_itoq -f 0 _Q_mul -f 0 _Q_neg -f 0 _Q_qtod -f 0 _Q_qtoi -f 0 _Q_qtos -f 0 _Q_qtou -f 0 _Q_sqrt -f 0 _Q_stoq -f 0 _Q_sub -f 0 _Q_utoq -f 0 __dtou -f 0 __ftou - -d 0 _altzone 1 long = 0; -d 0 __ctype[257+257+7] 2 unsigned char = {0}; -d 0 _numeric[2] 2 unsigned char = {0}; - -d 1 daylight 1 int = 0; -d 1 timezone 1 long = 0; -d 1 tzname 3 char * [2] = {(char*)0,(char*)0}; - -d 1 environ 2 char ** = 0; - -d 0 __huge_val[2] 2 unsigned long = {0x7ff00000,0x0}; diff --git a/usr/src/lib/libsys/sparc/libsys.sh b/usr/src/lib/libsys/sparc/libsys.sh deleted file mode 100644 index 7a3079a756..0000000000 --- a/usr/src/lib/libsys/sparc/libsys.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1995 by Sun Microsystems, Inc. -# All rights reserved. -# -# Stub library for programmer's interface to libsys. Used to satisfy ld(1) -# processing, and serves as a precedence place-holder at execution-time. - -awk ' -BEGIN { - printf("\t.file\t\"libsyss.s\"\n\t.section\t\".text\"\n"); -} -/.*/ { - printf("\t.global\t%s\n%s:\n\tt 5\n\t.type\t%s,#function\n\t.size\t%s,.-%s\n", $0, $0, $0, $0, $0); -} -' libsyss.list > libsyss.s diff --git a/usr/src/lib/libsys/sparc/libsyss.list b/usr/src/lib/libsys/sparc/libsyss.list deleted file mode 100644 index 15189a3e50..0000000000 --- a/usr/src/lib/libsys/sparc/libsyss.list +++ /dev/null @@ -1,10 +0,0 @@ -.div -.mul -.rem -.stret1 -.stret2 -.stret4 -.stret8 -.udiv -.umul -.urem diff --git a/usr/src/lib/libvmm/libvmm.c b/usr/src/lib/libvmm/libvmm.c index dc552a8de0..df3d8ec99f 100644 --- a/usr/src/lib/libvmm/libvmm.c +++ b/usr/src/lib/libvmm/libvmm.c @@ -11,6 +11,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ /* @@ -199,12 +200,31 @@ vmm_map(vmm_t *vmm, boolean_t writable) for (ms = list_head(&vmm->vmm_memlist); ms != NULL; ms = list_next(&vmm->vmm_memlist, ms)) { - off_t mapoff = ms->vms_gpa; + off_t mapoff; + + if ((ms->vms_flags & VMM_MEMSEG_DEVMEM) == 0) { + /* + * sysmem segments will be located at an offset + * equivalent to their GPA. + */ + mapoff = ms->vms_gpa; + } else { + /* + * devmem segments are located in a special region away + * from the normal GPA space. + */ + if (vm_get_devmem_offset(vmm->vmm_ctx, ms->vms_segid, + &mapoff) != 0) { + goto fail; + } + } - if ((ms->vms_flags & VMM_MEMSEG_DEVMEM) && - vm_get_devmem_offset(vmm->vmm_ctx, ms->vms_segid, &mapoff) - != 0) - goto fail; + /* + * While 'mapoff' points to the front of the segment, the actual + * mapping may be at some offset beyond that. + */ + VERIFY(ms->vms_segoff >= 0); + mapoff += ms->vms_segoff; vmm->vmm_memsize += ms->vms_maplen; diff --git a/usr/src/lib/libzfs/common/libzfs_import.c b/usr/src/lib/libzfs/common/libzfs_import.c index 706f08e6ec..dc15aca0c0 100644 --- a/usr/src/lib/libzfs/common/libzfs_import.c +++ b/usr/src/lib/libzfs/common/libzfs_import.c @@ -169,23 +169,66 @@ zpool_clear_label(int fd) int l; vdev_label_t *label; uint64_t size; + int labels_cleared = 0; if (fstat64(fd, &statbuf) == -1) return (0); + size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); if ((label = calloc(sizeof (vdev_label_t), 1)) == NULL) return (-1); for (l = 0; l < VDEV_LABELS; l++) { - if (pwrite64(fd, label, sizeof (vdev_label_t), + uint64_t state, guid; + nvlist_t *config; + + if (pread64(fd, label, sizeof (vdev_label_t), label_offset(size, l)) != sizeof (vdev_label_t)) { - free(label); - return (-1); + continue; + } + + if (nvlist_unpack(label->vl_vdev_phys.vp_nvlist, + sizeof (label->vl_vdev_phys.vp_nvlist), &config, 0) != 0) { + continue; + } + + /* Skip labels which do not have a valid guid. */ + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, + &guid) != 0 || guid == 0) { + nvlist_free(config); + continue; + } + + /* Skip labels which are not in a known valid state. */ + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, + &state) != 0 || state > POOL_STATE_L2CACHE) { + nvlist_free(config); + continue; + } + + nvlist_free(config); + + /* + * A valid label was found, overwrite this label's nvlist + * and uberblocks with zeros on disk. This is done to prevent + * system utilities, like blkid, from incorrectly detecting a + * partial label. The leading pad space is left untouched. + */ + memset(label, 0, sizeof (vdev_label_t)); + size_t label_size = sizeof (vdev_label_t) - (2 * VDEV_PAD_SIZE); + + if (pwrite64(fd, label, label_size, label_offset(size, l) + + (2 * VDEV_PAD_SIZE)) == label_size) { + labels_cleared++; } } free(label); + + if (labels_cleared == 0) + return (-1); + return (0); } diff --git a/usr/src/lib/libzutil/common/zutil_import.c b/usr/src/lib/libzutil/common/zutil_import.c index 961247c5c0..b4e6ccc0ca 100644 --- a/usr/src/lib/libzutil/common/zutil_import.c +++ b/usr/src/lib/libzutil/common/zutil_import.c @@ -25,6 +25,7 @@ * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright 2015 RackTop Systems. * Copyright (c) 2016, Intel Corporation. + * Copyright 2020 Joyent, Inc. */ /* @@ -913,8 +914,11 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels) *config = NULL; + if (num_labels != NULL) + *num_labels = 0; + if (fstat64(fd, &statbuf) == -1) - return (-1); + return (0); size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); if ((label = malloc(sizeof (vdev_label_t))) == NULL) @@ -968,11 +972,6 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels) free(label); *config = expected_config; - if (count == 0) { - errno = ENOENT; - return (-1); - } - return (0); } |