summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/sgs/ar/common/ar.msg8
-rw-r--r--usr/src/cmd/sgs/ar/common/cmd.c69
-rw-r--r--usr/src/cmd/sgs/ar/common/main.c51
-rw-r--r--usr/src/cmd/sgs/libld/common/ldentry.c2
-rw-r--r--usr/src/cmd/sgs/libld/common/outfile.c4
-rw-r--r--usr/src/cmd/sgs/libld/common/unwind.c14
-rw-r--r--usr/src/cmd/sgs/libld/common/update.c6
-rw-r--r--usr/src/cmd/sgs/tools/SUNWonld-README1
-rw-r--r--usr/src/cmd/zhack/Makefile49
-rw-r--r--usr/src/cmd/zhack/Makefile.com76
-rw-r--r--usr/src/cmd/zhack/amd64/Makefile30
-rw-r--r--usr/src/cmd/zhack/i386/Makefile29
-rw-r--r--usr/src/cmd/zhack/sparcv9/Makefile30
-rw-r--r--usr/src/cmd/zinject/Makefile42
-rw-r--r--usr/src/cmd/zinject/Makefile.com71
-rw-r--r--usr/src/cmd/zinject/amd64/Makefile31
-rw-r--r--usr/src/cmd/zinject/i386/Makefile30
-rw-r--r--usr/src/cmd/zinject/sparcv9/Makefile31
-rw-r--r--usr/src/cmd/zlook/Makefile31
-rw-r--r--usr/src/cmd/zlook/Makefile.com51
-rw-r--r--usr/src/cmd/zlook/amd64/Makefile30
-rw-r--r--usr/src/cmd/zlook/i386/Makefile29
-rw-r--r--usr/src/cmd/zlook/sparcv9/Makefile30
-rw-r--r--usr/src/cmd/zpool/zpool_main.c7
-rw-r--r--usr/src/cmd/ztest/Makefile58
-rw-r--r--usr/src/cmd/ztest/Makefile.com84
-rw-r--r--usr/src/cmd/ztest/amd64/Makefile32
-rw-r--r--usr/src/cmd/ztest/i386/Makefile31
-rw-r--r--usr/src/cmd/ztest/sparcv9/Makefile32
-rw-r--r--usr/src/cmd/ztest/ztest.c20
30 files changed, 172 insertions, 837 deletions
diff --git a/usr/src/cmd/sgs/ar/common/ar.msg b/usr/src/cmd/sgs/ar/common/ar.msg
index 24daa9dce3..a0da94da04 100644
--- a/usr/src/cmd/sgs/ar/common/ar.msg
+++ b/usr/src/cmd/sgs/ar/common/ar.msg
@@ -21,7 +21,6 @@
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2021 Oxide Computer Company
#
@ _START_
@@ -35,7 +34,6 @@
ar -p[-vV][-sS] archive [file ...]\n \
ar -q[-cuvSV] [-abi] [posname] [file ...]\n \
ar -r[-cuvSV] [-abi] [posname] [file ...]\n \
- ar -s[-vV] archive\n \
ar -t[-vV][-sS] archive [file ...]\n \
ar -x[-vV][-sSCT] archive [file ...]\n"
@@ -43,14 +41,12 @@
@ MSG_TOOBIG4G "ar: archive size exceeds capabilities of 32-bit \
process\n"
-@ MSG_USAGE_01 "ar: one of [drqstpmx] must be specified\n"
+@ MSG_USAGE_01 "ar: one of [drqtpmx] must be specified\n"
@ MSG_USAGE_02 "ar: -%c requires an operand\n"
@ MSG_USAGE_03 "ar: bad option: -%c\n"
@ MSG_USAGE_04 "ar: only one of [drqtpmx] allowed\n"
@ MSG_USAGE_05 "ar: abi not allowed with q\n"
@ MSG_USAGE_06 "ar: %s taken as mandatory 'posname' with keys 'abi'\n"
-@ MSG_USAGE_S_BAD_ARG "ar: bad option with -s, only -v and -V allowed\n"
-@ MSG_USAGE_S_EXTRA_AR "ar: -s only supports a single archive file\n"
@ MSG_INTERNAL_01 "ar: internal error: cannot tell whether file is \
included in archive or not\n"
@@ -122,7 +118,7 @@
@ MSG_STR_SYM64 "/SYM64/"
# Format for full member header
-#
+#
@ MSG_MH_FORMAT "%-16s%-12d%-6u%-6u%-8o%-10lld%-2s"
@ MSG_FMT_VERSION "ar: %s %s\n"
diff --git a/usr/src/cmd/sgs/ar/common/cmd.c b/usr/src/cmd/sgs/ar/common/cmd.c
index 4c9c25de6e..4ed18765f6 100644
--- a/usr/src/cmd/sgs/ar/common/cmd.c
+++ b/usr/src/cmd/sgs/ar/common/cmd.c
@@ -20,7 +20,6 @@
*/
/*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2021 Oxide Computer Company
*/
/*
@@ -34,36 +33,36 @@
*
* The archive file member header used in SunOS 4.1 archive files and
* Solaris archive files are incompatible. The header file is:
- * /usr/include/ar.h, struct ar_hdr.
+ * /usr/include/ar.h, struct ar_hdr.
* The member ar_name[] in Solaris comforms with Standard and the
* member name terminates with '/'. The SunOS's member does not terminate
* with '/' character. A bug 4046054 was filed:
- * The ar command in Solaris 2.5.1 is incompatible with archives
- * created on 4.x.
+ * The ar command in Solaris 2.5.1 is incompatible with archives
+ * created on 4.x.
*
* To handle archive files created in SunOS 4.1 system on Solaris, the
* following changes were made:
*
- * 1. file.c/writefile()
- * Before writing each member files into the output
- * archive file, ar_name[] is checked. If it is NULL,
- * it means that the original archive header for this
- * member was incompatible with Solaris format.
+ * 1. file.c/writefile()
+ * Before writing each member files into the output
+ * archive file, ar_name[] is checked. If it is NULL,
+ * it means that the original archive header for this
+ * member was incompatible with Solaris format.
*
- * The original Solaris ar command ended up having
- * NULL name for the header. The change here uses the
- * ar_rawname, which is much closer to the original
- * name.
+ * The original Solaris ar command ended up having
+ * NULL name for the header. The change here uses the
+ * ar_rawname, which is much closer to the original
+ * name.
*
- * 2. cmd.c
- * For the p command, the code used to use only ar_longname
- * to seach the matching name. The member is set to NULL
- * if the archive member header was incompatible.
- * The ar_rawname is also used to find the matching member name.
+ * 2. cmd.c
+ * For the p command, the code used to use only ar_longname
+ * to seach the matching name. The member is set to NULL
+ * if the archive member header was incompatible.
+ * The ar_rawname is also used to find the matching member name.
*
- * For commands to update the archive file, we do not
- * use ar_rawname, and just use the ar_longname. The commands are
- * r (replace), m (modify the position) and d (delete).
+ * For commands to update the archive file, we do not
+ * use ar_rawname, and just use the ar_longname. The commands are
+ * r (replace), m (modify the position) and d (delete).
*/
#include "inc.h"
@@ -91,7 +90,7 @@ rcmd(Cmd_info *cmd_info)
ARFILE *backptr = NULL;
ARFILE *endptr;
ARFILE *moved_files;
- ARFILE *prev_entry, *new_listhead, *new_listend;
+ ARFILE *prev_entry, *new_listhead, *new_listend;
int deleted;
struct stat stbuf;
char *gfile;
@@ -479,8 +478,7 @@ tcmd(Cmd_info *cmd_info)
* Refer to "Incompatible Archive Header"
* blocked comment at the beginning of this file.
*/
- if ((cmd_info->opt_flgs & (t_FLAG | v_FLAG)) ==
- (t_FLAG | v_FLAG)) {
+ if (cmd_info->opt_flgs & v_FLAG) {
for (mp = &m[0]; mp < &m[9]; )
ar_select(*mp++, next->ar_mode);
@@ -497,20 +495,17 @@ tcmd(Cmd_info *cmd_info)
(void) fprintf(stdout,
MSG_ORIG(MSG_FMT_SPSTRSP), buf);
}
- if (cmd_info->opt_flgs & t_FLAG) {
- if ((next->ar_longname[0] == 0) &&
- (next->ar_rawname[0] != 0)) {
- (void) fprintf(stdout,
- MSG_ORIG(MSG_FMT_STRNL),
- trim(next->ar_rawname));
- } else {
- (void) fprintf(stdout,
- MSG_ORIG(MSG_FMT_STRNL),
- trim(next->ar_longname));
- }
- }
+ if ((next->ar_longname[0] == 0) &&
+ (next->ar_rawname[0] != 0))
+ (void) fprintf(stdout,
+ MSG_ORIG(MSG_FMT_STRNL),
+ trim(next->ar_rawname));
+ else
+ (void) fprintf(stdout,
+ MSG_ORIG(MSG_FMT_STRNL),
+ trim(next->ar_longname));
}
- }
+ } /* for */
}
void
diff --git a/usr/src/cmd/sgs/ar/common/main.c b/usr/src/cmd/sgs/ar/common/main.c
index 8a73d30209..e5667aa196 100644
--- a/usr/src/cmd/sgs/ar/common/main.c
+++ b/usr/src/cmd/sgs/ar/common/main.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
@@ -27,7 +27,6 @@
/*
* Copyright (c) 2018, Joyent, Inc.
- * Copyright 2021 Oxide Computer Company
*/
#include "inc.h"
@@ -132,12 +131,20 @@ main(int argc, char **argv, char *envp[])
if (cmd_info->opt_flgs & z_FLAG)
check_swap();
+ if (cmd_info->comfun == NULL) {
+ if ((cmd_info->opt_flgs & (d_FLAG | r_FLAG | q_FLAG |
+ t_FLAG | p_FLAG | m_FLAG | x_FLAG)) == 0) {
+ (void) fprintf(stderr, MSG_INTL(MSG_USAGE_01));
+ exit(1);
+ }
+ }
+
cmd_info->modified = (cmd_info->opt_flgs & s_FLAG);
fd = getaf(cmd_info);
if ((fd == -1) &&
(cmd_info->opt_flgs &
- (d_FLAG | m_FLAG | p_FLAG | s_FLAG | t_FLAG | x_FLAG)) ||
+ (d_FLAG | m_FLAG | p_FLAG | t_FLAG | x_FLAG)) ||
((cmd_info->opt_flgs & r_FLAG) &&
(cmd_info->opt_flgs & (a_FLAG | b_FLAG)))) {
(void) fprintf(stderr, MSG_INTL(MSG_NOT_FOUND_AR),
@@ -308,44 +315,6 @@ setup(int argc, char *argv[], Cmd_info *cmd_info)
cmd_info->arnam = argv[optind];
cmd_info->namv = &argv[optind+1];
cmd_info->namc = argc - optind - 1;
-
- /*
- * GNU ar popularized the use of -s on its own which previously used to
- * require another command function. As such, we don't set a command
- * function when we encounter the -s flag because that might otherwise
- * clobber an existing one being set and would interrupt the detection
- * of multiple flags being used that way.
- *
- * If after processing everything, we find there's no command function
- * set and the -s flag has been set, then we can finally set a command
- * function. The command function for -t 'tcmd' is used in this case. It
- * knows to only print out data if -t has been specified.
- *
- * While ar has not traditionally been very stringent about using flags
- * in circumstances they aren't called for, we go ahead and check for
- * that now for this newer option.
- */
- if (cmd_info->comfun == NULL) {
- if ((cmd_info->opt_flgs & s_FLAG) != 0) {
- if ((cmd_info->opt_flgs & ~(s_FLAG | v_FLAG)) != 0) {
- (void) fprintf(stderr,
- MSG_INTL(MSG_USAGE_S_BAD_ARG));
- exit(1);
- }
-
- if (cmd_info->namc > 1) {
- (void) fprintf(stderr,
- MSG_INTL(MSG_USAGE_S_EXTRA_AR));
- exit(1);
- }
-
- setcom(cmd_info, tcmd);
- } else if ((cmd_info->opt_flgs & (d_FLAG | r_FLAG | q_FLAG |
- s_FLAG | t_FLAG | p_FLAG | m_FLAG | x_FLAG)) == 0) {
- (void) fprintf(stderr, MSG_INTL(MSG_USAGE_01));
- exit(1);
- }
- }
}
diff --git a/usr/src/cmd/sgs/libld/common/ldentry.c b/usr/src/cmd/sgs/libld/common/ldentry.c
index 3a9920992d..447dea18b6 100644
--- a/usr/src/cmd/sgs/libld/common/ldentry.c
+++ b/usr/src/cmd/sgs/libld/common/ldentry.c
@@ -149,7 +149,7 @@ ld_map_out(Ofl_desc *ofl)
Aliste idx;
if (((dfiles = sdp->sd_aux->sa_dfiles) == NULL) ||
- (aplist_nitems(dfiles) == 1))
+ (aplist_nitems(dfiles) <= 1))
continue;
/*
diff --git a/usr/src/cmd/sgs/libld/common/outfile.c b/usr/src/cmd/sgs/libld/common/outfile.c
index 447d3a19b7..6d495fb33b 100644
--- a/usr/src/cmd/sgs/libld/common/outfile.c
+++ b/usr/src/cmd/sgs/libld/common/outfile.c
@@ -228,7 +228,7 @@ pad_outfile(Ofl_desc *ofl)
*/
if (oscn && (phdr->p_type == PT_LOAD)) {
Elf_Data * data;
- size_t size;
+ size_t size;
size = (size_t)(S_ROUND(offset, phdr->p_align) -
offset);
@@ -483,7 +483,7 @@ ld_create_outfile(Ofl_desc *ofl)
nseg++;
} else if (sgp->sg_flags & FLG_SG_EMPTY) {
nseg++;
- } else if (sgp->sg_osdescs != NULL) {
+ } else if (aplist_nitems(sgp->sg_osdescs) != 0) {
if ((sgp->sg_flags & FLG_SG_PHREQ) == 0) {
/*
* If this is a segment for which
diff --git a/usr/src/cmd/sgs/libld/common/unwind.c b/usr/src/cmd/sgs/libld/common/unwind.c
index 45cf0b2a9b..f2960f74c6 100644
--- a/usr/src/cmd/sgs/libld/common/unwind.c
+++ b/usr/src/cmd/sgs/libld/common/unwind.c
@@ -177,11 +177,11 @@
* Augmentation Section field 4 is not 0.
*
* z:
- * size uleb128 Length of the remainder of the
- * Augmentation Section
+ * size uleb128 Length of the remainder of the
+ * Augmentation Section
*
* P:
- * personality_enc 1 Encoding specifier - preferred
+ * personality_enc 1 Encoding specifier - preferred
* value is a pc-relative, signed
* 4-byte
*
@@ -191,14 +191,14 @@
* entry for the personality
* routine)
* R:
- * code_enc 1 Non-default encoding for the
+ * code_enc 1 Non-default encoding for the
* code-pointers (FDE members
* "initial_location" and "address_range"
* and the operand for DW_CFA_set_loc)
* - preferred value is pc-relative,
* signed 4-byte.
* L:
- * lsda_enc 1 FDE augmentation bodies may contain
+ * lsda_enc 1 FDE augmentation bodies may contain
* LSDA pointers. If so they are
* encoded as specified here -
* preferred value is pc-relative,
@@ -257,7 +257,7 @@
*
*
* 'z':
- * length uleb128 length of the remainder of the
+ * length uleb128 length of the remainder of the
* FDE augmentation section
*
*
@@ -332,7 +332,7 @@ ld_unwind_make_hdr(Ofl_desc *ofl)
* we only build a unwind header if we have
* some unwind information in the file.
*/
- if (ofl->ofl_unwind == NULL)
+ if (aplist_nitems(ofl->ofl_unwind) == 0)
return (1);
/*
diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c
index 2bef6a18a8..0865ae64fa 100644
--- a/usr/src/cmd/sgs/libld/common/update.c
+++ b/usr/src/cmd/sgs/libld/common/update.c
@@ -389,7 +389,7 @@ update_osym(Ofl_desc *ofl)
Aliste idx2;
if (phd->p_type == PT_LOAD) {
- if (sgp->sg_osdescs != NULL) {
+ if (aplist_nitems(sgp->sg_osdescs) != 0) {
Word _flags = phd->p_flags & (PF_W | PF_R);
if (_flags == PF_R)
@@ -580,7 +580,7 @@ update_osym(Ofl_desc *ofl)
* no sections to establish an index for _end, so assign
* it as an absolute.
*/
- if (sgp->sg_osdescs != NULL) {
+ if (aplist_nitems(sgp->sg_osdescs) != 0) {
/*
* Determine the last section for this segment.
*/
@@ -4173,7 +4173,7 @@ ld_update_outfile(Ofl_desc *ofl)
* section descriptors associated with them (ie. some form of
* input section has been matched to this segment).
*/
- if (sgp->sg_osdescs == NULL)
+ if (aplist_nitems(sgp->sg_osdescs) == 0)
continue;
/*
diff --git a/usr/src/cmd/sgs/tools/SUNWonld-README b/usr/src/cmd/sgs/tools/SUNWonld-README
index bb8f0d9b3d..695c545719 100644
--- a/usr/src/cmd/sgs/tools/SUNWonld-README
+++ b/usr/src/cmd/sgs/tools/SUNWonld-README
@@ -1675,3 +1675,4 @@ Bugid Risk Synopsis
13487 want mapfile-based assertions about symbol properties (fix SPARC)
14090 ld(1) could use a normal allocator
14090 backout: turns over big rocks, discovers big bugs
+14152 ld(1) should be more careful about empty alists
diff --git a/usr/src/cmd/zhack/Makefile b/usr/src/cmd/zhack/Makefile
index d4f3018fd7..fa6c3bb99e 100644
--- a/usr/src/cmd/zhack/Makefile
+++ b/usr/src/cmd/zhack/Makefile
@@ -2,9 +2,8 @@
# 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.
+# 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.
@@ -19,39 +18,51 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
-# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+# Copyright 2017 RackTop Systems.
+# Copyright 2020 Joyent, Inc.
#
PROG= zhack
+OBJS= $(PROG).o
include ../Makefile.cmd
+include ../Makefile.cmd.64
+include ../Makefile.ctf
+
+INCS += -I../../lib/libzpool/common
+INCS += -I../../uts/common/fs/zfs
+INCS += -I../../uts/common/fs/zfs/lua
+INCS += -I../../common/zfs
+INCS += -I../../lib/libzutil/common
+
+LDLIBS += -lzpool -lumem -lnvpair -lzutil
-$(INTEL_BLD)SUBDIRS = $(MACH)
-$(BUILD64)SUBDIRS += $(MACH64)
+CSTD= $(CSTD_GNU99)
-all := TARGET = all
-install := TARGET = install
-clean := TARGET = clean
-clobber := TARGET = clobber
-lint := TARGET = lint
+CFLAGS += $(CCVERBOSE)
+CFLAGS64 += $(CCVERBOSE)
+CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
+CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT -DDEBUG $(INCS)
.KEEP_STATE:
-all clean clobber lint: $(SUBDIRS)
+all: $(PROG)
-install: $(SUBDIRS)
- -$(RM) $(ROOTUSRSBINPROG)
- -$(LN) $(ISAEXEC) $(ROOTUSRSBINPROG)
+install: all $(ROOTUSRSBINPROG)
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
+$(PROG): $(OBJS)
+ $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
+ $(POST_PROCESS)
-FRC:
+clean:
+ $(RM) $(OBJS)
include ../Makefile.targ
diff --git a/usr/src/cmd/zhack/Makefile.com b/usr/src/cmd/zhack/Makefile.com
deleted file mode 100644
index d45962c16d..0000000000
--- a/usr/src/cmd/zhack/Makefile.com
+++ /dev/null
@@ -1,76 +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 (c) 2012, 2016 by Delphix. All rights reserved.
-# Copyright 2017 RackTop Systems.
-# Copyright 2020 Joyent, Inc.
-#
-
-PROG= zhack
-SRCS= ../$(PROG).c
-OBJS= $(PROG).o
-
-include ../../Makefile.cmd
-include ../../Makefile.ctf
-
-INCS += -I../../../lib/libzpool/common
-INCS += -I../../../uts/common/fs/zfs
-INCS += -I../../../uts/common/fs/zfs/lua
-INCS += -I../../../common/zfs
-INCS += -I../../../lib/libzutil/common
-
-LDLIBS += -lzpool -lumem -lnvpair -lzutil
-
-CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
-
-CFLAGS += $(CCVERBOSE)
-CFLAGS64 += $(CCVERBOSE)
-CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
-CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT -DDEBUG $(INCS)
-
-LINTFLAGS += -erroff=E_STATIC_UNUSED
-LINTFLAGS64 += -erroff=E_STATIC_UNUSED
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(PROG): $(OBJS)
- $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-clean:
- $(RM) $(OBJS)
-
-lint: lint_SRCS
-
-include ../../Makefile.targ
-
-%.o: ../%.c
- $(COMPILE.c) $<
- $(POST_PROCESS_O)
diff --git a/usr/src/cmd/zhack/amd64/Makefile b/usr/src/cmd/zhack/amd64/Makefile
deleted file mode 100644
index 74c7a42a08..0000000000
--- a/usr/src/cmd/zhack/amd64/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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.
-#
-
-include ../Makefile.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTUSRSBINPROG64)
diff --git a/usr/src/cmd/zhack/i386/Makefile b/usr/src/cmd/zhack/i386/Makefile
deleted file mode 100644
index 2ff9c89632..0000000000
--- a/usr/src/cmd/zhack/i386/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-#
-
-include ../Makefile.com
-
-install: all $(ROOTUSRSBINPROG32)
diff --git a/usr/src/cmd/zhack/sparcv9/Makefile b/usr/src/cmd/zhack/sparcv9/Makefile
deleted file mode 100644
index 74c7a42a08..0000000000
--- a/usr/src/cmd/zhack/sparcv9/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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.
-#
-
-include ../Makefile.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTUSRSBINPROG64)
diff --git a/usr/src/cmd/zinject/Makefile b/usr/src/cmd/zinject/Makefile
index f646689967..b40dbf1150 100644
--- a/usr/src/cmd/zinject/Makefile
+++ b/usr/src/cmd/zinject/Makefile
@@ -22,33 +22,43 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
+# Copyright (c) 2016 by Delphix. All rights reserved.
+# Copyright 2017 RackTop Systems.
+# Copyright 2020 Joyent, Inc.
#
-PROG:sh= basename `pwd`
+PROG= zinject
+OBJS= $(PROG).o translate.o
include ../Makefile.cmd
+include ../Makefile.cmd.64
+include ../Makefile.ctf
-$(INTEL_BLD)SUBDIRS = $(MACH)
-$(BUILD64)SUBDIRS += $(MACH64)
+INCS += -I../../lib/libzpool/common
+INCS += -I../../uts/common/fs/zfs
+INCS += -I../../uts/common/fs/zfs/lua
-all := TARGET = all
-install := TARGET = install
-clean := TARGET = clean
-clobber := TARGET = clobber
-lint := TARGET = lint
+LDLIBS += -lzfs -lnvpair
+
+CSTD= $(CSTD_GNU99)
+
+CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
+CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
+
+CERRWARN += $(CNOWARN_UNINIT)
+CERRWARN += -_gcc=-Wno-switch
.KEEP_STATE:
-all clean clobber lint: $(SUBDIRS)
+all: $(PROG)
-install: $(SUBDIRS)
- -$(RM) $(ROOTUSRSBINPROG)
- -$(LN) $(ISAEXEC) $(ROOTUSRSBINPROG)
+install: all $(ROOTUSRSBINPROG)
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
+$(PROG): $(OBJS)
+ $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
+ $(POST_PROCESS)
-FRC:
+clean:
+ $(RM) $(OBJS)
include ../Makefile.targ
diff --git a/usr/src/cmd/zinject/Makefile.com b/usr/src/cmd/zinject/Makefile.com
deleted file mode 100644
index 220c877b42..0000000000
--- a/usr/src/cmd/zinject/Makefile.com
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright (c) 2016 by Delphix. All rights reserved.
-# Copyright 2017 RackTop Systems.
-# Copyright 2020 Joyent, Inc.
-#
-
-PROG:sh= cd ..; basename `pwd`
-OBJS= $(PROG).o translate.o
-SRCS= $(OBJS:%.o=../%.c)
-
-include ../../Makefile.cmd
-
-INCS += -I../../../lib/libzpool/common
-INCS += -I../../../uts/common/fs/zfs
-INCS += -I../../../uts/common/fs/zfs/lua
-
-LDLIBS += -lzfs -lnvpair
-
-CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
-
-CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
-CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
-
-CERRWARN += $(CNOWARN_UNINIT)
-CERRWARN += -_gcc=-Wno-switch
-
-LINTFLAGS += -erroff=E_STATIC_UNUSED
-LINTFLAGS64 += -erroff=E_STATIC_UNUSED
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(PROG): $(OBJS)
- $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-clean:
- $(RM) $(OBJS)
-
-lint: lint_SRCS
-
-%.o: ../%.c
- $(COMPILE.c) $<
- $(POST_PROCESS_O)
-
-include ../../Makefile.targ
diff --git a/usr/src/cmd/zinject/amd64/Makefile b/usr/src/cmd/zinject/amd64/Makefile
deleted file mode 100644
index 8740a9f3ac..0000000000
--- a/usr/src/cmd/zinject/amd64/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTUSRSBINPROG64)
diff --git a/usr/src/cmd/zinject/i386/Makefile b/usr/src/cmd/zinject/i386/Makefile
deleted file mode 100644
index d2cb13dcd1..0000000000
--- a/usr/src/cmd/zinject/i386/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTUSRSBINPROG32)
diff --git a/usr/src/cmd/zinject/sparcv9/Makefile b/usr/src/cmd/zinject/sparcv9/Makefile
deleted file mode 100644
index 8740a9f3ac..0000000000
--- a/usr/src/cmd/zinject/sparcv9/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTUSRSBINPROG64)
diff --git a/usr/src/cmd/zlook/Makefile b/usr/src/cmd/zlook/Makefile
index fb2ee0ede2..66fc18115b 100644
--- a/usr/src/cmd/zlook/Makefile
+++ b/usr/src/cmd/zlook/Makefile
@@ -23,30 +23,31 @@
# Use is subject to license terms.
#
-PROG:sh= basename `pwd`
+PROG= zlook
+OBJS= $(PROG).o
include ../Makefile.cmd
+include ../Makefile.cmd.64
+include ../Makefile.ctf
-$(INTEL_BLD)SUBDIRS = $(MACH)
-$(BUILD64)SUBDIRS += $(MACH64)
+CSTD= $(CSTD_GNU99)
+CFLAGS += $(CCGDEBUG) $(CCVERBOSE)
+CFLAGS64 += $(CCGDEBUG) $(CCVERBOSE)
+CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
-all := TARGET = all
-install := TARGET = install
-clean := TARGET = clean
-clobber := TARGET = clobber
-lint := TARGET = lint
+CERRWARN += $(CNOWARN_UNINIT)
.KEEP_STATE:
-all clean clobber lint: $(SUBDIRS)
+all: $(PROG)
-install: $(SUBDIRS)
- -$(RM) $(ROOTPROG)
- -$(LN) $(ISAEXEC) $(ROOTPROG)
+install: all $(ROOTPROG)
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
+$(PROG): $(OBJS)
+ $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
+ $(POST_PROCESS)
-FRC:
+clean:
+ $(RM) $(OBJS)
include ../Makefile.targ
diff --git a/usr/src/cmd/zlook/Makefile.com b/usr/src/cmd/zlook/Makefile.com
deleted file mode 100644
index a634a72d2c..0000000000
--- a/usr/src/cmd/zlook/Makefile.com
+++ /dev/null
@@ -1,51 +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.
-#
-
-PROG= zlook
-SRCS= ../$(PROG).c
-
-include ../../Makefile.cmd
-
-CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
-CFLAGS += $(CCGDEBUG) $(CCVERBOSE)
-CFLAGS64 += $(CCGDEBUG) $(CCVERBOSE)
-CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
-
-CERRWARN += $(CNOWARN_UNINIT)
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(PROG): $(SRCS)
- $(LINK.c) -o $(PROG) $(SRCS) $(LDLIBS)
- $(POST_PROCESS)
-
-clean:
-
-lint: lint_SRCS
-
-include ../../Makefile.targ
diff --git a/usr/src/cmd/zlook/amd64/Makefile b/usr/src/cmd/zlook/amd64/Makefile
deleted file mode 100644
index 64da121d75..0000000000
--- a/usr/src/cmd/zlook/amd64/Makefile
+++ /dev/null
@@ -1,30 +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.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTPROG64)
diff --git a/usr/src/cmd/zlook/i386/Makefile b/usr/src/cmd/zlook/i386/Makefile
deleted file mode 100644
index 1bd7915dff..0000000000
--- a/usr/src/cmd/zlook/i386/Makefile
+++ /dev/null
@@ -1,29 +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.com
-
-install: all $(ROOTPROG32)
diff --git a/usr/src/cmd/zlook/sparcv9/Makefile b/usr/src/cmd/zlook/sparcv9/Makefile
deleted file mode 100644
index 64da121d75..0000000000
--- a/usr/src/cmd/zlook/sparcv9/Makefile
+++ /dev/null
@@ -1,30 +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.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTPROG64)
diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c
index d2ae332849..43da32d439 100644
--- a/usr/src/cmd/zpool/zpool_main.c
+++ b/usr/src/cmd/zpool/zpool_main.c
@@ -6417,9 +6417,10 @@ zpool_do_trim(int argc, char **argv)
"combined with the -c or -s options\n"));
usage(B_FALSE);
}
- if (zfs_nicestrtonum(NULL, optarg, &rate) == -1) {
- (void) fprintf(stderr,
- gettext("invalid value for rate\n"));
+ if (zfs_nicestrtonum(g_zfs, optarg, &rate) == -1) {
+ (void) fprintf(stderr, "%s: %s\n",
+ gettext("invalid value for rate"),
+ libzfs_error_description(g_zfs));
usage(B_FALSE);
}
break;
diff --git a/usr/src/cmd/ztest/Makefile b/usr/src/cmd/ztest/Makefile
index 4ae78f4cae..46b79c1383 100644
--- a/usr/src/cmd/ztest/Makefile
+++ b/usr/src/cmd/ztest/Makefile
@@ -19,42 +19,56 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright (c) 2015 by Delphix. All rights reserved.
-#
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+# Copyright 2017 RackTop Systems.
+# Copyright 2020 Joyent, Inc.
-PROG:sh= basename `pwd`
+PROG= ztest
BASHPROG= zloop
ROOTBASHPROG= $(ROOTBIN)/$(BASHPROG)
CLOBBERFILES= $(BASHPROG)
+OBJS= $(PROG).o
+
include ../Makefile.cmd
+include ../Makefile.cmd.64
+include ../Makefile.ctf
-$(INTEL_BLD)SUBDIRS = $(MACH)
-$(BUILD64)SUBDIRS += $(MACH64)
+INCS += -I../../lib/libzpool/common
+INCS += -I../../uts/common/fs/zfs
+INCS += -I../../uts/common/fs/zfs/lua
+INCS += -I../../common/zfs
+INCS += -I../../lib/libzutil/common
-all := TARGET = all
-install := TARGET = install
-clean := TARGET = clean
-clobber := TARGET = clobber
-lint := TARGET = lint
+LDLIBS += -lumem -lzpool -lcmdutils -lm -lnvpair -lfakekernel -lzutil
-.KEEP_STATE:
+CSTD= $(CSTD_GNU99)
+CFLAGS += -g $(CCVERBOSE)
+CFLAGS64 += -g $(CCVERBOSE)
+CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
+CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS) -DDEBUG
-all lint: $(SUBDIRS) $(BASHPROG)
+CERRWARN += -_gcc=-Wno-switch
+
+# false positive
+SMOFF += signed
+
+# needs work
+SMOFF += all_func_returns
+
+.KEEP_STATE:
-clean clobber: $(SUBDIRS)
+all: $(PROG) $(BASHPROG)
-install: $(SUBDIRS) $(ROOTBASHPROG)
- -$(RM) $(ROOTPROG)
- -$(LN) $(ISAEXEC) $(ROOTPROG)
+install: all $(ROOTPROG) $(ROOTBASHPROG)
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
+$(PROG): $(OBJS)
+ $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
+ $(POST_PROCESS)
-FRC:
+clean:
+ $(RM) $(OBJS)
include ../Makefile.targ
diff --git a/usr/src/cmd/ztest/Makefile.com b/usr/src/cmd/ztest/Makefile.com
deleted file mode 100644
index 0db755a6f7..0000000000
--- a/usr/src/cmd/ztest/Makefile.com
+++ /dev/null
@@ -1,84 +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) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
-# Copyright 2017 RackTop Systems.
-# Copyright 2020 Joyent, Inc.
-
-PROG= ztest
-OBJS= $(PROG).o
-SRCS= $(OBJS:%.o=../%.c)
-
-include ../../Makefile.cmd
-include ../../Makefile.ctf
-
-INCS += -I../../../lib/libzpool/common
-INCS += -I../../../uts/common/fs/zfs
-INCS += -I../../../uts/common/fs/zfs/lua
-INCS += -I../../../common/zfs
-INCS += -I../../../lib/libzutil/common
-
-LDLIBS += -lumem -lzpool -lcmdutils -lm -lnvpair -lfakekernel -lzutil
-
-CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
-CFLAGS += -g $(CCVERBOSE)
-CFLAGS64 += -g $(CCVERBOSE)
-CPPFLAGS.first = -I$(SRC)/lib/libfakekernel/common -D_FAKE_KERNEL
-CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS) -DDEBUG
-
-# lint complains about unused _umem_* functions
-LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
-LINTFLAGS64 += -xerroff=E_NAME_DEF_NOT_USED2
-
-# lint complains about unused inline functions, even though
-# they are "inline", not "static inline", with "extern inline"
-# implementations and usage in libzpool.
-LINTFLAGS += -erroff=E_STATIC_UNUSED
-LINTFLAGS64 += -erroff=E_STATIC_UNUSED
-
-CERRWARN += -_gcc=-Wno-switch
-
-# false positive
-SMOFF += signed
-
-# needs work
-SMOFF += all_func_returns
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(PROG): $(OBJS)
- $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-clean:
- $(RM) $(OBJS)
-
-lint: lint_SRCS
-
-include ../../Makefile.targ
-
-%.o: ../%.c
- $(COMPILE.c) $<
- $(POST_PROCESS_O)
diff --git a/usr/src/cmd/ztest/amd64/Makefile b/usr/src/cmd/ztest/amd64/Makefile
deleted file mode 100644
index f259815d6e..0000000000
--- a/usr/src/cmd/ztest/amd64/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# 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"
-#
-
-include ../Makefile.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTPROG64)
diff --git a/usr/src/cmd/ztest/i386/Makefile b/usr/src/cmd/ztest/i386/Makefile
deleted file mode 100644
index 8ca4d0b763..0000000000
--- a/usr/src/cmd/ztest/i386/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# 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"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTPROG32)
diff --git a/usr/src/cmd/ztest/sparcv9/Makefile b/usr/src/cmd/ztest/sparcv9/Makefile
deleted file mode 100644
index f259815d6e..0000000000
--- a/usr/src/cmd/ztest/sparcv9/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# 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"
-#
-
-include ../Makefile.com
-include ../../Makefile.cmd.64
-
-install: all $(ROOTPROG64)
diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c
index f4f577e4d3..7870cbe37c 100644
--- a/usr/src/cmd/ztest/ztest.c
+++ b/usr/src/cmd/ztest/ztest.c
@@ -6091,31 +6091,15 @@ ztest_run_zdb(char *pool)
int status;
char zdb[MAXPATHLEN + MAXNAMELEN + 20];
char zbuf[1024];
- char *bin;
- char *ztest;
- char *isa;
- int isalen;
FILE *fp;
- (void) realpath(getexecname(), zdb);
-
- /* zdb lives in /usr/sbin, while ztest lives in /usr/bin */
- bin = strstr(zdb, "/usr/bin/");
- ztest = strstr(bin, "/ztest");
- isa = bin + 8;
- isalen = ztest - isa;
- isa = strdup(isa);
- /* LINTED */
- (void) sprintf(bin,
- "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s "
+ (void) snprintf(zdb, sizeof (zdb),
+ "/usr/sbin/zdb -bcc%s%s -G -d -U %s "
"-o zfs_reconstruct_indirect_combinations_max=65536 %s",
- isalen,
- isa,
ztest_opts.zo_verbose >= 3 ? "s" : "",
ztest_opts.zo_verbose >= 4 ? "v" : "",
spa_config_path,
pool);
- free(isa);
if (ztest_opts.zo_verbose >= 5)
(void) printf("Executing %s\n", strstr(zdb, "zdb "));