diff options
Diffstat (limited to 'usr/src/tools')
26 files changed, 196 insertions, 36 deletions
| diff --git a/usr/src/tools/Makefile b/usr/src/tools/Makefile index 74bc15396e..8c6ea4eeba 100644 --- a/usr/src/tools/Makefile +++ b/usr/src/tools/Makefile @@ -65,6 +65,7 @@ COMMON_SUBDIRS= \  #  UNSHIPPED_SUBDIRS = \  	localedef \ +	man \  	mandoc \  	tic \  	vtfontcvt \ diff --git a/usr/src/tools/README.tools b/usr/src/tools/README.tools index 8612af43f7..8bb2f4c405 100644 --- a/usr/src/tools/README.tools +++ b/usr/src/tools/README.tools @@ -148,6 +148,9 @@ findunref  	  sort > ~/unref-sparc.out  	$ comm -12 ~/unref-i386.out ~/unref-sparc.out > ~/unref.out +git-active +	helper used by webrev to generate file lists for Git workspaces. +  hdrchk  	checks headers for compliance with OS/Net standards (form, includes,  	C++ guards). diff --git a/usr/src/tools/cpcgen/cpcgen.c b/usr/src/tools/cpcgen/cpcgen.c index b2a6a58334..43bc016a70 100644 --- a/usr/src/tools/cpcgen/cpcgen.c +++ b/usr/src/tools/cpcgen/cpcgen.c @@ -10,7 +10,7 @@   */  /* - * Copyright 2019, Joyent, Inc. + * Copyright 2019 Joyent, Inc.   */  /* @@ -1797,7 +1797,7 @@ cpcgen_gen(int dirfd)  			    "name");  		} -		if ((fd = openat(dirfd, tmpname, O_RDWR | O_CREAT, 0444)) < 0) { +		if ((fd = openat(dirfd, tmpname, O_RDWR | O_CREAT, 0644)) < 0) {  			err(EXIT_FAILURE, "failed to create temporary file %s",  			    tmpname);  		} diff --git a/usr/src/tools/ctf/Makefile.ctf b/usr/src/tools/ctf/Makefile.ctf index c07310eddf..1fc0b707db 100644 --- a/usr/src/tools/ctf/Makefile.ctf +++ b/usr/src/tools/ctf/Makefile.ctf @@ -22,7 +22,7 @@  # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.  # Use is subject to license terms.  # -# Copyright (c) 2018, Joyent, Inc. +# Copyright (c) 2019, Joyent, Inc.  include ../../../Makefile.tools diff --git a/usr/src/tools/ctf/common/utils.h b/usr/src/tools/ctf/common/utils.h index 9b07361a53..4ae2dd0917 100644 --- a/usr/src/tools/ctf/common/utils.h +++ b/usr/src/tools/ctf/common/utils.h @@ -27,9 +27,8 @@  #ifndef	_UTILS_H  #define	_UTILS_H -#pragma ident	"%Z%%M%	%I%	%E% SMI" -  #include <stdarg.h> +#include <ctf_headers.h>  #ifdef	__cplusplus  extern "C" { diff --git a/usr/src/tools/ctf/cvt/Makefile.com b/usr/src/tools/ctf/cvt/Makefile.com index 052cf02cc4..df3696e633 100644 --- a/usr/src/tools/ctf/cvt/Makefile.com +++ b/usr/src/tools/ctf/cvt/Makefile.com @@ -22,6 +22,7 @@  # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.  # Use is subject to license terms.  # +# Copyright 2019 Joyent, Inc.  include ../../Makefile.ctf @@ -74,7 +75,7 @@ DWARFLDFLAGS	= \  	-ldwarf  DWARFCPPFLAGS	= -I$(SRC)/lib/libdwarf/common -LDFLAGS		+= -L$(NATIVE_ADJUNCT)/lib +LDFLAGS		+= -L$(ADJUNCT_PROTO)/lib  LDLIBS		+= -lz -lelf  CPPFLAGS	+= -D_REENTRANT  CFLAGS		+= $(CTF_FLAGS) diff --git a/usr/src/tools/env/illumos.sh b/usr/src/tools/env/illumos.sh index 41fe338c2c..1a81a2488d 100644 --- a/usr/src/tools/env/illumos.sh +++ b/usr/src/tools/env/illumos.sh @@ -286,6 +286,12 @@ export SPRO_VROOT="$SPRO_ROOT"  # if the 'N' option is not specified, is to run this test.  #CHECK_PATHS='y' +# +# These checks ensure that if we accidentally run a program linked against the +# proto area, that we then fail the build. +# +export LD_TOXIC_PATH="$ROOT/lib:$ROOT/usr/lib" +  if [[ "$ENABLE_SMATCH" = "1" ]]; then  	SMATCHBIN=$CODEMGR_WS/usr/src/tools/proto/root_$MACH-nd/opt/onbld/bin/$MACH/smatch  	export SHADOW_CCS="$SHADOW_CCS smatch,$SMATCHBIN,smatch" diff --git a/usr/src/tools/findunref/exception_list.git b/usr/src/tools/findunref/exception_list.git new file mode 100644 index 0000000000..d14dbd22f0 --- /dev/null +++ b/usr/src/tools/findunref/exception_list.git @@ -0,0 +1,39 @@ +# +# 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 Cyril Plisko.  All rights reserved. +# Use is subject to license terms. +# + +# +# Git-specific exception list +# +# See README.exception_lists for details +# + +# +# Without nested repositories, this list could be empty, because ON +# checks for unref relative to usr, and the git files are all in the +# root of the repository. +# + +*/.git diff --git a/usr/src/tools/findunref/exception_list.unknown b/usr/src/tools/findunref/exception_list.unknown new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/usr/src/tools/findunref/exception_list.unknown diff --git a/usr/src/tools/man/Makefile b/usr/src/tools/man/Makefile new file mode 100644 index 0000000000..5f0e685323 --- /dev/null +++ b/usr/src/tools/man/Makefile @@ -0,0 +1,37 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source.  A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2015, Joyent, Inc. +# + +include $(SRC)/cmd/man/Makefile.com +include ../Makefile.tools + +include ../Makefile.targ + +all: $(PROG) + +$(PROG): $(OBJS) +	$(LINK.c) $(OBJS) -o $@ $(LDLIBS) +	$(POST_PROCESS) + +%.o: $(SRC)/cmd/man/%.c +	$(COMPILE.c) $< + +$(ROOTONBLDMACHPROG): $(PROG) + +install: $(ROOTONBLDMACHPROG) + +clean: +	$(RM) $(OBJS) $(LINTFILES) + +include $(SRC)/tools/Makefile.targ diff --git a/usr/src/tools/mandoc/Makefile b/usr/src/tools/mandoc/Makefile index 8a865d599e..c04ace16d4 100644 --- a/usr/src/tools/mandoc/Makefile +++ b/usr/src/tools/mandoc/Makefile @@ -11,7 +11,7 @@  #  # Copyright 2017 Nexenta Systems, Inc. -# Copyright 2018 Joyent, Inc. +# Copyright 2019 Joyent, Inc.  #  CMDDIR=		$(SRC)/cmd/mandoc @@ -20,16 +20,16 @@ LCDIR=		$(SRC)/lib/libc/port  include		$(SRC)/tools/Makefile.tools  include		$(CMDDIR)/Makefile.common +CPPFLAGS +=	-_gcc=-nostdinc -I/usr/include -I$(ADJUNCT_PROTO)/usr/include +CPPFLAGS +=	-I. -include fts.h +CPPFLAGS +=	-D_FILE_OFFSET_BITS=64 +LDFLAGS +=	-L$(ADJUNCT_PROTO)/lib -R$(ADJUNCT_PROTO)/lib +  OBJS +=		fts.o \  		reallocarray.o \  		recallocarray.o \  		strtonum.o -CPPFLAGS +=	-_gcc=-nostdinc -CPPFLAGS +=	-I. -include fts.h -CPPFLAGS +=	-I$(NATIVE_ADJUNCT)/include -LDFLAGS +=	-L$(NATIVE_ADJUNCT)/lib -R$(NATIVE_ADJUNCT)/lib -  # 3rd party code  SMATCH=off diff --git a/usr/src/tools/onbld/Checks/Cddl.py b/usr/src/tools/onbld/Checks/Cddl.py index e2bbf09c02..42cbca2f5a 100644 --- a/usr/src/tools/onbld/Checks/Cddl.py +++ b/usr/src/tools/onbld/Checks/Cddl.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  CDDL = '''  CDDL HEADER START diff --git a/usr/src/tools/onbld/Checks/CmtBlk.py b/usr/src/tools/onbld/Checks/CmtBlk.py index 57eb5704c1..9400fd7c80 100644 --- a/usr/src/tools/onbld/Checks/CmtBlk.py +++ b/usr/src/tools/onbld/Checks/CmtBlk.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START diff --git a/usr/src/tools/onbld/Checks/Comments.py b/usr/src/tools/onbld/Checks/Comments.py index 8285be2daa..0715bb1b40 100644 --- a/usr/src/tools/onbld/Checks/Comments.py +++ b/usr/src/tools/onbld/Checks/Comments.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # @@ -41,7 +41,7 @@ from onbld.Checks.DbLookups import BugDB  from onbld.Checks.SpellCheck import spellcheck_line -bugre = re.compile(r'^(\d{2,7}) (.*)$') +bugre = re.compile(r'^(\d{2,7}|[A-Z]{1,7}-\d{1,7}) (.*)$')  def isBug(comment): diff --git a/usr/src/tools/onbld/Checks/Copyright.py b/usr/src/tools/onbld/Checks/Copyright.py index 81a80058aa..b358484c2b 100644 --- a/usr/src/tools/onbld/Checks/Copyright.py +++ b/usr/src/tools/onbld/Checks/Copyright.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # @@ -25,6 +25,7 @@  #  # Copyright 2008, 2010, Richard Lowe +# Copyright 2019 Joyent, Inc.  # Make sure there is a copyright claim for the current year. @@ -37,7 +38,7 @@ def is_copyright(line):  	return re.search(r'Copyright (?!\[yyyy\])', line)  def is_current_copyright(line): -	return re.search(r'Copyright.*\b%s\b' % time.strftime('%Y'), line) +	return re.search(r'Copyright %s Joyent, Inc.$' % time.strftime('%Y'), line)  def copyright(fh, filename=None, output=sys.stderr):  	ret = rights = goodrights = 0 @@ -56,8 +57,8 @@ def copyright(fh, filename=None, output=sys.stderr):  		err(output, "no copyright message found", filename)  		ret = 1  	elif goodrights == 0: -		err(output, "no copyright claim for current year found", -		    filename) +		err(output, "'Copyright %s Joyent, Inc.' not found" % +		    time.strftime('%Y'), filename)  		ret = 1  	return ret diff --git a/usr/src/tools/onbld/Checks/DbLookups.py b/usr/src/tools/onbld/Checks/DbLookups.py index 324cc58209..955206750f 100644 --- a/usr/src/tools/onbld/Checks/DbLookups.py +++ b/usr/src/tools/onbld/Checks/DbLookups.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # @@ -26,15 +26,16 @@  # Copyright 2010, Richard Lowe  # Copyright 2018 OmniOS Community Edition (OmniOSce) Association. +# Copyright (c) 2019, Joyent, Inc.  #  # Various database lookup classes/methods, i.e.: -#     * monaco -#     * bugs.opensolaris.org (b.o.o.)  #     * redmine (illumos.org) +#     * smartos  #  import re +import json  try:  	from urllib.request import urlopen, Request  	from urllib.error import HTTPError @@ -66,9 +67,9 @@ class BugDB(object):  	print r["6505625"]["synopsis"]  	""" -	VALID_DBS = ["illumos"] +	VALID_DBS = ["illumos", "smartos"] -	def __init__(self, priority = ["illumos"]): +	def __init__(self, priority = VALID_DBS):  		"""Create a BugDB object.  		Keyword argument: @@ -79,6 +80,24 @@ class BugDB(object):  				raise BugDBException(database)  		self.__priority = priority +	def __smartosbug(self, cr): +		url = "http://smartos.org/bugview/json/%s" % cr +		req = Request(url) + +		try: +			data = urlopen(req) +		except HTTPError, e: +			if e.code == 404 or e.code == 403 or e.code == 400: +				raise NonExistentBug(cr) +			else: +				raise + +		bug = json.load(data) + +		return {'cr_number': bug['id'], +			'synopsis': bug['summary'] +		} +  	def __illbug(self, cr):  		url = "http://illumos.org/issues/%s.xml" % cr @@ -121,6 +140,12 @@ class BugDB(object):  						results[str(cr)] = self.__illbug(cr)  					except NonExistentBug:  						continue +			elif database == "smartos": +				for cr in crs: +					try: +						results[str(cr)] = self.__smartosbug(cr) +					except NonExistentBug: +						continue  			# the CR has already been found by one bug database  			# so don't bother looking it up in the others diff --git a/usr/src/tools/onbld/Checks/HdrChk.py b/usr/src/tools/onbld/Checks/HdrChk.py index c2697dcaf2..8f7b946d12 100644 --- a/usr/src/tools/onbld/Checks/HdrChk.py +++ b/usr/src/tools/onbld/Checks/HdrChk.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # diff --git a/usr/src/tools/onbld/Checks/Keywords.py b/usr/src/tools/onbld/Checks/Keywords.py index cd4dda0b69..0866178756 100644 --- a/usr/src/tools/onbld/Checks/Keywords.py +++ b/usr/src/tools/onbld/Checks/Keywords.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # diff --git a/usr/src/tools/onbld/Checks/Mapfile.py b/usr/src/tools/onbld/Checks/Mapfile.py index 5b40d26005..e4166c5792 100644 --- a/usr/src/tools/onbld/Checks/Mapfile.py +++ b/usr/src/tools/onbld/Checks/Mapfile.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # diff --git a/usr/src/tools/onbld/Checks/__init__.py b/usr/src/tools/onbld/Checks/__init__.py index 9f0611d969..a8bca05d55 100644 --- a/usr/src/tools/onbld/Checks/__init__.py +++ b/usr/src/tools/onbld/Checks/__init__.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # diff --git a/usr/src/tools/onbld/Scm/__init__.py b/usr/src/tools/onbld/Scm/__init__.py index f45ecbc95f..8934eb3942 100644 --- a/usr/src/tools/onbld/Scm/__init__.py +++ b/usr/src/tools/onbld/Scm/__init__.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#!ON_PYTHON  #  # CDDL HEADER START  # @@ -24,5 +24,3 @@  # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.  # Use is subject to license terms.  # -# ident	"%Z%%M%	%I%	%E% SMI" -# diff --git a/usr/src/tools/scripts/Makefile b/usr/src/tools/scripts/Makefile index 1ec73ce144..e98068051d 100644 --- a/usr/src/tools/scripts/Makefile +++ b/usr/src/tools/scripts/Makefile @@ -49,6 +49,7 @@ SHFILES= \  PERLFILES= \  	check_rtime \  	find_elf \ +	gensetdefs \  	interface_check \  	interface_cmp \  	jstyle \ diff --git a/usr/src/tools/scripts/build_cscope.conf b/usr/src/tools/scripts/build_cscope.conf index 859b5137d6..298db1281b 100644 --- a/usr/src/tools/scripts/build_cscope.conf +++ b/usr/src/tools/scripts/build_cscope.conf @@ -22,8 +22,8 @@  #  # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.  # Use is subject to license terms. +# Copyright 2018 Joyent, Inc.  # -# ident	"%Z%%M%	%I%	%E% SMI"  #  # This file configures the set of cross-references built by build_cscope.  # The format is: @@ -35,6 +35,6 @@  # directories.  # -complete  -f   . +complete  ""   .  uts	  ""   uts uts/sun4u uts/sun4v uts/i86pc  psm	  ""   psm/stand psm/stand/boot psm/stand/boot/sparcv9/sun4u psm/stand/boot/sparcv9/sun4v diff --git a/usr/src/tools/scripts/gensetdefs.pl b/usr/src/tools/scripts/gensetdefs.pl new file mode 100644 index 0000000000..8ca5782feb --- /dev/null +++ b/usr/src/tools/scripts/gensetdefs.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl -w +# +# COPYRIGHT 2013 Pluribus Networks Inc. +# +# All rights reserved. This copyright notice is Copyright Management +# Information under 17 USC 1202 and is included to protect this work and +# deter copyright infringement.  Removal or alteration of this Copyright +# Management Information without the express written permission from +# Pluribus Networks Inc is prohibited, and any such unauthorized removal +# or alteration will be a violation of federal law. + +use strict; + +my @Sections = split(/\n/, `elfedit -r -e \'shdr:sh_name -osimple\' $ARGV[0] 2>&1`); + +foreach my $Section (@Sections) { +	if ($Section =~ "^set_") { +		print "\tfixing $Section\n"; + +		chomp(my $SectionAddr = `elfedit -r -e \'shdr:sh_addr -onum $Section\' $ARGV[0] 2>&1`); +		chomp(my $SectionSize = `elfedit -r -e \'shdr:sh_size -onum $Section\' $ARGV[0] 2>&1`); +		my $SectionEnd = hex($SectionAddr) + hex($SectionSize); + +		`elfedit -e \'sym:st_bind __start_$Section global\' $ARGV[0] 2>&1`; +		`elfedit -e \'sym:st_value __start_$Section $SectionAddr\' $ARGV[0] 2>&1`; +		`elfedit -e \'sym:st_shndx __start_$Section $Section\' $ARGV[0] 2>&1`; +		`elfedit -e \'sym:st_bind __stop_$Section global\' $ARGV[0] 2>&1`; +		`elfedit -e \'sym:st_value __stop_$Section $SectionEnd\' $ARGV[0] 2>&1`; +		`elfedit -e \'sym:st_shndx __stop_$Section $Section\' $ARGV[0] 2>&1`; +	} +} diff --git a/usr/src/tools/scripts/webrev.sh b/usr/src/tools/scripts/webrev.sh index 39f709d444..22ea97d507 100644 --- a/usr/src/tools/scripts/webrev.sh +++ b/usr/src/tools/scripts/webrev.sh @@ -2954,7 +2954,12 @@ done  #  # Output directory.  # -WDIR=${WDIR:-$CWS/webrev} +if [[ $SCM_MODE == "git" ]]; then +	ws_top_dir=$(dirname $CWS) +	WDIR=${WDIR:-$ws_top_dir/webrev} +else +	WDIR=${WDIR:-$CWS/webrev} +fi  #  # Name of the webrev, derived from the workspace name or output directory; diff --git a/usr/src/tools/smatch/Makefile b/usr/src/tools/smatch/Makefile index 3fac59a066..b876b8bb36 100644 --- a/usr/src/tools/smatch/Makefile +++ b/usr/src/tools/smatch/Makefile @@ -28,7 +28,11 @@ include ../Makefile.tools  i386_CC = $(GNUC_ROOT)/bin/gcc  sparc_CC = $(GNUC_ROOT)/bin/gcc -CFLAGS = -O -D__sun -Wall -Wno-unknown-pragmas -std=gnu99 -nodefaultlibs +# +# Note that we always build smatch 64-bit, assuring that we get the same binary +# regardless of the image of the build machine. +# +CFLAGS = -O -m64 -D__sun -Wall -Wno-unknown-pragmas -std=gnu99 -nodefaultlibs  SMATCHDATADIR = $(ROOTONBLDSHARE)/smatch @@ -38,11 +42,20 @@ CFLAGS += -DMULTIARCH_TRIPLET=NULL  LDLIBS += -lsqlite3 -lcrypto -lm -lgcc -lc  LDFLAGS = $(MAPFILE.NES:%=-Wl,-M%) + +# +# To allow linking to $(NATIVE_ADJUNCT) libraries on both multiarch (where +# 64-bit libraries will be found in $(NATIVE_ADJUNCT)/lib/$(MACH64)) and 64-bit +# images (where 64-bit libraries will be found in $(NATIVE_ADJUNCT)/lib/), we +# set our library and run paths to both locations. +#  LDFLAGS += -L$(NATIVE_ADJUNCT)/lib -R$(NATIVE_ADJUNCT)/lib +LDFLAGS += -L$(NATIVE_ADJUNCT)/lib/$(MACH64) -R$(NATIVE_ADJUNCT)/lib/$(MACH64)  CPPFLAGS += -nostdinc  CPPFLAGS += -Isrc/  CPPFLAGS += -I$(NATIVE_ADJUNCT)/include +CPPFLAGS += -I/usr/include  # no install.bin  INS.file = $(RM) $@; $(CP) $< $(@D); $(CHMOD) $(FILEMODE) $@ | 
